Skip to content

数据模型: ChatCompletionResponse ​

ChatCompletionResponse ​

字段类型必选描述
idstring否
objectstring否
createdinteger否
modelstring否
choicesarray of object否
choices[].indexinteger否
choices[].messageany否
choices[].finish_reasonstring否
usageany否
system_fingerprintstring否

数据模型示例 ​

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 ​

字段类型必选描述
idstring否
typestring否
functionobject否
function.namestring否
function.argumentsstring否

数据模型示例 ​

json
{
  "id": "string",
  "type": "function",
  "function": {
    "name": "string",
    "arguments": "string"
  }
}

MessageContent ​

字段类型必选描述
typestring否
textstring否
image_urlobject否
image_url.urlstring否图片 URL 或 base64
image_url.detailstring否
input_audioobject否
input_audio.datastring否Base64 编码的音频数据
input_audio.formatstring否
fileobject否
file.filenamestring否
file.file_datastring否
file.file_idstring否
video_urlobject否
video_url.urlstring否

数据模型示例 ​

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 ​

字段类型必选描述
rolestring是消息角色
contentany是消息内容
namestring否发送者名称
tool_callsarray of any否
tool_call_idstring否工具调用 ID(用于 tool 角色消息)
reasoning_contentstring否推理内容

数据模型示例 ​

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_tokensinteger否提示词 Token 数
completion_tokensinteger否补全 Token 数
total_tokensinteger否总 Token 数
prompt_tokens_detailsobject否
prompt_tokens_details.cached_tokensinteger否
prompt_tokens_details.text_tokensinteger否
prompt_tokens_details.audio_tokensinteger否
prompt_tokens_details.image_tokensinteger否
completion_tokens_detailsobject否
completion_tokens_details.text_tokensinteger否
completion_tokens_details.audio_tokensinteger否
completion_tokens_details.reasoning_tokensinteger否

数据模型示例 ​

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
  }
}

Released under the MIT License.