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.2 and Gemma 4 31B 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
512K token context window with tool calling and visible reasoning. Text input only.
Image understanding and tool calling, answering directly without a reasoning pass.
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 endpoint also
accepts sarvam-105b. Sarvam chat models — including sarvam-105b-conversations — are
on /v1; /v1 does not accept glm5.2 or gemma4.
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 two are not interchangeable. glm5.2 reasons before every answer but cannot see
images; gemma4 sees images but never produces reasoning. Both 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 — logprobs, logit_bias, user, and
similar — are accepted but 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.2 is a reasoning model: it thinks 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".
To turn reasoning off — faster, cheaper, and the whole budget goes to the answer — send
the thinking switch through extra_body:
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 both 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.2, turn thinking off whenever you set response_format (as in the example
below). With reasoning active, a JSON-constrained request returns content: null — the
reasoning trace and the JSON grammar conflict, and no answer is produced. With
enable_thinking: false the same request returns clean JSON reliably.
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. - 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. - 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,glm5.2₹128.1 / ₹23.79 / ₹402.6. The two are not priced alike —glm5.2costs roughly 3.5×gemma4, and it reasons before every answer, so budgetmax_tokensdeliberately. See Pricing. - Rate limits — applied per API key. See Credits & Rate Limits.