Skip to navigation

Migrating from Fireworks AI: Overview

View as Markdown

Last updated: October 23, 2026

Fireworks AI and Sarvam’s /v2 API both speak the OpenAI Chat Completions format, so most migrations are a base URL, key, and model ID change. This page covers those setup changes. The Chat Completion and Responses API guides cover request fields, reasoning, tools, and the Fireworks-only features to remove.

Quick start

Change the client and the model ID. Use the openai package you already have, or Sarvam’s own SDK (SDKs & Libraries). If you use the Fireworks SDK, the Before (Fireworks SDK) option shows that version; the request shape is the same, so you can move to either the openai package or Sarvam’s SDK.

from openai import OpenAI
client = OpenAI(
api_key="YOUR_FIREWORKS_API_KEY",
base_url="https://api.fireworks.ai/inference/v1",
)
response = client.chat.completions.create(
model="accounts/fireworks/models/kimi-k3",
messages=[{"role": "user", "content": "Hello!"}],
)

For requests made directly over HTTP, change the URL, the auth header, and the model ID:

curl https://api.fireworks.ai/inference/v1/chat/completions \
-H "Authorization: Bearer YOUR_FIREWORKS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "accounts/fireworks/models/glm-5p3-flash",
"messages": [{"role": "user", "content": "Explain UPI in two sentences."}],
"max_tokens": 1000
}'

Sarvam also accepts Authorization: Bearer <key>, which is what the openai package sends, so you don’t need to change how your client authenticates. Create a key in the Sarvam dashboard.

Zero-code switch

The openai package for Python and JavaScript reads its endpoint and key from the OPENAI_BASE_URL and OPENAI_API_KEY environment variables when you create the client without them. If your app does that, and reads the model ID from configuration, you can switch without changing code:

export OPENAI_BASE_URL="https://api.sarvam.ai/v2"
export OPENAI_API_KEY="YOUR_SARVAM_API_KEY"
from openai import OpenAI
client = OpenAI() # picks up OPENAI_BASE_URL and OPENAI_API_KEY

Then set your configured model to a Sarvam model ID. If your requests send Fireworks-only fields, remove them as described in the Chat Completion guide.

This works with the openai package only. If your code uses the Fireworks SDK, switch to the openai package first, as in the quick start.

Base URL and auth

Fireworks AISarvam
Base URLhttps://api.fireworks.ai/inference/v1 (or https://us.api.fireworks.ai/inference/v1)https://api.sarvam.ai/v2
Chat CompletionsPOST /chat/completionsPOST /chat/completions
ResponsesPOST /responsesPOST /responses (stateless)
Auth headerAuthorization: Bearer <key>api-subscription-key: <key> or Authorization: Bearer <key>
Auth failure status401403

Model IDs

Sarvam has one ID per model. Fireworks’ Fast and US router variants, and your own dedicated deployments of these models, map to the same Sarvam ID.

Fireworks modelSarvam modelStatus on Sarvam
accounts/fireworks/models/glm-5p3 (also routers/glm-5p3-fast, routers/glm-5p3-us)glm5.3GA
accounts/fireworks/models/glm-5p3-flash (also routers/glm-5p3-flash-us)glm5.3-flashGA
accounts/fireworks/models/gemma-4-31b-it (on-demand deployment on Fireworks)gemma4GA
accounts/fireworks/models/deepseek-v4p1-flash (also routers/deepseek-v4p1-flash-us)deepseekv4.1-flash-1017Beta
accounts/fireworks/routers/deepseek-v4p1-flash-1017-us (US-only router on Fireworks)deepseekv4.1-flash-1017Beta
accounts/fireworks/models/deepseek-v4-pro (April 2026 snapshot; on-demand deployment on Fireworks)deepseekv4-pro (0813 snapshot)Beta
accounts/fireworks/models/kimi-k3 (also routers/kimi-k3-fast, routers/kimi-k3-us)kimi-k3Beta
Not offered on Fireworksmimo-v2.6-flashBeta
Not offered on Fireworks (only the MiMo V2.6 Pro-RL variant is listed)mimo-v2.6-proBeta

Sarvam’s deepseekv4-pro is the newer 0813 snapshot of DeepSeek V4 Pro, so outputs can differ from the April 2026 snapshot on Fireworks.

Gemma 4 31B and DeepSeek V4 Pro need a dedicated deployment on Fireworks. On Sarvam, call them by model ID like any other model, with no deployment to create or manage.

Model IDs are case-sensitive. An unknown ID returns 404 not_found_error. GET /v2/models lists the available models. Beta models need per-key access: without it, they return 400 invalid_request_error, even though the list shows them. Contact us to request access.

Models not on Sarvam

If you use a model that Sarvam doesn’t serve, start with the closest one below, then test it on your own prompts before switching traffic. These are suggestions, not drop-in equivalents.

If you useTry on SarvamWhy
GLM-5.3 Primeglm5.3Same GLM-5.3 generation.
GLM-5.3 FlashXglm5.3-flashSame fast GLM-5.3 variant family, with image input.
Earlier GLM (GLM-5.2, GLM-5.1, GLM-5, GLM-4.x)glm5.3Newer generation of the same family. For image input, use glm5.3-flash.
DeepSeek V4 Flash (any snapshot), DeepSeek V3.xdeepseekv4.1-flash-1017The DeepSeek Flash model Sarvam serves.
DeepSeek V4 Pro (April 2026 snapshot), DeepSeek R1deepseekv4-proSarvam serves the newer 0813 snapshot.
Kimi K2, K2.5, K2.6, K2.7 Code, K2 Thinkingkimi-k3Newer Kimi generation, with a longer 1M context.
MiMo V2.5, MiMo V2.6 Pro UltraSpeed, MiMo V2.6 Pro-RLmimo-v2.6-pro or mimo-v2.6-flashCurrent MiMo generation, with image, audio, and video input.
Gemma 3, Gemma 4 26Bgemma4Gemma 4 31B: image input, a 256K context window, and reasoning (off by default).

For other model families, such as Qwen, Llama, gpt-oss, or MiniMax, choose by what you need:

If you needTry on Sarvam
Indian-language qualitysarvam-105b
The lowest costmimo-v2.6-flash
Image inputglm5.3-flash, kimi-k3, gemma4, or the MiMo models
Audio inputmimo-v2.6-flash or mimo-v2.6-pro
Video inputmimo-v2.6-flash or mimo-v2.6-pro (chat only)
The hardest coding and agent tasksglm5.3 or deepseekv4-pro
Fast answers without reasoningmimo-v2.6-flash with thinking off, or gemma4

Media input and request size

Sarvam accepts images, audio, and video only as inline base64 data URIs. Remote http(s) URLs return 400 on every model, even where your current provider fetches them for you, so download the file and encode it before sending.

MediaModelsChat CompletionsResponses
ImageModels with image input, such as gemma4, glm5.3-flash, kimi-k3, and the MiMo modelsimage_url partinput_image part
Audiomimo-v2.6-flash, mimo-v2.6-proinput_audio part (wav or mp3), or an audio_url part with a data URI (WAV, MP3, FLAC, OGG, Opus)input_audio part (wav or mp3)
Videomimo-v2.6-flash, mimo-v2.6-pro, and kimi-k3 (beta, short clips)video_url partNot supported
import base64
def data_uri(path: str, mime: str) -> str:
with open(path, "rb") as f:
return f"data:{mime};base64," + base64.b64encode(f.read()).decode()
image_part = {"type": "image_url", "image_url": {"url": data_uri("chart.png", "image/png")}}
video_part = {"type": "video_url", "video_url": {"url": data_uri("clip.mp4", "video/mp4")}}

Request bodies, including base64 media, are limited to 40 MiB on kimi-k3 and the MiMo models, and 10 MiB on other models. Larger requests return 413 with the limit in the message. Base64 adds about 33%, so about 30 MB of raw media fits in a 40 MiB request.

Errors and rate limits

Sarvam returns 403 (not 401) for a missing or invalid key, 429 when you exceed a rate limit, and 503 when a model is overloaded. Retry 429 and 503 with backoff. Limits apply per API key, as requests per minute rather than Fireworks’ adaptive tokens-per-minute limits. See Errors & Troubleshooting and Credits & Rate Limits.

See also