# GLM-5.3 API Reference

GLM-5.3 accepts text and returns text or tool calls. It always reasons, supports `low`, `high` and `max&#x60; effort, and allows up to 131,072 output tokens. Use &#x2A;*`glm-5.3`** for the Default tier. Its default group is `glm`; `glm-5.3:glm` remains an explicit selection of that same group. Additional groups use their own model suffix.

Base URL: `https://api.seedrouter.ai`. Authenticate with `Authorization: Bearer $SEEDROUTER_API_KEY`. Keep credentials on your server. Messages also accepts the compatible `x-api-key` header.

This reference follows the [Z.ai Chat contract](https://docs.z.ai/api-reference/llm/chat-completion), the manufacturer's [Responses schema](https://docs.bigmodel.cn/openapi/openapi-responses.json), and its [Messages compatibility guide](https://docs.bigmodel.cn/cn/guide/develop/claude/introduction). Model-specific limits come from the [GLM-5.3 guide](https://docs.z.ai/guides/llm/glm-5.3). &#x2A;*Documentation alignment does not establish every live behavior.** Checks on October 29, 2026 completed text and streaming requests in all three formats, Chat function calling, JSON object output, and saved-response continuation. Cache hits, explicit cache lifetimes and every compatibility control were not established. Messages reference fields below are distinguished from manufacturer-documented GLM fields.

[OpenAPI specification](https://seedrouter.ai/docs/glm-5-3.openapi.json) · [Markdown reference](https://seedrouter.ai/docs/glm-5-3.md) · [Model and Playground](https://seedrouter.ai/models/glm-5-3) · [Pricing guide](https://seedrouter.ai/blog/glm-5-3-pricing)

## Quickstart

Each example sends one Chat Completions request. `max_tokens: 2048` is an example budget, not the default. Reasoning and the visible answer share that budget; inspect `finish_reason` before treating the answer as complete.

```bash
curl https://api.seedrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"glm-5.3","messages":[{"role":"user","content":"Explain an idempotency key with one concrete example."}],"reasoning_effort":"low","max_tokens":2048}'
```

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["SEEDROUTER_API_KEY"], base_url="https://api.seedrouter.ai/v1")
response = client.chat.completions.create(
    model="glm-5.3",
    messages=[{"role": "user", "content": "Explain an idempotency key with one concrete example."}],
    max_tokens=2048,
    extra_body={"reasoning_effort": "low"},
)
print(response.choices[0].message.content)
print(response.usage)
```

```javascript
import OpenAI from 'openai';
const client = new OpenAI({apiKey: process.env.SEEDROUTER_API_KEY, baseURL: 'https://api.seedrouter.ai/v1'});
const response = await client.chat.completions.create({
  model: 'glm-5.3',
  messages: [{role: 'user', content: 'Explain an idempotency key with one concrete example.'}],
  reasoning_effort: 'low',
  max_tokens: 2048,
});
console.log(response.choices[0].message.content);
console.log(response.usage);
```

```go
package main

import (
    "bytes"
    "fmt"
    "io"
    "net/http"
    "os"
    "time"
)

func main() {
    body := []byte(`{"model":"glm-5.3","messages":[{"role":"user","content":"Explain an idempotency key with one concrete example."}],"reasoning_effort":"low","max_tokens":2048}`)
    req, err := http.NewRequest("POST", "https://api.seedrouter.ai/v1/chat/completions", bytes.NewReader(body))
    if err != nil { panic(err) }
    req.Header.Set("Authorization", "Bearer " + os.Getenv("SEEDROUTER_API_KEY"))
    req.Header.Set("Content-Type", "application/json")
    client := &http.Client{Timeout: 3 * time.Minute}
    res, err := client.Do(req)
    if err != nil { panic(err) }
    defer res.Body.Close()
    data, err := io.ReadAll(res.Body)
    if err != nil { panic(err) }
    if res.StatusCode != http.StatusOK { panic(fmt.Sprintf("HTTP %d: %s", res.StatusCode, data)) }
    fmt.Println(string(data))
}
```

## Chat Completions

`POST /v1/chat/completions` accepts 16 top-level fields. Fields are not nullable unless explicitly stated. Optional fields can be omitted; do not send `null` in place of omission.

| Field              | Type         | Required | Default and constraints                                                                                              |
| ------------------ | ------------ | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `model`            | string       | Yes      | `glm-5.3` (Default)                                                                                                  |
| `messages`         | array        | Yes      | At least one message; must contain a user or tool message                                                            |
| `do_sample`        | boolean      | No       | `true`; false makes temperature and top\_p ineffective                                                               |
| `stream`           | boolean      | No       | `false`                                                                                                              |
| `thinking`         | object       | No       | `type: enabled`; `clear_thinking: true`                                                                              |
| `reasoning_effort` | string       | No       | `low`, `high`, `max`; default `max`                                                                                  |
| `temperature`      | number       | No       | 0–1 inclusive; default 1                                                                                             |
| `top_p`            | number       | No       | 0.01–1 inclusive; default 0.95                                                                                       |
| `max_tokens`       | integer      | No       | 1–131072; no published Chat default                                                                                  |
| `tool_stream`      | boolean      | No       | `false`; true requires `stream: true`                                                                                |
| `tools`            | array        | No       | Function, retrieval or web\_search; up to 128 entries                                                                |
| `tool_choice`      | string       | No       | `auto` only                                                                                                          |
| `stop`             | string array | No       | Up to four strings in the official schema; four were accepted in a live request, but stop matching was not exercised |
| `response_format`  | object       | No       | Required `type`: `text` or `json_object`; default text                                                               |
| `request_id`       | string       | No       | 6–64 characters; unique caller request identifier                                                                    |
| `user_id`          | string       | No       | 6–128 characters; avoid personal information                                                                         |

`system` and `user` messages require string `content`. An `assistant` message can carry string `content`, `reasoning_content` and `tool_calls`. A `tool` message requires `content` and `tool_call_id`. Preserve exact historical reasoning when using `thinking.clear_thinking: false`, including the order of assistant calls and tool results. Thinking cannot be disabled.

A function tool uses `{type:"function", function:{name, description, parameters}}`. The name contains 1–64 ASCII letters, digits, underscores or hyphens. The machine schema requires description and parameters; prose mentions omission for parameterless functions. Use the full shape until this conflict is resolved. `parameters` is your function's JSON Schema; it is not interpreted as message content.

A retrieval tool uses `{type:"retrieval", retrieval:{knowledge_id, prompt_template?}}`. A knowledge ID belongs to the account serving the request; declaring this tool does not create a knowledge base.

A web search tool uses `{type:"web_search", web_search:{search_engine:"search_pro_jina"}}`. Optional fields include `enable`, `search_query`, `count` (1–50), `search_domain_filter`, `search_recency_filter` (`oneDay`, `oneWeek`, `oneMonth`, `oneYear`, `noLimit`), `content_size` (`medium`, `high`), `result_sequence` (`before`, `after`), `search_result`, `require_search` and `search_prompt`. See OpenAPI for exact types. Account-specific search and retrieval availability need live verification.

JSON object mode produces JSON, not enforcement of a supplied JSON Schema. Include the desired fields in the prompt and validate the result in your application.

## Responses

`POST /v1/responses` accepts 15 top-level create fields. This follows the manufacturer's Responses schema, specialized to GLM-5.3; exact behavior across services remains subject to verification.

```bash
curl https://api.seedrouter.ai/v1/responses \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"glm-5.3","input":[{"type":"message","role":"user","content":"Give a concise example of a safe retry."}],"reasoning":{"effort":"low"},"max_output_tokens":2048,"store":false}'
```

| Field                  | Type            | Required | Default and constraints                          |
| ---------------------- | --------------- | -------- | ------------------------------------------------ |
| `model`                | string          | Yes      | `glm-5.3`                                        |
| `input`                | string or array | Yes      | Native input items listed below                  |
| `instructions`         | string          | No       | System instructions                              |
| `stream`               | boolean         | No       | `false`                                          |
| `temperature`          | number          | No       | 0–1, at most two decimal places; default 1       |
| `top_p`                | number          | No       | 0.01–1, at most two decimal places; default 0.95 |
| `max_output_tokens`    | integer         | No       | 1–131072; default 65536, including reasoning     |
| `stop`                 | string array    | No       | No count limit declared in this protocol         |
| `tools`                | array           | No       | Function, namespace, custom or web\_search       |
| `tool_choice`          | string          | No       | `none` or `auto`                                 |
| `reasoning`            | object          | No       | `effort`: low, high, max; default max            |
| `text`                 | object          | No       | `format.type`: text or json\_object              |
| `prompt_cache_key`     | string          | No       | Cache routing key; no documented length limit    |
| `previous_response_id` | string          | No       | References a previously saved response           |
| `store`                | boolean         | No       | `false`; whether to save this response           |

Message input items require `type: "message"`, a role (`user`, `system`, `assistant`, `developer`) and content. Content can be a string, one text block or an array of text blocks. Use `input_text` or assistant `output_text` with a string `text`. Generic image/file schemas do not grant vision capability to this text-only model.

Function-call input items require `type: "function_call"`, `name`, `call_id` and a JSON-string `arguments`; `namespace` is optional. Results require `type: "function_call_output"`, `call_id` and string `output`. Reasoning items use `type: "reasoning"` and a **single** `content: {type:"reasoning_text", text:"..."}` object. Preserve it without converting to an array.

Function tools require `type: "function"` and `name`, with optional description and parameters. Namespace tools require `type: "namespace"` and `name`, and can contain function `tools`. Custom tools require `type: "custom"` and `name`. Web search tools require `type: "web_search"`. Do not copy Chat's function-required fields into this format.

The referenced previous response must have been stored. Saving the current response is a separate choice; `previous_response_id` does not force current `store: true`. The manufacturer's retention period is seven days. A live check successfully saved a response and continued from its ID with current `store: false`; this does not establish every saved-response operation.

### Saved response operations

When `store: true` succeeds, keep the returned response ID unchanged. These authenticated operations use the same account that created it:

* `GET /v1/responses/{response_id}` retrieves the saved response.
* `GET /v1/responses/{response_id}/input_items` lists input items. Optional query fields: `order` (`asc` or `desc`, default `desc`), `limit` (integer 1–100, default 20) and `after` (the prior page's last\_id).
* `DELETE /v1/responses/{response_id}` deletes the saved response.

A subsequent create request can use the saved ID as `previous_response_id`. Access requires the original user's current model access. Retention is at most seven days; expired or deleted responses cannot be continued. Retrieval, deletion and continuation keep the original account binding. No cancel endpoint is documented. These operations are covered by local contract tests. The October 29 live check confirmed save and continuation; retrieval and input-item listing returned 404, and deletion was not tested. Do not rely on retrieval, listing or deletion until their availability is confirmed.

## Messages compatibility

`POST /v1/messages` uses an Anthropic-compatible envelope. Include `anthropic-version: 2023-06-01`. The manufacturer directly demonstrates `model`, `messages`, `max_tokens` and `stream`. It does not publish a complete GLM Messages schema and warns about differences from Claude. The remaining controls are compatibility-reference fields, **not individually verified GLM capabilities**.

```bash
curl https://api.seedrouter.ai/v1/messages \
  -H "Authorization: Bearer $SEEDROUTER_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  -d '{"model":"glm-5.3","messages":[{"role":"user","content":"Explain a safe retry in two sentences."}],"max_tokens":2048}'
```

| Field            | Shape and validation                                                      | Evidence                                                      |
| ---------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `model`          | Required string `glm-5.3`                                                 | GLM example                                                   |
| `messages`       | Required nonempty user/assistant array; string or native text/tool blocks | GLM text example; block shapes use compatibility reference    |
| `max_tokens`     | Required integer 1–131072                                                 | GLM example and model output limit                            |
| `stream`         | Boolean; default false                                                    | GLM example                                                   |
| `system`         | String or text-block array                                                | Compatibility reference                                       |
| `temperature`    | Number 0–1                                                                | Compatibility reference; mapping unverified                   |
| `top_p`          | Number 0.01–1                                                             | Compatibility reference; mapping unverified                   |
| `top_k`          | Nonnegative integer                                                       | Compatibility reference; mapping unverified                   |
| `stop_sequences` | String array                                                              | Compatibility reference                                       |
| `tools`          | Client tools: name, input\_schema, optional description                   | Compatibility reference                                       |
| `tool_choice`    | Object type auto, none, any or tool; named tool requires name             | Compatibility reference                                       |
| `thinking`       | enabled with budget\_tokens, or adaptive; cannot disable thinking         | Compatibility reference plus GLM always-on rule               |
| `output_config`  | Object with effort low, high or max                                       | Compatible field spelling; mapping unverified                 |
| `metadata`       | Object with optional user\_id                                             | Compatibility reference                                       |
| `cache_control`  | Ephemeral marker, optional ttl 5m or 1h                                   | Protocol reference only; GLM explicit TTL behavior unverified |

Enabled thinking's compatible budget is at least 1024 and less than max\_tokens. Text blocks require text; thinking history requires thinking and signature; redacted thinking requires data. Tool-use blocks require id, name and input; tool-result blocks require tool\_use\_id. No image, audio or video block is accepted. Explicit cache markers do not establish a cache hit, a lifetime or a separate rate. The model's documented context cache is automatic.

## Output, streaming and usage

Chat returns `id`, `created`, `model`, `choices` and `usage`, with optional request\_id and web\_search. Read `choices[].message.content`, `reasoning_content` and `tool_calls`. A tool-call response may have no answer text. SSE sends reasoning, text and tool argument deltas, then `[DONE]`. Join argument fragments by call index. No `stream_options` field is part of the official GLM Chat request.

Responses returns the native `output` union: messages, reasoning and tool calls. SSE includes `response.created`, `response.in_progress`, output-item and content-part events, text/reasoning/function-argument deltas, search progress, and terminal `response.completed`, `response.incomplete` or `response.failed`. It does not require a `[DONE]` marker. Preserve indices and sequence numbers.

Messages returns a native message envelope with content blocks, stop\_reason and usage. Its event names include message\_start, content\_block\_start/delta/stop, message\_delta and message\_stop. Preserve thinking signatures and tool IDs as opaque history.

| Format    | Total input                                                                          | Cached input                           | Output             |
| --------- | ------------------------------------------------------------------------------------ | -------------------------------------- | ------------------ |
| Chat      | prompt\_tokens                                                                       | prompt\_tokens\_details.cached\_tokens | completion\_tokens |
| Responses | input\_tokens                                                                        | input\_tokens\_details.cached\_tokens  | output\_tokens     |
| Messages  | input\_tokens plus cache\_read\_input\_tokens and any cache\_creation\_input\_tokens | cache\_read\_input\_tokens             | output\_tokens     |

Reasoning is a subset of output, not an additional charge. Chat/Responses cached input is a subset of total input. Subtract separately reported cached portions before applying the ordinary input rate. Public responses expose token usage, not monetary charges. [Current prices](https://seedrouter.ai/models/glm-5-3#pricing) come from live billing settings; failed requests are not charged.

## Validation and errors

Invalid types, disabled thinking, unsupported effort, excessive output budgets and media input fail validation. Chat's tool\_stream requires stream. Unsupported top-level fields are omitted rather than forwarded. Credentials are required; insufficient balance prevents a paid request. Errors use the public error envelope (Messages uses its native error shape). Never treat an interrupted stream as a completed answer or automatically resubmit a request with an uncertain result.

The Playground exposes the same admitted fields for the selected format. Blank optional values are omitted; explicit false and zero are preserved. Changing formats starts a new conversation. Its usage estimate needs both reported usage and current rates.
