Skip to main content
POST

Authorizations

Authorization
string
header
required

标准 HTTP Bearer 认证。在 API Keys 获取密钥。

Body

application/json
model
string
required

模型编码。例如 glm-5.3

Example:

"glm-5.3"

input
required

用户文本,或输入项数组(message / function_call / function_call_output / reasoning)。

instructions
string

系统指令。

stream
boolean
default:false

是否 SSE 流式返回,默认 false。结束时不发送 data: [DONE]

temperature
number<float>

采样温度 [0.0, 1.0],限两位小数。GLM-5.3 默认 1.0。不要与 top_p 同时调节。

Required range: 0 <= x <= 1
top_p
number<float>

核采样 [0.01, 1.0],限两位小数。GLM-5.3 默认 0.95。不要与 temperature 同时调节。

Required range: 0.01 <= x <= 1
max_output_tokens
integer
default:65536

模型输出最大 tokens(含回答与思维链)。最大 131072,默认 65536

Required range: 1 <= x <= 131072
stop
string[]

遇到其中任一字符串时停止生成。

Example:
tools
(函数工具 · object | 命名空间工具 · object | 自定义工具 · object | 联网搜索 · object)[]

可调用工具:function / namespace / custom / web_search

tool_choice
enum<string>

none 不调用任何工具;auto 由模型判断。

Available options:
none,
auto
reasoning
object

限制深度思考的工作量。

text
object

模型文本输出格式,可以是自然语言或结构化 JSON。

prompt_cache_key
string

用于集群路由,以提高缓存命中率。

previous_response_id
string

上一轮 id,用于多轮。须 store=true,有效期 7 天。

store
boolean
default:false

是否保存本次响应,默认 false。为 true 时可用于查询、删除和多轮。

Response

同步返回 Response 对象;stream=true 时返回 SSE 事件流,不发送 data: [DONE]

同步请求返回的 Response 对象。

id
string

本次请求的唯一标识。

object
enum<string>

固定为 response

Available options:
response
created_at
integer<int64>

请求创建时间,Unix 秒时间戳。

model
string

模型名称。

instructions
string

系统指令。

max_output_tokens
integer<int64>

模型输出最大 token 数,包含回答和思维链。

status
enum<string>

生成状态。

Available options:
completed,
failed,
in_progress,
incomplete
temperature
number<float>

采样温度。

top_p
number<float>

核采样概率阈值。

text
object

模型文本输出格式,可以是自然语言或结构化 JSON。

tools
(函数工具 · object | 命名空间工具 · object | 自定义工具 · object | 联网搜索 · object)[]

同入参 tools

error
object | null

模型未能生成响应时的错误对象。

incomplete_details
object | null

响应未能完成的细节。

output
(助手回答 · object | 思维链输出 · object | 函数调用 · object | 联网搜索调用 · object)[]

本轮输出:回答、思维链、工具调用、联网搜索。

usage
object