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

# GLM-5.3

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

## At a glance

|                    |                                                                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| **Model ID**       | `glm5.3`                                                                                                                           |
| **Best for**       | Complex software engineering and long-horizon agent tasks                                                                          |
| **Context window** | 1,048,576 tokens                                                                                                                   |
| **Input → output** | Text → text                                                                                                                        |
| **Reasoning**      | **`low`**, **`high`**, or **`max`** (default when omitted). See [Reasoning](#reasoning)                                            |
| **Tool calling**   | Supported, including `parallel_tool_calls: false`                                                                                  |
| **APIs**           | [`POST /v2/chat/completions`](/api-reference/chat/chat-completions-v2) and [`POST /v2/responses`](/api-reference/responses/create) |
| **Pricing**        | ₹126 input · ₹20 cached input · ₹390 output per 1M tokens; reasoning is billed as output ([Pricing](/api/getting-started/pricing)) |

## Key capabilities

#### Software engineering

Reason across large repositories, implementation plans, and multi-step coding tasks.

#### Long-horizon agents

Use tool calling and extended context for workflows that require many dependent steps.

#### Long context

Process up to 1,048,576 tokens across the prompt and generated output.

#### Streaming

Receive reasoning and final-answer deltas as server-sent events.

> **Tip**
>
> Moving from [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)? The migration guides map model IDs and request fields to Sarvam.

## Quickstart

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

response = client.chat.completions_v2(
    model="glm5.3",
    messages=[
        {
            "role": "user",
            "content": "Explain the difference between a B-tree and a B+ tree index.",
        }
    ],
    temperature=1,
    top_p=0.95,
    max_tokens=8000,
)

print(response.choices[0].message.content)
```

#### JavaScript

```javascript
import { SarvamAIClient } from "sarvamai";

const client = new SarvamAIClient({
    apiSubscriptionKey: "YOUR_SARVAM_API_KEY",
});

async function main() {
    const response = await client.chat.completionsV2({
        model: "glm5.3",
        messages: [
            {
                role: "user",
                content: "Explain the difference between a B-tree and a B+ tree index.",
            },
        ],
        temperature: 1,
        top_p: 0.95,
        max_tokens: 8000,
    });

    console.log(response.choices[0].message.content);
}

main();
```

#### 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 the difference between a B-tree and a B+ tree index."
      }
    ],
    "temperature": 1,
    "top_p": 0.95,
    "max_tokens": 8000
  }'
```

## Supported parameters

`model: "glm5.3"` on [Chat Completion V2](/api-reference/chat/chat-completions-v2)
and [Responses](/api-reference/responses/create). Full request/response schemas live on
those API reference pages; this table covers what's actually accepted for this model.

| Parameter                                             |                 Chat Completion V2                 |                                Responses                                |
| ----------------------------------------------------- | :------------------------------------------------: | :---------------------------------------------------------------------: |
| Streaming (`stream`)                                  |                                                    |                                                                         |
| Tool calling (`tools`, `tool_choice`)                 |                                                    |                                                                         |
| `parallel_tool_calls: false` enforced                 |                                                    |                                                                         |
| Structured output (`response_format` / `text.format`) |                                                    |                                                                         |
| Log probabilities (`logprobs`, `top_logprobs`)        |                        `400`                       |                                   `400`                                 |
| Multiple choices (`n` > 1)                            |                        `400`                       |                                   `400`                                 |
| Reasoning control                                     | `reasoning_effort`: `low`, `high`, `max` (default) | `reasoning.effort`: `low` or `high` only; literal `"max"` returns `400` |
| Turn reasoning off                                    |                    always thinks                   |                               always thinks                             |

All `400`s above are `invalid_request_error` for unsupported/invalid parameters.

## Reasoning

GLM-5.3 has three reasoning modes, `low`, `high`, and `max`, but which values you can
pass depends on the API:

| Route                                                         | Field              | Accepted values                                                                                                          |
| ------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| [Chat Completion V2](/api-reference/chat/chat-completions-v2) | `reasoning_effort` | `"low"`, `"high"`, or `"max"`; omitting the field also gives `max`                                                       |
| [Responses](/api-reference/responses/create)                  | `reasoning.effort` | `"low"` or `"high"` only. To get `max`-level reasoning, omit the field, sending the literal string `"max"` returns `400` |

Read the reasoning trace from `choices[].message.reasoning_content` on chat, or from the
reasoning item's `content[0].text` in `output` on Responses. Its `summary` is empty unless you
set `reasoning.summary` to `"auto"` or `"detailed"`. Reasoning tokens are billed as output tokens either way, and count
against `max_tokens` on chat (defaults to `2048` when omitted) or `max_output_tokens` on
Responses (no default, omitting it means unbounded generation). At the default `max` effort,
reasoning often uses several thousand tokens, so leave room for the answer.

Reasoning can't be turned off, but at `low` effort GLM-5.3 often skips it on simple prompts:
`reasoning_tokens` is `0` and Responses returns no reasoning item.

## Response fields (chat)

| Field                                              | Notes                                         |
| -------------------------------------------------- | --------------------------------------------- |
| `choices[].message.reasoning_content`              | Reasoning trace; billed as completion tokens. |
| `usage.completion_tokens_details.reasoning_tokens` | Tokens spent on reasoning.                    |

Full response shape: [Chat Completion V2](/api-reference/chat/chat-completions-v2).

## Known limitations

* **Output token budget.** `max_tokens` on chat defaults to `2048` when omitted;
  `max_output_tokens` on Responses has no default and allows unbounded generation.
  Reasoning counts against whichever budget applies, so a small `max_tokens` on chat can
  leave little or no room for the actual answer.
* **Context-length checks are approximate**, and more conservative for Latin-script text
  than for Indic scripts. Treat the model's own limit as authoritative.

Parameter errors (`n`, `logprobs`, `stop`, and similar) are documented on
[Chat Completion V2](/api-reference/chat/chat-completions-v2).

## Limits and errors

| Area           | Limit or condition                               | API response                                               | Recommended action                                                        |
| -------------- | ------------------------------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------- |
| Context        | Prompt tokens plus `max_tokens` exceed 1,048,576 | `400 invalid_request_error`                                | Shorten the prompt or reduce `max_tokens`.                                |
| Output         | `max_tokens` exceeds 1,048,576                   | `400 invalid_request_error`                                | Set `max_tokens` within the context window.                               |
| Modality       | Request includes image input                     | `400 invalid_request_error`                                | Send text input only.                                                     |
| Parameters     | More than four `stop` sequences                  | `400 invalid_request_error`                                | Send at most four stop strings.                                           |
| Request body   | Wrong JSON types (serde validation)              | `400 invalid_request_error`                                | Match types in the API Reference; read `error.message`.                   |
| Request size   | Request body exceeds 10 MiB (10,485,760 bytes)   | `413 invalid_request_error`, with the limit in the message | Shorten the prompt.                                                       |
| Authentication | API key is missing or invalid                    | `403 invalid_api_key_error`                                | Check the `api-subscription-key` header.                                  |
| Model          | Model ID is unknown or unavailable               | `404 not_found_error`                                      | Confirm the ID with [`GET /v2/models`](/api-reference/chat/models-v2).    |
| Quota          | No credits remain                                | `402 insufficient_quota_error`                             | Add credits in the [dashboard](https://indus.sarvam.ai/billing?ref=docs). |
| Rate limit     | Request or concurrency limit is exceeded         | `429 rate_limit_exceeded_error`                            | Back off and retry.                                                       |
| Availability   | Model remains overloaded after retries           | `503 model_overloaded`                                     | Retry later.                                                              |