Migrating the Responses API from Fireworks AI to Sarvam
Last updated: October 23, 2026
This guide covers moving Fireworks AI Responses API
calls to Sarvam’s POST /v2/responses.
For Chat Completions, see Migrating Chat Completion.
In short: Fireworks stores responses and lets you chain calls with
previous_response_id. Sarvam’s Responses API is stateless: keep the conversation in
your app and send it in input on every call. Change base_url, api_key, and model, and
replace server-side tools (web_search, mcp, python) with function tools you run yourself.
Migration checklist
- Change
base_urltohttps://api.sarvam.ai/v2andapi_keyto your Sarvam key. - Replace each model ID using the model ID table.
- Replace
previous_response_idchaining with a history list sent ininput(Conversation history). - Remove
store,background, and calls to retrieve stored responses (list). - Replace server-side tools with function tools (Tools).
- On
glm5.3andglm5.3-flash, don’t send"max"; omittingreasoning.effortgivesmaxonglm5.3andhighonglm5.3-flash(Reasoning). - Set
max_output_tokens: it has no default cap on Sarvam.
Quick start
Before (Fireworks)
After (Sarvam)
Conversation history
On Fireworks, each response is stored and the next call can point at it with
previous_response_id. On Sarvam, nothing is stored: keep the turns in a list and send the
whole list in input. previous_response_id, store: true, conversation, and
background: true return 400, and GET /v2/responses/{id} returns 404.
Long conversations grow input on every turn. Trim or summarize older turns yourself to stay
within the model’s context window.
Reasoning
Reasoning tokens count toward max_output_tokens, which has no default cap on Sarvam.
Tools
Sarvam’s Responses API supports function tools only, in the flat Responses format:
{"type": "function", "name": ..., "parameters": ...}.
The function call round trip is the same as on Fireworks, except that you resend the history
instead of passing previous_response_id: send the function_call item and a
function_call_output item in the next request’s input. See the
OpenRouter Responses guide’s full example,
which works the same way for any stateless client.
tool_choice accepts "auto", "none", "required", or a named function.
parallel_tool_calls: false limits a turn to one tool call on every open-weight model, and max_tool_calls returns 400.
Fields to remove
Parameter concept map
Common mistakes
Passing previous_response_id
Sarvam returns 400. Keep the history in your app and send it in input, as in
Conversation history.
Fetching a stored response by id
Nothing is stored, so GET /v2/responses/{id} returns 404. Save what you need from each
response when you receive it.
Using server-side tools
web_search, mcp, and python tools aren’t run on Sarvam. Most models return 400;
gemma4 and sarvam-105b accept web_search and mcp but never call them. Run them
yourself and expose them as function tools.
Sending reasoning.effort: max to glm5.3
glm5.3 and glm5.3-flash return 400 for the literal string "max". Omit the field: that gives max on glm5.3 and high on glm5.3-flash.
See also
- Migration overview: base URL, auth, and model IDs
- Migrating Chat Completion from Fireworks
- Responses API guide
- Responses API reference