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

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

GLM-5.3 Flash is a faster sibling of [GLM-5.3](/api/token-factory/models/glm-5-3),
served on Sarvam infrastructure as an [open-weight model](/api/token-factory/models).
It accepts **text and images** and has a **1,048,576-token context window**.

## At a glance

|                    |                                                                                                                                                      |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Model ID**       | `glm5.3-flash`                                                                                                                                       |
| **Best for**       | Fast reasoning, agents, and image understanding                                                                                                      |
| **Context window** | 1,048,576 tokens                                                                                                                                     |
| **Input → output** | Text + image → text                                                                                                                                  |
| **Reasoning**      | **`low`**, **`high`** (default when omitted), or **`max`**. 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**        | ₹13.5 / ₹2.5 cached / ₹45 per 1M tokens (input / cached input / output); reasoning is billed as output — see [Pricing](/api/getting-started/pricing) |

## Key capabilities

#### Long context

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

#### Image input

Send base64-encoded images alongside text.

#### Reasoning

Receive reasoning in `reasoning_content` separately from the final answer in `content`.

#### Tool calling

Use OpenAI-compatible `tools` and `tool_choice` for agentic workflows.

#### Structured output

Constrain answers with `response_format` JSON schemas.

#### Log probabilities

Request `logprobs` and `top_logprobs`, and `n` > 1 choices.

> **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-flash",
    messages=[
        {
            "role": "user",
            "content": "Write a Python function that checks whether a string is a palindrome.",
        }
    ],
    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-flash",
        messages: [
            {
                role: "user",
                content: "Write a Python function that checks whether a string is a palindrome.",
            },
        ],
        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-flash",
    "messages": [
      {
        "role": "user",
        "content": "Write a Python function that checks whether a string is a palindrome."
      }
    ],
    "max_tokens": 2000
  }'
```

## Supported parameters

`model: "glm5.3-flash"` 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`)        |                                                    |  send `top_logprobs` with `include: ["message.output_text.logprobs"]`; `logprobs: true` returns `400` |
| Multiple choices (`n` > 1)                            |                                                    |                                       N/A — Responses has no `n`                                      |
| Reasoning control                                     | `reasoning_effort`: `low`, `high` (default), `max` |                  `reasoning.effort`: `low` or `high` (default); `"max"` returns `400`                 |
| Turn reasoning off                                    |                    always thinks                   |                                              always thinks                                            |

> **Warning**
>
> On `POST /v2/responses`, `logprobs` is only populated when the request includes
> `"include": ["message.output_text.logprobs"]`. Without it, `output[].content[].logprobs`
> is always an empty array even if `top_logprobs` is set. Verified against the live API on
> 2026-10-22.

## Reasoning

GLM-5.3 Flash reasons by default, at `high` effort. The two APIs accept different values:

| Route                                                         | Field              | Accepted values                                                                                                                                              |
| ------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Chat Completion V2](/api-reference/chat/chat-completions-v2) | `reasoning_effort` | `"low"`, `"high"`, or `"max"`; omitting the field gives `high`                                                                                               |
| [Responses](/api-reference/responses/create)                  | `reasoning.effort` | `"low"` or `"high"` only; omitting the field gives `high`. The literal string `"max"` returns `400`, so `max` effort is available on Chat Completion V2 only |

Read the reasoning trace from `choices[].message.reasoning_content` on chat. On Responses,
`output` starts with a `reasoning` item; read its `content[0].text` (`summary` is empty,
unlike GLM-5.3). Reasoning tokens are billed as output tokens and count against
`max_tokens` / `max_output_tokens`.

## Image input

Send images as **base64 data URIs** in an `image_url` content part on chat, or an
`input_image` part on Responses.

```python
import base64

with open("chart.png", "rb") as f:
    data_uri = "data:image/png;base64," + base64.b64encode(f.read()).decode()

response = client.chat.completions_v2(
    model="glm5.3-flash",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Summarise this chart."},
                {"type": "image_url", "image_url": {"url": data_uri}},
            ],
        }
    ],
    max_tokens=2000,
)
```

## How it differs from GLM-5.3

|                              | `glm5.3`              | `glm5.3-flash` |
| ---------------------------- | --------------------- | -------------- |
| Image input                  | Not supported         | Supported      |
| Log probabilities            | Not supported (`400`) | Supported      |
| Multiple choices (`n` > 1)   | Not supported (`400`) | Supported      |
| `parallel_tool_calls: false` | Not enforced          | Enforced       |

## Known limitations

* Reasoning and the final answer share the **`max_tokens`** / **`max_output_tokens`** budget.
* Set **`max_tokens`** explicitly. When it's omitted, generation isn't capped at a small
  default and long answers can run to tens of thousands of tokens.

## Limits and errors

| Area           | Limit or condition                              | API response                                               | Recommended action                                                        |
| -------------- | ----------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------- |
| Output         | `max_tokens` exceeds 1,048,576                  | `400 invalid_request_error`                                | Set `max_tokens` within the context window.                               |
| Request size   | Request body exceeds 10 MiB (10,485,760 bytes)  | `413 invalid_request_error`, with the limit in the message | Reduce the request body; base64 images count toward the limit.            |
| Reasoning      | Reasoning consumes the full `max_tokens` budget | `200` with `finish_reason: "length"`                       | Raise `max_tokens` or lower the reasoning effort.                         |
| 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`                                      | Check the spelling; model IDs are case-sensitive.                         |
| 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.                                                              |