Appearance
数据模型: ChatCompletionResponse
ChatCompletionResponse
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| id | string | 否 | |
| object | string | 否 | |
| created | integer | 否 | |
| model | string | 否 | |
| choices | array of object | 否 | |
| choices[].index | integer | 否 | |
| choices[].message | any | 否 | |
| choices[].finish_reason | string | 否 | |
| usage | any | 否 | |
| system_fingerprint | string | 否 |
数据模型示例
json
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "string",
"content": null,
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}ToolCall
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| id | string | 否 | |
| type | string | 否 | |
| function | object | 否 | |
| function.name | string | 否 | |
| function.arguments | string | 否 |
数据模型示例
json
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}MessageContent
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| type | string | 否 | |
| text | string | 否 | |
| image_url | object | 否 | |
| image_url.url | string | 否 | 图片 URL 或 base64 |
| image_url.detail | string | 否 | |
| input_audio | object | 否 | |
| input_audio.data | string | 否 | Base64 编码的音频数据 |
| input_audio.format | string | 否 | |
| file | object | 否 | |
| file.filename | string | 否 | |
| file.file_data | string | 否 | |
| file.file_id | string | 否 | |
| video_url | object | 否 | |
| video_url.url | string | 否 |
数据模型示例
json
{
"type": "string",
"text": "string",
"image_url": {
"url": "string",
"detail": "string"
},
"input_audio": {
"data": "string",
"format": "string"
},
"file": {
"filename": "string",
"file_data": "string",
"file_id": "string"
},
"video_url": {
"url": "string"
}
}Message
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| role | string | 是 | 消息角色 |
| content | any | 是 | 消息内容 |
| name | string | 否 | 发送者名称 |
| tool_calls | array of any | 否 | |
| tool_call_id | string | 否 | 工具调用 ID(用于 tool 角色消息) |
| reasoning_content | string | 否 | 推理内容 |
数据模型示例
json
{
"role": "string",
"content": null,
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
}Usage
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| prompt_tokens | integer | 否 | 提示词 Token 数 |
| completion_tokens | integer | 否 | 补全 Token 数 |
| total_tokens | integer | 否 | 总 Token 数 |
| prompt_tokens_details | object | 否 | |
| prompt_tokens_details.cached_tokens | integer | 否 | |
| prompt_tokens_details.text_tokens | integer | 否 | |
| prompt_tokens_details.audio_tokens | integer | 否 | |
| prompt_tokens_details.image_tokens | integer | 否 | |
| completion_tokens_details | object | 否 | |
| completion_tokens_details.text_tokens | integer | 否 | |
| completion_tokens_details.audio_tokens | integer | 否 | |
| completion_tokens_details.reasoning_tokens | integer | 否 |
数据模型示例
json
{
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
}