> 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 full documentation content in one file, see https://docs.sarvam.ai/llms-full.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**.

GLM-5.3 is available in **beta**. Access is granted per API key —
[contact us](/api/getting-started/help) to request access.

## 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 (parallel tool calls only — see API reference)                                                                             |
| **APIs**           | [`POST /v2/chat/completions`](/api-reference/chat/chat-completions-v2) and [`POST /v2/responses`](/api-reference/responses/create)   |
| **Pricing**        | ₹126 input · ₹23.4 cached input · ₹396 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.

## 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=2000,
)

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: 2000,
    });

    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": 2000
  }'
```

## API reference

Call [`POST /v2/chat/completions`](/api-reference/chat/chat-completions-v2) or
[`POST /v2/responses`](/api-reference/responses/create) with `model: "glm5.3"`. Request
fields (`n`, `logprobs`, `parallel_tool_calls`, `stream`, and the rest) are defined in
those API references — not duplicated on this model page.

## 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 `summary[0].text` in `output` on Responses (its `content` field is
`null` there). 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).

## 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.
* **Parallel tool calls.** GLM-5.3 only respects `parallel_tool_calls: true` (or omitting
  the field). Passing `false` is accepted without error, but the model can still return
  more than one tool call in a turn.
* **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                  | `503 model_overloaded` (may retry) | 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`.                |
| Payload        | Body larger than 10 MB                           | `413`                              | Shrink text or inline images.                                          |
| Authentication | API key is missing or invalid                    | `403 invalid_api_key_error`        | Check the `api-subscription-key` header.                               |
| Access         | API key does not have beta access                | `400 invalid_request_error`        | [Request beta access](/api-reference/beta-apis).                       |
| 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://dashboard.sarvam.ai).           |
| 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.                                                           |