Migrating Chat Completion from Together AI to Sarvam
Last updated: October 23, 2026
This guide covers moving Together AI Chat Completions calls for open-weight models to
Sarvam’s /v2 API.
In short: change base_url, api_key, and model. Replace reasoning: {"enabled": false}
with reasoning_effort: "none", send logprobs as true instead of a number, and remove
Together-only fields such as safety_model: Sarvam returns 400 for request fields it
doesn’t support. Remember that 403 now means an auth error, not a context-length error.
Migration checklist
- Create an API key in the Sarvam dashboard.
- Change
base_urltohttps://api.sarvam.ai/v2andapi_keyto your Sarvam key. - Replace each model ID using the model ID table.
- Replace
reasoning: {"enabled": false}withreasoning_effort: "none"(Reasoning). - Remove Together-only fields:
safety_model,compliance,echo, and others (list). - Send
logprobsastrue, with the count intop_logprobs. - Update error handling:
403now means an invalid key, not a prompt that’s too long. - Set
max_tokensexplicitly, then run your tests and watch for400responses that name a field.
Quick start
Before (Together AI)
After (Sarvam)
Reasoning
Together-only fields to remove
Sarvam validates request fields and returns 400 invalid_request_error for fields it
doesn’t support, so leftover Together options fail loudly instead of being ignored.
Parameter concept map
Responses API
Together doesn’t offer a Responses API. Sarvam does: if you want the OpenAI Responses format, see the Responses API guide. It’s stateless, like Chat Completions.
What’s different by design
- No dedicated endpoints to manage. Models that are dedicated-only on Together, such as Gemma 4 31B, are called by model ID on Sarvam.
- Strict request validation. Unsupported fields return
400with the field named, instead of being dropped silently.gemma4is less strict: it accepts some fields, such aspredictionandlogit_bias, and ignores them. - One reasoning field. Reasoning comes back in
reasoning_contentfor every model. - Different meaning for
403. On Sarvam it’s an auth error. See the status code table.
Platform features without a direct equivalent
Full example
A wrapper that turns thinking off, asks for log probabilities, and maps status codes:
Common mistakes
Treating 403 as a context-length error
On Sarvam, 403 means the API key is missing or invalid. Don’t trim the prompt and retry
on 403; check the key instead.
Keeping the organisation prefix in the model ID
moonshotai/Kimi-K3 returns 404 on Sarvam. Use kimi-k3. Model IDs are
case-sensitive. See the model ID table.
Sending reasoning: {enabled: false}
Sarvam returns 400. Use reasoning_effort: "none" on models that can turn thinking
off.
Sending logprobs as a number
Sarvam expects logprobs: true and the count in top_logprobs.
Sending images or video by URL
Sarvam accepts images, audio, and video only as inline base64 data URIs; URLs return 400.
Download the file and encode it before sending. See
Media input.
See also
- Migration overview: base URL, auth, model IDs, and status codes
- Chat Completion overview
- Responses API guide
- Open-Weight Models
- Errors & Troubleshooting