Overview
Sarvam AI is a voice and LLM provider focused on Indian languages (10 Indic languages + English). Bifrost supports both its text and voice workloads:- OpenAI-compatible chat (Token Factory v2) - Chat completions delegate to the shared OpenAI implementation; Bifrost targets Sarvam’s
/v2API - Text-to-Speech (Bulbul) - Custom mapping; Sarvam returns base64-encoded audio in a JSON
audios[]array rather than raw binary - Speech-to-Text (Saaras/Saarika) - Custom mapping; multipart upload with Sarvam-specific response fields (
transcript,timestamps,diarized_transcript) - Decisions (Sarvam Prism) - Custom mapping to Sarvam’s System One API; returns calibrated probabilities for
noul,choice, andscorequestions - Dual authentication - Chat and decisions use
Authorization: Bearer; voice endpoints use theapi-subscription-keyheader
Supported Operations
Unsupported Operations (❌): Text Completions, Embeddings, Images, Files, Batch, and streaming transcription are not offered by the upstream Sarvam API. These return
UnsupportedOperationError.Setup & Configuration
Configure Sarvam AI as a provider. The same API key works for both chat and voice.- Web UI
- config.json
- API
- Go SDK
- Navigate to Models > Model Providers. Look for Sarvam AI under Configured Providers. If it is missing, click on Add New Provider and select Sarvam AI.
- Click Add Key or edit an existing key.
- Set a name for your key.
- Paste your API key directly or use an environment variable (for example,
env.SARVAM_API_KEY). - Set Allowed Models to All Models (default) or the specific model allowlist you want this key to serve.
- Save the provider configuration.
1. Chat Completions
Sarvam’s Token Factory v2 chat completions endpoint is OpenAI-compatible, so Bifrost delegates to the shared OpenAI implementation. For full parameter reference, message handling, tool conversion, and streaming behavior, see OpenAI Chat Completions.Available Models
Breaking change.
sarvam-30b is not served by Token Factory v2; a request for it returns 404. Replace it with sarvam-105b.Reasoning models.
sarvam-105b, glm5.3, glm5.3-flash, and deepseekv4.1-flash-1017 reason by default; gemma4 supports reasoning but leaves it off unless requested. Reasoning tokens count toward max_tokens; with a small budget the response can return empty content and finish_reason: "length". Use at least 1024 output tokens for reasoning models. Set reasoning_effort to low, high, or max; GLM models reject medium and xhigh.2. Responses API
Bifrost converts the Responses API format to Chat Completions internally, then converts the response back:previous_response_id, conversation, or background: true on this path: the request is converted to Chat Completions, which has no equivalent, so they are dropped. Set reasoning.effort to low, high, or max.
3. Decisions (Sarvam Prism)
Sarvam Prism is a decision model served byPOST /v2/systemone. It returns calibrated probabilities for typed questions instead of text, so it is reached through Bifrost’s /v1/decisions route, not chat.
Limits: 32,768 tokens per question (state + question + options), 2-255 options per
choice, and 2-10 levels per score. Images and box questions are refused locally. Streaming is not supported: stream, temperature, and max_tokens are dropped by Bifrost, and Sarvam returns 422 for them if they are forwarded as extra params. Each request must finish within 60 seconds.
sarvam-prism appears in the model list, but it is not a chat model: a chat request for it fails upstream with model_call_failed. Do not add it to blacklisted_models to hide it, because that list gates key selection and /v1/decisions would then fail with no keys found that support model.4. Speech (Text-to-Speech, Bulbul)
Sarvam’s TTS endpoint is not OpenAI-compatible: it returns JSON with base64-encoded audio in anaudios[] array, which Bifrost decodes into raw audio bytes. The streaming endpoint returns raw binary audio chunks, which Bifrost forwards as speech-audio deltas.
Parameter Mapping
Sarvam-specific fields are read from
ExtraParams: pitch, loudness, temperature, speech_sample_rate, output_audio_codec, enable_preprocessing, dict_id, enable_cached_responses.
target_language_code is required by Sarvam. Pass it as language_code or as an extra field; without it the request is rejected. bulbul:v2 is deprecated upstream; use bulbul:v3.5. Transcription (Speech-to-Text, Saaras/Saarika)
Sarvam’s STT endpoint accepts a multipart audio upload and returns a custom response shape that Bifrost maps onto its standard transcription format.Response Mapping
Request fields
mode and input_audio_codec are read from ExtraParams; language maps to Sarvam’s language_code.
timestamps and diarized_transcript are only returned by Sarvam’s Batch speech-to-text API; the synchronous /speech-to-text endpoint used here returns transcript and language_code. Bifrost maps words/diarized segments when present, so the standard path typically populates only text and language.Authentication
Sarvam uses different authentication for chat and voice, but the same API key works for both:- Chat / Responses:
Authorization: Bearer <key> - Speech / Transcription:
api-subscription-key: <key>
Configuration
HTTP Settings:- Base URL:
https://api.sarvam.ai(default) - Chat endpoint:
/v2/chat/completions - Decisions endpoint:
/v2/systemone - Models endpoint:
/v2/models - Voice endpoints:
/text-to-speech,/text-to-speech/stream,/speech-to-text
Caveats
Voice is not OpenAI-compatible
Voice is not OpenAI-compatible
Severity: Low
Behavior: TTS returns base64 JSON (not raw audio) and STT returns Indic-specific fields.
Impact: Handled by Bifrost’s custom mapping; no action needed by callers beyond passing
target_language_code for TTS.No streaming for transcription
No streaming for transcription
Severity: Low
Behavior: Sarvam does not offer streaming speech-to-text.
Impact:
TranscriptionStream returns UnsupportedOperationError. TTS streaming is supported via /text-to-speech/stream.Reasoning models need a larger output budget
Reasoning models need a larger output budget
Severity: Medium
Behavior: Reasoning tokens count toward
max_tokens. A small cap can leave content empty with finish_reason: "length".
Impact: Use at least 1024 output tokens for sarvam-105b, glm5.3, glm5.3-flash, and deepseekv4.1-flash-1017, or set reasoning_effort to low.Model-specific parameter limits
Model-specific parameter limits
Severity: Low
Behavior:
n > 1 is not supported. stop accepts at most 4 sequences on sarvam-105b and glm5.3. logprobs is rejected on glm5.3. GLM models accept only low, high, and max for reasoning_effort.
Impact: Requests outside these limits return an upstream 400 error.
