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.3Serverless
accounts/fireworks/models/glm-5p3-flash (also routers/glm-5p3-flash-us)glm5.3-flashServerless
accounts/fireworks/models/gemma-4-31b-it (on-demand deployment on Fireworks)gemma4Serverless
accounts/fireworks/models/deepseek-v4p1-flash (also routers/deepseek-v4p1-flash-us)deepseekv4.1-flash-1017Serverless
accounts/fireworks/routers/deepseek-v4p1-flash-1017-us (US-only router on Fireworks)deepseekv4.1-flash-1017Serverless
accounts/fireworks/models/deepseek-v4-pro (April 2026 snapshot; on-demand deployment on Fireworks)deepseekv4-pro (0813 snapshot)Provisioned Throughput
accounts/fireworks/models/kimi-k3 (also routers/kimi-k3-fast, routers/kimi-k3-us)kimi-k3.1-proProvisioned Throughput

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. Models on Provisioned Throughput need access for your organisation. Without it, deepseekv4-pro returns 400 invalid_request_error; the other Provisioned Throughput models return 404 not_found_error and aren’t listed until access is enabled. 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-k3.1-proNewer Kimi generation, with a longer 1M context.
Gemma 3, Gemma 4 26Bgemma4Gemma 4 31B: image input, a 256K context window, and reasoning (off by default).
Qwen chat modelsqwen38-27bQwen 3.8 27B, on Provisioned Throughput: image input, a 256K context window, and reasoning you can turn off.

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

If you needTry on Sarvam
Indian-language qualitysarvam-105b
The lowest costglm5.3-flash
Image inputglm5.3-flash, kimi-k3.1-pro, qwen38-27b, or gemma4
Video inputkimi-k3.1-pro (chat only)
The hardest coding and agent tasksglm5.3 or deepseekv4-pro
Fast answers without reasoninggemma4
Yes/no, label, or score answers (routing, classification, moderation)sarvam-prism, or clef for questions about images, on the Decisions API
Text embeddings for search and retrievalembeddinggemma-2 on POST /v2/embeddings

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, and kimi-k3.1-proimage_url partinput_image part
Videokimi-k3.1-provideo_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.1-pro, 32 MiB on deepseekv4.1-flash-1017 and deepseekv4.1-flash-1017-interactive, 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