响应格式
非流式响应
JSON
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1700000000,
"model": "glm-4.7-flash",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 8,
"total_tokens": 18
}
}响应字段说明
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 必填 | 请求唯一标识 |
| object | string | 必填 | 对象类型,固定 chat.completion |
| choices | array | 必填 | 回复选项列表 |
| choices[].finish_reason | string | 必填 | stop(正常结束)/ length(达到上限) |
| usage | object | 必填 | Token 用量统计 |
| usage.prompt_tokens | integer | 必填 | 输入 token 数 |
| usage.completion_tokens | integer | 必填 | 输出 token 数 |
| usage.total_tokens | integer | 必填 | 总 token 数 |