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": "用三點說明如何排查 API 逾時"}],
"thinking": {"type": "enabled"},
"reasoning_effort": "low",
"max_tokens": 4096
}'