响应格式
Chat Completions 非流式 JSON 响应结构。
响应格式
非流式请求(stream: false)返回标准 JSON 对象。
响应示例
{
"id": "chatcmpl-example",
"object": "chat.completion",
"created": 1710000000,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "REST is an architectural style for networked APIs using HTTP verbs and resources."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 18,
"total_tokens": 30
}
}
主要字段
| 字段 | 类型 | 描述 |
|---|---|---|
id | string | 本次补全的唯一标识 |
choices | array | 生成结果列表 |
choices[].message | object | 助手消息,含 role 与 content |
usage | object | Token 用量统计,用于计费 |
流式场景见 流式响应(SSE)。