Open-Weight Models
Run leading open-weight models on Sarvam infrastructure through the same OpenAI-compatible
/v2 API, with your existing Sarvam API key and credits. Switching models is a one-line
change to the model field.
Available in beta. Your API key must be whitelisted for beta access before these models respond. Contact us to request access.
Choose a model
Which model should I use?
Quickstart
Already use the OpenAI SDK? Point base_url at https://api.sarvam.ai/v2 and pass your
Sarvam key as api_key. The endpoint also accepts Authorization: Bearer <key>. Native
Sarvam clients use the api-subscription-key header. See Authentication.
Common patterns
Streaming
Reasoning
Tool calling
Images (Gemma)
Set stream=True to receive server-sent events. Reasoning models stream
reasoning_content deltas first, then the final content.
Reasoning
glm5.3 and deepseekv4.1-flash think before answering. When reasoning_effort is omitted,
the default is max.
On the Responses API, do not send the string "max" to glm5.3. It returns 400.
Omit the reasoning field instead.
Reasoning tokens count toward max_tokens and are billed as output. If you see empty
content with finish_reason: "length", the model spent the whole budget thinking. Raise
max_tokens or lower the effort. On glm5.3, max_tokens defaults to 2048.
Troubleshooting
Production tips
Retry on 429 and 503
Rate limits and temporary overload are retryable. The OpenAI SDK retries these automatically
with backoff when you raise max_retries:
Budget tokens for reasoning
Set max_tokens well above your expected answer length, at least a few thousand for
high or max effort, because thinking tokens share the same budget.
Match effort to the task
Use low for extraction, classification and chat. Reserve high and max for math,
debugging and multi-step planning, where extra thinking improves quality at higher latency and cost.
Switch models without code changes
Read the model ID from configuration, for example model=os.environ.get("SARVAM_MODEL", "glm5.3"),
so you can compare models on your own prompts. Only change parameters the target model supports,
see the comparison table above.
Platform details
Endpoints and model discovery
- Chat:
POST https://api.sarvam.ai/v2/chat/completions, see the API reference. - Responses:
POST https://api.sarvam.ai/v2/responses, see the API reference. - Models:
GET /v2/modelslists the IDs enabled for your key.
Billing and rate limits
Usage is metered per token against your Sarvam credits, see Pricing. Reasoning is billed as output. Limits apply per API key, see Credits & Rate Limits.
Beta access
Access is granted per API key. See Access to Beta APIs.