GLM 参数与协议差异
了解 GLM 系列模型在兼容协议下的参数差异与使用方式。
使用 GLM 模型时,先按所选协议组织请求,再根据本页调整参数。这里集中说明官方明确列出的参数差异;完整请求和响应结构参阅 Chat Completions、Responses 和 Messages。
适用模型
| 模型 | 适用范围 |
|---|---|
| GLM-5.3-FlashX、GLM-5.3-Flash | Chat 参数差异及多模态补充 |
| GLM-5.3 | Chat、Responses 参数差异 |
GLM-5.3 系列文本参数
Chat Completions
| 字段 | 差异说明 |
|---|---|
thinking.type | 始终开启思考,仅支持 enabled,不支持 disabled |
reasoning_effort | 支持 low/high/max,默认 max |
temperature | 范围 0~1,默认 1,最多两位小数 |
top_p | 范围 0.01~1,默认 0.95,最多两位小数;与温度二选一调整 |
do_sample | GLM 扩展,默认 true;设为 false 时忽略 temperature 和 top_p |
max_tokens | 范围 1~131072,包含思考和最终回答的输出预算 |
tool_stream | GLM 扩展;函数参数需要流式输出时,与 stream 同时设为 true |
thinking.clear_thinking | 设为 false 启用保留式思考,历史思考须完整、原序回传 |
reasoning_content | 思考内容,流式通过 delta.reasoning_content 返回;交错思考的工具轮次须原样回传,并保留同条消息的 tool_calls |
request_id | GLM 扩展,6~64 字符,可使用 UUID;不传时由服务生成 |
user_id | GLM 扩展,6~128 字符,使用不含敏感信息的稳定终端用户标识 |
tool_choice | GLM-5.3 仅支持 auto |
response_format.type | GLM-5.3 支持 text 或 json_object |
Responses
本节适用于 GLM-5.3。
| 字段 | 差异说明 |
|---|---|
model、input | 均为必填 |
temperature | 范围 0~1,默认 1,最多两位小数 |
top_p | 范围 0.01~1,默认 0.95,最多两位小数 |
max_output_tokens | 包含思考与回答,默认 65536,最大 131072 |
reasoning.effort | 默认 max;low/medium 映射为 high,xhigh 映射为 max |
store | 默认 false;需要保存或服务端多轮时显式设为 true |
previous_response_id | 延续已保存的响应,ID 有效期为七天 |
tool_choice | 支持 none 或 auto |
tools[].type | 支持 function、namespace、custom、web_search |
text.format.type | 支持 text 或 json_object |
Flash/FlashX 多模态补充
Flash/FlashX 共用上述 Chat 文本参数。GLM-5.3 只接收文本,不使用本节内容块。
| 输入 | Chat 内容块 | 关键字段 |
|---|---|---|
| 图片 | type: "image_url" | image_url.url,支持图片 URL 或 Base64 Data URL;多图使用多个内容块 |
| 视频 | type: "video_url" | video_url.url |
| 文件 | type: "file" | file.file_id、file.file_url、file.file_data 三选一,单文件不超过 50 MB;旧 file_url 内容块仅作兼容 |
调用示例
将 MODEL_ID 替换为所选协议入口可用的完整模型 ID,API Key 使用自己的值。
三个模型均可采用此文本参数组合。
curl 'https://api.agtcloud.cn/v1/chat/completions' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "用三点说明如何排查接口超时"}],
"thinking": {"type": "enabled"},
"reasoning_effort": "low",
"max_tokens": 4096
}'