> 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 an open-source model served on Sarvam infrastructure. 1,048,576 token context window with tool calling and visible reasoning.

GLM-5.3 is an [open-source model](/api/getting-started/models/open-source) served by
Sarvam in **beta**, and is **not tuned for Indian languages**. Beta access is granted per
API key — [contact us](/api/getting-started/help) to request whitelisting. For Indian
language workloads use [Sarvam-105B](/api/getting-started/models/sarvam-105b) instead.

A general-purpose open-source model. Its distinguishing feature on Sarvam is a very large
**1,048,576 token context window** — eight times the 128K offered by Sarvam's own chat models —
which makes it a reasonable choice for reasoning over long documents or large codebases in
a single request.

## At a Glance

|                  |                                                                                                                                                                                                                                                         |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Model ID**     | `glm5.3`                                                                                                                                                                                                                                                |
| **What it does** | General-purpose chat LLM; very long context and tool calling                                                                                                                                                                                            |
| **Languages**    | Not tuned for Indian languages by Sarvam                                                                                                                                                                                                                |
| **APIs**         | [`POST /v2/chat/completions`](/api-reference/open-source/chat-completions) and [`POST /v2/responses`](/api-reference/open-source/responses) — also see [using an open-source model](/api/getting-started/models/open-source#using-an-open-source-model) |
| **Input limits** | 1,048,576-token context window; 10 MB request cap — [all limits](#limits-and-errors)                                                                                                                                                                    |
| **Benchmarks**   | None published by Sarvam                                                                                                                                                                                                                                |
| **Pricing**      | ₹126 input · ₹23.4 cached input · ₹396 output — per 1M tokens; reasoning billed as output ([Pricing](/api/getting-started/pricing))                                                                                                                     |
| **Best for**     | Long-document and large-codebase analysis in a single request                                                                                                                                                                                           |
| **Not for**      | Indian language workloads — use [Sarvam-105B](/api/getting-started/models/sarvam-105b)                                                                                                                                                                  |

## Why you might use it

#### Very long context

A 1,048,576 token context window lets you pass entire books, long transcripts, or large
code repositories in one request without chunking or retrieval.

#### Tool calling

Supports the OpenAI-compatible `tools` and `tool_choice` parameters, so it works with
agentic loops and function-calling frameworks.

## Model Specifications

#### Key Considerations

* Model ID: `glm5.3`
* Context window: 1,048,576 tokens (1M)
* Tool calling: supported
* Image input: **not supported** — text only
* Reasoning: **always on** — chat: `reasoning_content` (counts against `max_tokens`); Responses: a reasoning item with `summary[]` by default. `extra_body` thinking switch is accepted but does not currently disable it
* Maximum request size: 10 MB
* Temperature range: 0 to 2 (unset uses the model's own default)
* Top-p range: greater than 0, up to 1 (`0` currently returns `503`)
* Supports streaming and non-streaming on both routes
* OpenAI-compatible chat completions and Responses protocols

## GLM-5.3 vs Sarvam's chat model

| Feature                    | GLM-5.3                 | Sarvam-105B                                   |
| -------------------------- | ----------------------- | --------------------------------------------- |
| **Context window**         | 1,048,576               | 128,000                                       |
| **Tool calling**           | ✅                       | ✅                                             |
| **Image input**            | ❌                       | ❌                                             |
| **Indian language tuning** | None                    | 23 languages                                  |
| **Best for**               | Very long-context tasks | Maximum quality reasoning & agentic workflows |

Pick GLM-5.3 **only** when your task genuinely needs more than 128K of context. For
everything else — and especially for anything touching Indian languages — a Sarvam model
will serve you better and comes with Sarvam's own evaluation behind it.

## Key Capabilities

#### Basic Chat Completion

A single-turn request. Only the `model` field differs from a Sarvam chat completion call.

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

response = client.open_source_models.chat_completions_v2(
    model="glm5.3",
    messages=[
        {"role": "user", "content": "Explain the difference between a B-tree and a B+ tree index."}
    ],
    temperature=0.2,
    top_p=1,
    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.openSourceModels.chatCompletionsV2({
        model: "glm5.3",
        messages: [
            {
                role: "user",
                content: "Explain the difference between a B-tree and a B+ tree index.",
            },
        ],
        temperature: 0.2,
        top_p: 1,
        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 '{
    "messages": [
      {"role": "user", "content": "Explain the difference between a B-tree and a B+ tree index."}
    ],
    "model": "glm5.3",
    "temperature": 0.2,
    "top_p": 1,
    "max_tokens": 2000
  }'
```

The answer is in `message.content`. The model's chain-of-thought arrives separately
in `message.reasoning_content` — see [Reasoning](#reasoning) below for how to budget
for it or turn it off.

#### Long-Context Analysis

GLM-5.3's main advantage. Pass a large document directly in the prompt instead of
chunking it — up to 1,048,576 tokens of context, minus whatever you reserve for
`max_tokens`.

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

with open("annual_report.txt", encoding="utf-8") as f:
    document = f.read()

response = client.open_source_models.chat_completions_v2(
    model="glm5.3",
    messages=[
        {"role": "system", "content": "You are a financial analyst. Answer only from the document provided."},
        {"role": "user", "content": f"{document}\n\nList every material risk disclosed, with the page or section it appears in."},
    ],
    temperature=0.1,
    max_tokens=4000,
)

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

#### cURL

```bash
# Build the payload with a file so large documents do not hit shell argument limits.
python3 - <<'PY' > payload.json
import json
document = open("annual_report.txt", encoding="utf-8").read()
json.dump({
    "model": "glm5.3",
    "messages": [
        {"role": "system", "content": "You are a financial analyst. Answer only from the document provided."},
        {"role": "user", "content": document + "\n\nList every material risk disclosed."},
    ],
    "temperature": 0.1,
    "max_tokens": 4000,
}, open("payload.json", "w"))
PY

curl -X POST https://api.sarvam.ai/v2/chat/completions \
  -H "api-subscription-key: $SARVAM_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @payload.json
```

Requests are capped at **10 MB** regardless of the context window. A document that
fits in 1,048,576 tokens can still exceed the byte cap and return `413 Payload Too Large`.

#### Tool Calling

GLM-5.3 supports OpenAI-compatible function calling.

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

response = client.open_source_models.chat_completions_v2(
    model="glm5.3",
    messages=[
        {"role": "user", "content": "What is the weather in Bengaluru right now?"}
    ],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get the current weather for a city.",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "city": {"type": "string", "description": "City name"}
                    },
                    "required": ["city"],
                },
            },
        }
    ],
    tool_choice="auto",
    max_tokens=1000,
)

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

#### 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": "What is the weather in Bengaluru right now?"}
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get the current weather for a city.",
          "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"]
          }
        }
      }
    ],
    "tool_choice": "auto",
    "max_tokens": 1000
  }'
```

#### Streaming

Set `stream` to `true` to receive tokens as server-sent events. Because GLM-5.3
reasons before answering, the stream delivers `delta.reasoning_content` chunks
first and `delta.content` chunks after — read both, or the wait before the first
`content` chunk looks like a stall.

#### Python

```python
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

stream = client.open_source_models.chat_completions_v2(
    model="glm5.3",
    messages=[
        {"role": "user", "content": "Write a short note on database normalisation."}
    ],
    max_tokens=1000,
    stream=True,
)

for chunk in stream:
    delta = chunk.choices[0].delta
    reasoning = getattr(delta, "reasoning_content", None)
    if reasoning:
        pass  # the chain-of-thought — show it, log it, or skip it
    if delta.content:
        print(delta.content, end="", flush=True)
```

#### cURL

```bash
curl -N -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": "Write a short note on database normalisation."}
    ],
    "max_tokens": 1000,
    "stream": true
  }'
```

With `stream: true`, pass top-level `stream_options: {"include_usage": true}` to
receive a later chunk with `usage`, including
`completion_tokens_details.reasoning_tokens`. Putting `stream_options` inside
`extra_body` is `400`. Chat still ends with `[DONE]`.

## Reasoning

GLM-5.3 thinks before every answer — **by default**, not only when `reasoning_effort`
is set.

**Chat.** The chain-of-thought arrives in `message.reasoning_content`
(`delta.reasoning_content` when streaming); `content` carries only the final answer.
Reasoning tokens are billed, count against `max_tokens`, and are reported on
`usage.completion_tokens_details.reasoning_tokens`. A small budget can be consumed
entirely by reasoning, returning `content: null` with `finish_reason: "length"`.

**Responses.** A reasoning item is returned by default, with text in `summary[]`.
`reasoning.summary` is optional (`auto` / `detailed`). `reasoning.effort` accepts
`none`, `minimal`, `low`, `medium`, `high`, `xhigh` — **`max` is `400`** on this
route. Usage is on `output_tokens_details.reasoning_tokens`. Hitting
`max_output_tokens` reports `status: "incomplete"` with
`incomplete_details.reason: max_output_tokens`.

`extra_body.chat_template_kwargs.enable_thinking: false` is accepted on chat but
**does not currently disable GLM-5.3 thinking**. Use `reasoning_effort: "low"` to
keep the trace short, or raise `max_tokens` / `max_output_tokens`. Structured JSON
is reliable on [`POST /v2/responses`](/api-reference/open-source/responses) with
`text.format` `json_object` or strict `json_schema` — that path skips the reasoning
item.

## Parameters

Chat accepts the OpenAI-compatible set plus GLM sampling fields that the
[full parameter table](/api/getting-started/models/open-source#supported-parameters)
lists: `temperature`, `top_p`, `top_k` (`null` / `-1` / `≥ 1`; `0` is `400`),
`min_p` (`0`–`1`), `repetition_penalty` (`> 0` and `≤ 2`), `max_tokens`, `stream`,
`stream_options`, `stop`, `n`, `seed`, `frequency_penalty`, `presence_penalty`,
`reasoning_effort` (`none` / `minimal` / `low` / `medium` / `high` / `xhigh` /
`max`), `response_format`, `tools`, `tool_choice`, `parallel_tool_calls`, and
`extra_body`. Message roles include `developer` as well as `system` / `user` /
`assistant` / `tool`.

Responses (`POST /v2/responses`) is create-only and stateless: replay `input`
every turn. Omit `store` or pass `false` (OpenAI SDKs default `true` — that call
is `400`). Named extras: `instructions` (echoed), `top_p`, `text.format`
(`text` / `json_object` / `json_schema`; `format` required whenever you send
`text`), `reasoning.effort` / `reasoning.summary`, `parallel_tool_calls`.
`presence_penalty` and `frequency_penalty` are echoed as `0` on this route and
should not be treated as honoured.

Model-specific exceptions:

* **`image_url` content parts are rejected** (`400`) — GLM-5.3 is text only.
* **`seed` is not currently reproducible** on this model — identical seeds return
  different completions. Use `temperature: 0` where you need stability.
* **An assistant message as the last chat turn is a prior turn**, not token-level
  prefill — the model restarts rather than continuing the supplied suffix.

## Limits and errors

Common errors for every model on `/v2/chat/completions` are documented on the
[Open-Source Models overview](/api/getting-started/models/open-source#errors). GLM-5.3-specific cases:

| Condition                                                                  | Status | Code                         | What it means                                                                                                               |
| -------------------------------------------------------------------------- | ------ | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| API key lacks beta access                                                  | `400`  | `invalid_request_error`      | Request whitelisting — see [Beta APIs](/api-reference/beta-apis).                                                           |
| Missing or invalid API key                                                 | `403`  | `invalid_api_key_error`      | Check the `api-subscription-key` header.                                                                                    |
| No credits remaining                                                       | `402`  | `insufficient_quota_error`   | Top up on the [dashboard](https://dashboard.sarvam.ai).                                                                     |
| Unknown or unavailable model id                                            | `404`  | `not_found_error`            | Confirm the id with [`GET /v2/models`](/api-reference/open-source/models).                                                  |
| Message contains an image part                                             | `400`  | `invalid_request_error`      | GLM-5.3 is text only. Use [`gemma4`](/api/getting-started/models/open-source/gemma-4-31b) for image input.                  |
| `max_tokens` above 1,048,576                                               | `400`  | `invalid_request_error`      | `max_tokens` cannot exceed the context window.                                                                              |
| Estimated prompt tokens + `max_tokens` above 1,048,576                     | `422`  | `unprocessable_entity_error` | Shorten the prompt or lower `max_tokens`.                                                                                   |
| Request body above the model's size cap                                    | `413`  | `invalid_request_error`      | The byte cap is independent of the token window.                                                                            |
| `tool_choice` naming a function with no `tools`                            | `422`  | `unprocessable_entity_error` | Provide the `tools` array alongside `tool_choice`.                                                                          |
| Invalid tool schema (`$ref`, recursion, size)                              | `400`  | `invalid_request_error`      | See [Tool schemas](/api/getting-started/models/open-source#tool-schemas).                                                   |
| Rate limit exceeded                                                        | `429`  | `rate_limit_exceeded_error`  | Back off and retry; see [Rate Limits](/api/getting-started/ratelimits).                                                     |
| Model overloaded after retries                                             | `503`  | `model_overloaded`           | Retry later.                                                                                                                |
| `content: null` with `finish_reason: "length"`                             | `200`  | —                            | Reasoning consumed the whole `max_tokens` budget — raise it, or set `reasoning_effort: "low"`. See [Reasoning](#reasoning). |
| `content: null` with `finish_reason: "stop"` and `response_format` set     | `200`  | —                            | Reasoning ate the JSON budget — raise `max_tokens`, or use Responses `text.format`. See [Reasoning](#reasoning).            |
| Chat `top_k: 0` / `min_p` out of `0–1` / `repetition_penalty` `0` or `> 2` | `400`  | `invalid_request_error`      | See [supported parameters](/api/getting-started/models/open-source#supported-parameters).                                   |
| Responses `reasoning.effort: "max"`                                        | `400`  | `invalid_request_error`      | Use `none` / `minimal` / `low` / `medium` / `high` / `xhigh`.                                                               |
| `top_p: 0`                                                                 | `503`  | `model_overloaded`           | Must be greater than 0. Current serving fails this as 503, not 400.                                                         |

## Support

Sarvam supports the serving layer — auth, billing, rate limits, availability. Sarvam does
not tune or evaluate this model, so its output quality, reasoning, and language coverage
are properties of the model itself. See
[Open-Source Models](/api/getting-started/models/open-source) for the full support
boundary, and [Talk to us](/api/getting-started/help) for serving issues.