模型详情OpenAI Compatible
glm-5.2
在智谱分组中调用的文本模型
能力概览
通用对话
用于文本问答、生成和改写。
调用分组
使用包含该模型的智谱分组 API Key。
接口
POST
https://www.yunqiai.chat/v1/chat/completions所有请求使用 HTTPS,并通过请求头携带访问密钥。
请求参数
| 参数 | 类型 | 说明 |
|---|---|---|
model必填 | string | 要调用的模型 ID |
messages必填 | array | system / user / assistant / tool 消息数组 |
max_completion_tokens | integer | 最大生成 Token;上限随模型变化 |
stream | boolean | 是否以 SSE 流式返回,默认 false |
temperature | number | 0–2;推理模型建议省略并使用模型默认值 |
top_p | number | 0–1;与 temperature 通常只设置一个 |
n | integer | 返回候选数量;通常使用 1 控制费用 |
stop | string | string[] | 可选停止序列;使用模型默认行为时省略 |
tools | array | OpenAI Function Calling 工具定义 |
tool_choice | string | object | auto / none / required 或指定工具 |
response_format | object | 文本或 JSON Schema 结构化输出 |
请求示例
curl --request POST \
--url https://www.yunqiai.chat/v1/chat/completions \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "glm-5.2",
"messages": [
{
"role": "user",
"content": "你好,请介绍一下你自己"
}
],
"stream": false
}'响应
{
"id": "chatcmpl_01JY7X",
"object": "chat.completion",
"model": "glm-5.2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好!我是一个 AI 助手。"
},
"finish_reason": "stop"
}
]
}