Open-Source Models
Open-Source Models
Alongside its own models, Sarvam serves a small set of open-source models. You reach
them through the same chat completions API, with the same API key, credits, and rate
limits — only the model field changes.
Available in beta. GLM-5.3, Gemma 4 31B, and DeepSeek V4 Flash are rolling out
gradually — your API key must be whitelisted for beta access
before these models respond. A key without access is refused with
400 invalid_request_error before the model is called.
Contact us to request access.
This page focuses on the open-source models on /v2. The same endpoint also serves
sarvam-105b — see Sarvam-105B.
sarvam-105b-conversations is on /v1
only. Call GET /v2/models to see which IDs your
key can use.
These models are not tuned for Indian languages. For Indian languages, Indic scripts, or code-mixed input, use Sarvam’s own models — they are trained and evaluated for it. Reach for an open-source model when you need a capability Sarvam’s models do not offer, such as a very large context window or image input.
Available models
1,048,576 token context window with tool calling and visible reasoning. Text input only.
Image understanding and tool calling, answering directly without a reasoning pass.
1M token context window with tool calling and visible reasoning, at a lower cost per token than GLM-5.3. Text input only.
Capabilities at a glance
For comparison, Sarvam’s flagship chat model
sarvam-105b supports tool calling with 128K
context and is tuned for 23 languages (22 Indian + English).
Using an open-source model
Open-source models are served on /v2/chat/completions. The same models also
accept the OpenAI Responses protocol at POST /v2/responses.
The chat endpoint also accepts sarvam-105b. Sarvam chat models — including
sarvam-105b-conversations — are on /v1; /v1 does not accept glm5.3,
gemma4, or deepseekv4-flash.
Authentication uses the api-subscription-key header. A missing or invalid key is
refused with 403 invalid_api_key_error. GET /v2/models
and GET /v2/models/{model_id} are unauthenticated
and list only the models available to you.
Use the Sarvam SDK — client.open_source_models.chat_completions_v2(...) in Python, or client.openSourceModels.chatCompletionsV2(...) in JavaScript.
Model selection
In most cases the answer is a Sarvam model — reach for an open-source model only when you need a capability Sarvam’s own models do not have.
The three are not interchangeable. glm5.3 and deepseekv4-flash reason before every
answer but cannot see images; gemma4 sees images but never produces reasoning. All three
support tool calling.
Supported parameters
These models accept the same OpenAI-compatible parameters as Sarvam’s chat models, with the exceptions called out below. Support differs per model where the model itself lacks the capability.
Full request and response schema: Open-Source Models API Reference.
OpenAI-compatible fields not listed above — logit_bias, user, and similar — are
accepted but ignored. logprobs: true currently fails as 503 model_overloaded rather
than being ignored. Unknown fields inside extra_body that the model backend does not
recognise are rejected.
wiki_grounding is not part of the /v2 schema. For
Wikipedia grounding,
use sarvam-105b on /v1.
Reasoning output
glm5.3 and deepseekv4-flash are reasoning models: they think before every answer,
whether or not reasoning_effort is set. The chain-of-thought arrives in a separate
reasoning_content field on the message — content holds only the final answer — and
in streaming responses it arrives as delta.reasoning_content chunks before the answer
starts. Reasoning tokens are billed as completion tokens and count against
max_tokens, so a budget that is too small is consumed entirely by reasoning and the
request returns content: null with finish_reason: "length".
Reasoning tokens are reported on
usage.completion_tokens_details.reasoning_tokens (and, with
stream_options.include_usage, on a later streaming chunk).
extra_body.chat_template_kwargs.enable_thinking: false is accepted but currently
does not disable thinking on glm5.3. Use reasoning_effort: "low" to keep the
trace short, or raise max_tokens so reasoning cannot consume the whole budget. On
POST /v2/responses, text.format of
json_object or json_schema skips the reasoning item.
gemma4 is not a reasoning model. It answers directly, never returns
reasoning_content, and setting reasoning_effort on it has no effect.
Structured Outputs
response_format works on all three models. Use
{"type": "json_schema", "json_schema": {...}} to constrain output to a JSON Schema, or
{"type": "json_object"} for the older JSON mode, which guarantees valid JSON but not a
specific shape.
On glm5.3 and deepseekv4-flash, keep max_tokens large enough for both
reasoning and the JSON when you set response_format. With reasoning active and a
small budget, a JSON-constrained request can return content: null.
extra_body.chat_template_kwargs.enable_thinking: false is still accepted but does not
currently disable glm5.3 thinking. For reliable JSON on glm5.3,
POST /v2/responses with text.format
json_object or strict json_schema skips the reasoning item.
On the Python SDK, pass extra_body and response_format as direct keyword
arguments to chat_completions_v2 (as above). On /v1/chat/completions, the
chat client does not expose response_format as a typed parameter — use
request_options={"additional_body_parameters": {"response_format": ...}}
instead; see Structured Outputs.
Don’t also ask for JSON in the prompt. When response_format is set, an instruction
like “Return JSON” in the message makes gemma4 emit whitespace until it exhausts
max_tokens — you are billed for the full budget and get no usable output. State the
task in the prompt and let response_format handle the shape.
Image input
Only gemma4 accepts images, and only as base64 data URIs. A remote http:// or
https:// URL is rejected — the API does not fetch images on your behalf. Full example on
the Gemma 4 31B page.
Each image counts against the request-size cap once encoded. Prompt and request-size checks use estimates — text at roughly 4 bytes per token, plus a flat per-image allowance — rather than an exact tokenizer count.
Tool schemas
function.parameters must be a JSON Schema object; a property defined as a bare string
is rejected. When tool_choice forces a call (required or a named function), schemas
must be self-contained: non-local $ref, unresolved $ref, recursive schemas, or a
combined expansion above 20,000 nodes across all tools in the request are rejected with
400.
Errors
Every error uses the same envelope — error.message, error.code, and
error.request_id (empty when the error is raised before a request id is assigned):
Timeouts, connection failures, and overload are retried automatically before a 503 is
returned. A request the model itself rejects is not retried and comes back as 422.
Support and expectations
What Sarvam supports
Sarvam supports the serving layer: availability, authentication, billing, rate limits, and API compatibility. If a request fails with a Sarvam error — an auth failure, a rate limit, a credits problem, a malformed response from our gateway — contact us.
What Sarvam does not support
Sarvam does not tune, evaluate, or publish benchmarks for these models, and does not guarantee their output quality. A model’s reasoning, factual accuracy, language coverage, and refusals are properties of the model itself rather than of Sarvam’s serving.
Availability and versioning
These models may be updated, versioned, or withdrawn on a different schedule from Sarvam’s own models. Do not assume one of these model IDs is a long-term stable contract — check the changelog before depending on one in production.
Licensing and terms
Each model carries its own open-source licence and acceptable-use terms, which apply to you as the end user in addition to Sarvam’s terms. Review the model’s licence before using it in a commercial product.
Shared behaviour
Everything below applies to both models:
- Endpoint —
POST https://api.sarvam.ai/v2/chat/completions. Full parameter reference: Open-Source Models API Reference. The same models also accept the OpenAI Responses protocol atPOST /v2/responses. Create-only and stateless: replayinputevery turn. Omitstoreor passfalse(OpenAI SDKs defaulttrue— that call is400). - Model discovery —
GET https://api.sarvam.ai/v2/modelslists the model IDs the endpoint currently serves. - Authentication —
api-subscription-key: sk_xxx. Invalid keys return403 invalid_api_key_error. See Authentication. - Beta access — granted per key. Without access, the endpoint returns
400 invalid_request_errorbefore calling the model. See Access to Beta APIs. - Streaming — set
"stream": truefor server-sent events. Chat still sends[DONE]; Responses does not. Pass chatstream_options.include_usagefor a usage chunk. Responses tool/reasoning streams useresponse.function_call_arguments.*andresponse.reasoning_text.*. - Billing — metered per token against your Sarvam credits, reasoning tokens
included. Per 1M tokens (input / cached input / output):
gemma4₹36.6 / ₹13.73 / ₹91.5,deepseekv4-flash₹19.8 / ₹0.63 / ₹59.4,glm5.3₹126 / ₹23.4 / ₹396. The three are not priced alike —glm5.3anddeepseekv4-flashreason before every answer, so budgetmax_tokensdeliberately, andglm5.3costs roughly 6×deepseekv4-flash. See Pricing. - Rate limits — applied per API key. See Credits & Rate Limits.