> Sarvam Voice Agents (Samvaad) is a voice AI agent platform for Indian languages: build, test and deploy AI calling agents on your own phone numbers, from ₹3 a minute. Start here: https://docs.sarvam.ai/voice-agents/why-voice-agents. > For clean Markdown of any page, append `.md` to the page URL. > For a complete documentation index, see https://docs.sarvam.ai/llms.txt. For a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt). > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server. # Token Factory > Token Factory serves open-weight LLMs (GLM, Gemma, DeepSeek, Kimi, MiMo) on one OpenAI-compatible API, using your existing Sarvam API key, SDK, and credits. **Token Factory** serves leading open-weight LLMs on Sarvam infrastructure through one OpenAI-compatible API. It uses the **same API key, SDK, and credits** as every other Sarvam API: there is nothing new to sign up for. Switching models is a one-line change to the `model` field. ## Switch from OpenAI in two lines Point your client at `https://api.sarvam.ai/v2`, pass your Sarvam key, and pick a model. #### Python (OpenAI SDK) ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.sarvam.ai/v2", # was https://api.openai.com/v1 api_key=os.environ["SARVAM_API_KEY"], ) response = client.chat.completions.create( model="glm5.3", # or "glm5.3-flash", "gemma4" messages=[{"role": "user", "content": "Explain UPI in two sentences."}], max_tokens=1000, ) print(response.choices[0].message.content) ``` #### Python (Sarvam SDK) ```python import os from sarvamai import SarvamAI client = SarvamAI(api_subscription_key=os.environ["SARVAM_API_KEY"]) response = client.chat.completions_v2( model="glm5.3", # or "glm5.3-flash", "gemma4" messages=[{"role": "user", "content": "Explain UPI in two sentences."}], max_tokens=1000, ) print(response.choices[0].message.content) ``` #### cURL ```bash curl -X POST https://api.sarvam.ai/v2/chat/completions \ -H "api-subscription-key: $SARVAM_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "glm5.3", "messages": [{"role": "user", "content": "Explain UPI in two sentences."}], "max_tokens": 1000 }' ``` ## Models | Model | Model ID | Best for | Input / output price (₹ per 1M tokens) | | -------------------------------------------------------- | -------------- | ------------------------------- | -------------------------------------- | | [GLM-5.3](/api/token-factory/models/glm-5-3) | `glm5.3` | Coding and long-horizon agents | ₹126 / ₹390 | | [GLM-5.3 Flash](/api/token-factory/models/glm-5-3-flash) | `glm5.3-flash` | Fast reasoning with image input | ₹13.5 / ₹45 | | [Gemma 4 31B](/api/token-factory/models/gemma-4-31b) | `gemma4` | Images and low-latency answers | ₹35 / ₹90 | [DeepSeek V4.1 Flash 1017](/api/token-factory/models/deepseek-v4.1-flash-1017), [DeepSeek V4 Pro](/api/token-factory/models/deepseek-v4-pro), [Kimi K3](/api/token-factory/models/kimi-k3), [MiMo V2.6 Flash](/api/token-factory/models/mimo-v2.6-flash), and [MiMo V2.6 Pro](/api/token-factory/models/mimo-v2.6-pro) are in [beta](/api-reference/beta-apis) and are enabled per API key. See [Pricing](/api/getting-started/pricing) for their rates and for cached-input rates. Moving from another provider? Follow the guide for [OpenRouter](/api/token-factory/migrations/from-openrouter/overview), [Fireworks AI](/api/token-factory/migrations/from-fireworks/overview), or [Together AI](/api/token-factory/migrations/from-together/overview). Looking for Sarvam's own LLM? [Sarvam 105B](/api/api-guides-tutorials/models/sarvam-105b) is listed with the other Sarvam Models and uses the same Chat Completions API. ## Where to go next #### [Compare models](/api/token-factory/models) Context windows, reasoning, and feature support side by side. #### [Chat Completions](/api/token-factory/chat-completions) Streaming, tool calling, reasoning, and structured output. #### [Responses API](/api/token-factory/responses-api) Stateless responses with reasoning and tools. > Token Factory serves open-weight LLMs (GLM, Gemma, DeepSeek, Kimi, MiMo) on one OpenAI-compatible API, using your existing Sarvam API key, SDK, and credits. ## Docs - [Open-Weight Models](https://docs.sarvam.ai/api/token-factory/models.md): Open-weight models served on Sarvam infrastructure through the OpenAI-compatible chat completions API, using your existing Sarvam API key and credits. - [GLM-5.3](https://docs.sarvam.ai/api/token-factory/models/glm-5-3.md): GLM-5.3 is a large-scale reasoning model built for complex software engineering and long-horizon agent tasks. It supports text input and output with a 1,048,576-token context window. - [GLM-5.3 Flash](https://docs.sarvam.ai/api/token-factory/models/glm-5-3-flash.md): GLM-5.3 Flash is a faster open-weight reasoning model with text and image input, a 1,048,576-token context window, and tool calling. - [Gemma 4 31B](https://docs.sarvam.ai/api/token-factory/models/gemma-4-31b.md): Gemma 4 31B is a 31B-parameter instruction-tuned model for text and image understanding. It supports a 262,144-token context window, tool calling, and optional reasoning. - [DeepSeek V4.1 Flash 1017](https://docs.sarvam.ai/api/token-factory/models/deepseek-v4.1-flash-1017.md): DeepSeek V4.1 Flash 1017 is a general-purpose open-weight reasoning model with text and image input and text output, a 1,048,576-token context window, and tool calling. - [DeepSeek V4 Pro](https://docs.sarvam.ai/api/token-factory/models/deepseek-v4-pro.md): DeepSeek V4 Pro is the larger open-weight DeepSeek V4 reasoning model, with text input and output, a 1,000,000-token context window, and tool calling. - [Kimi K3](https://docs.sarvam.ai/api/token-factory/models/kimi-k3.md): Kimi K3 is an open-weight reasoning model with text, image, and video input, a 1,048,576-token context window, and tool calling. - [MiMo V2.6 Flash](https://docs.sarvam.ai/api/token-factory/models/mimo-v2.6-flash.md): MiMo V2.6 Flash is an open-weight reasoning model with text, image, audio, and video input, a 1,048,576-token context window, tool calling, and structured output. - [MiMo V2.6 Pro](https://docs.sarvam.ai/api/token-factory/models/mimo-v2.6-pro.md): MiMo V2.6 Pro is an open-weight reasoning model with text, image, audio, and video input, a 1,048,576-token context window, tool calling, and structured output. - [Chat Completion API](https://docs.sarvam.ai/api/token-factory/chat-completions.md): Get started with Sarvam AI LLM models for conversational AI. Build intelligent chat applications with native Indian language support and deep contextual reasoning capabilities. - [Responses API](https://docs.sarvam.ai/api/token-factory/responses-api.md): Create stateless text, reasoning, structured-output, and tool-calling responses with Sarvam's OpenAI-compatible Responses API. - [How to list your chat messages](https://docs.sarvam.ai/api/token-factory/how-to/list-your-chat-messages.md): Defines your entire conversation. - [How to control response randomness with `temperature`](https://docs.sarvam.ai/api/token-factory/how-to/control-response-randomness.md): Control how focused or varied model responses are. - [How to control response diversity with `top_p`](https://docs.sarvam.ai/api/token-factory/how-to/control-response-diversity.md): Method used to generate text by limiting the possibilities of the next word - [How to adjust the model's thinking level with `reasoning_effort`](https://docs.sarvam.ai/api/token-factory/how-to/adjust-the-models-thinking-level.md): controls **how much effort the model puts into reasoning. - [How to encourage new topics with `presence_penalty`](https://docs.sarvam.ai/api/token-factory/how-to/encourage-new-topics-in-response.md): Helps you steer the model toward introducing new concepts or topics. - [How to reduce repetition with `frequency_penalty`](https://docs.sarvam.ai/api/token-factory/how-to/reduce-repetition-words-or-phrases-in-response.md): Helps you control how often the model repeats words or phrases - [How to get repeatable results using `seed`](https://docs.sarvam.ai/api/token-factory/how-to/get-repeatable-results.md): Reduce output variation with best-effort seeded sampling - [How to control the response length with `max_tokens`](https://docs.sarvam.ai/api/token-factory/how-to/control-the-response-length.md): control how long the model's response can be - [How to control where the model stops using `stop`](https://docs.sarvam.ai/api/token-factory/how-to/control-where-the-model-stops.md): Tell the model to **stop generating further tokens. - [Migrating from OpenRouter: Overview](https://docs.sarvam.ai/api/token-factory/migrations/from-openrouter/overview.md): Base URL, auth, model ID mapping, and SDK changes for teams moving open-weight model traffic from OpenRouter to Sarvam's OpenAI-compatible /v2 API. - [Migrating Chat Completion from OpenRouter to Sarvam](https://docs.sarvam.ai/api/token-factory/migrations/from-openrouter/chat-completion.md): Request fields, reasoning, Responses API, and OpenRouter-only features to change when moving chat traffic from OpenRouter to Sarvam's /v2 API, with before/after code. - [Migrating the Responses API from OpenRouter to Sarvam](https://docs.sarvam.ai/api/token-factory/migrations/from-openrouter/responses-api.md): Request fields, reasoning items, function tools, streaming, and OpenRouter-only options to change when moving Responses API calls from OpenRouter to Sarvam's /v2/responses. - [Migrating from Fireworks AI: Overview](https://docs.sarvam.ai/api/token-factory/migrations/from-fireworks/overview.md): Base URL, auth, model ID mapping, and SDK changes for teams moving open-weight model traffic from Fireworks AI to Sarvam's OpenAI-compatible /v2 API. - [Migrating Chat Completion from Fireworks AI to Sarvam](https://docs.sarvam.ai/api/token-factory/migrations/from-fireworks/chat-completion.md): Request fields, reasoning, Responses API, and Fireworks-only features to change when moving chat traffic from Fireworks AI to Sarvam's /v2 API, with before/after code. - [Migrating the Responses API from Fireworks AI to Sarvam](https://docs.sarvam.ai/api/token-factory/migrations/from-fireworks/responses-api.md): Moving from Fireworks' stored Responses API to Sarvam's stateless /v2/responses: conversation history, reasoning, function tools, server-side tools, and fields to change. - [Migrating from Together AI: Overview](https://docs.sarvam.ai/api/token-factory/migrations/from-together/overview.md): Base URL, auth, model ID mapping, and SDK changes for teams moving open-weight model traffic from Together AI to Sarvam's OpenAI-compatible /v2 API. - [Migrating Chat Completion from Together AI to Sarvam](https://docs.sarvam.ai/api/token-factory/migrations/from-together/chat-completion.md): Request fields, reasoning, error codes, and Together-only features to change when moving chat traffic from Together AI to Sarvam's /v2 API, with before/after code.