Zhipu's flagship GLM-5.3 supports 1M context, coding and agent tasks, and control over reasoning length.
glm-5.3GLM-5.3 via the standard OpenAI-compatible endpoint. 1M context / 128K max output. Reasoning is ALWAYS ON and returned in reasoning_content; depth is tunable via reasoning_effort.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | 要调用的模型名, 填模型广场里的名称。 |
messages | array | Yes | 对话消息列表, 每项含 role 与 content。role 可为 system / user / assistant / tool。 |
stream | boolean | No | 是否流式返回。true 时以 SSE 逐块推送, 适合需要边生成边展示的场景。 |
temperature | number | No | 采样温度, 越大输出越发散、越小越稳定。 |
max_tokens | integer | No | 本次回复最多生成多少 token。不传则由模型自行决定, 不会被截断。 |
top_p | number | No | 核采样, 只在累计概率前 top_p 的候选里挑。与 temperature 选一个调即可。 |
tools | array | No | 可供模型调用的工具列表。模型需要时会返回 tool_calls, 由你执行后把结果以 role=tool 回填。 |
tool_choice | string | No | 控制是否/如何选用工具: auto 由模型决定, none 禁用, 也可指定某个具体工具。需与 tools 一起使用。 |
response_format | object | No | 指定输出格式, 如要求返回 JSON。 |
stop | array | No | 遇到其中任一字符串就停止生成, 该字符串不包含在结果里。 |
n | integer | No | 一次返回几条候选回复。按全部候选的总用量计费。 |
seed | integer | No | 固定随机种子, 相同输入尽量复现相同输出。 |
frequency_penalty | number | No | 按 token 已出现频次降低其再次出现的概率, 用于抑制重复。 |
presence_penalty | number | No | 按 token 是否已出现降低其再次出现的概率, 用于鼓励换话题。 |
logit_bias | object | No | 按 token id 调整选中概率, 可用来强推或压制特定词。 |
parallel_tool_calls | boolean | No | 是否允许模型一次返回多个工具调用。需与 tools 一起使用。 |
logprobs | boolean | No | 是否返回所选 token 的对数概率。 |
top_logprobs | integer | No | 每个位置额外返回多少个候选 token 的概率。需同时开启 logprobs。 |
max_completion_tokens | integer | No | 回复长度上限。部分较新模型用这个字段替代 max_tokens。 |
reasoning_effort | string | No | 推理强度。调高会让模型思考更久、通常更准, 同时消耗更多 token。仅推理类模型有效。 Options: minimal / low / medium / high |
verbosity | string | No | 回复详略程度。 Options: low / medium / high |
modalities | array | No | 期望的输出模态, 如仅文本或文本加音频。仅多模态模型有效。 |
audio | object | No | 音频输出设置, 如音色与音频格式。需在 modalities 中包含音频。 |
prediction | object | No | 预测输出。已知回复大部分内容时提供它可以加快生成。 |
stream_options | object | No | 流式相关设置, 如是否在最后一帧附带用量统计。需 stream=true。 |
store | boolean | No | 是否在模型服务侧留存本次对话。 |
metadata | object | No | 自定义键值对, 会随请求一起带上, 便于你自己归类检索。 |
user | string | No | 代表终端用户的标识, 便于你区分自己的用户来源。 |
prompt_cache_key | string | No | 提示词缓存键。相同前缀的请求带同一个键更容易命中缓存, 从而更快更省。 |
prompt_cache_retention | string | No | 提示词缓存保留时长。 |
curl https://api.router.ai/v1/chat/completions \
-H "Authorization: Bearer sk-你的令牌" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.3",
"messages": [{"role": "user", "content": "你好"}]
}'Endpoint reference: Create a chat completion (OpenAI-compatible)
Call GLM-5.3 using the Anthropic-native protocol.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model name to be called, fill in the name from the model gallery. |
messages | array | Yes | Array of conversation messages, each containing role and content. The role can only be user or assistant; system prompts are handled via a separate system field and not included here. |
max_tokens | integer | Yes | Maximum number of tokens to generate in this response. This is a required field under this protocol. |
system | string | No | System prompt. Can be passed as a string or as an array to set different segments individually. |
stream | boolean | No | Whether to stream the response. Set to true for incremental SSE streaming. |
temperature | number | No | Sampling temperature; higher values result in more diverse outputs, lower values result in more stable outputs. |
tools | array | No | List of available tools for the model to use. The model will return a tool_use content block when needed, which you will then execute and refill with tool_result. |
tool_choice | object | No | Control over tool usage: whether to let the model decide, force usage, or specify a particular tool. Must be used in conjunction with tools. |
stop_sequences | array | No | Stop generation upon encountering any of the following strings. |
top_p | number | No | Nucleus sampling, selecting candidates from the top top_p cumulative probabilities. Only one of temperature and nucleus sampling should be used. |
top_k | integer | No | Only select from the top k candidates with highest probability. |
thinking | object | No | Enable extended thinking: the model will perform reasoning before generating a response. The reasoning process will be returned as a separate content block and counted toward output usage. Only available for models that support this capability. |
metadata | object | No | Custom metadata for your own categorization and retrieval. |
curl https://api.router.ai/v1/messages \
-H "Authorization: Bearer sk-你的令牌" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.3",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "你好"}]
}'