> This page is for Model APIs.

> 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.