Appearance
数据模型: ChatCompletionRequest
ResponseFormat
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| type | string | 否 | |
| json_schema | object | 否 | JSON Schema 定义 |
数据模型示例
json
{
"type": "string",
"json_schema": {}
}ChatCompletionRequest
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型 ID |
| messages | array of any | 是 | 对话消息列表 |
| temperature | number | 否 | 采样温度 |
| top_p | number | 否 | 核采样参数 |
| n | integer | 否 | 生成数量 |
| stream | boolean | 否 | 是否流式响应 |
| stream_options | object | 否 | |
| stream_options.include_usage | boolean | 否 | |
| stop | any | 否 | 停止序列 |
| max_tokens | integer | 否 | 最大生成 Token 数 |
| max_completion_tokens | integer | 否 | 最大补全 Token 数 |
| presence_penalty | number | 否 | |
| frequency_penalty | number | 否 | |
| logit_bias | object | 否 | |
| user | string | 否 | |
| tools | array of any | 否 | |
| tool_choice | any | 否 | |
| response_format | any | 否 | |
| seed | integer | 否 | |
| reasoning_effort | string | 否 | 推理强度 (用于支持推理的模型) |
| modalities | array of string | 否 | |
| audio | object | 否 | |
| audio.voice | string | 否 | |
| audio.format | string | 否 |
数据模型示例
json
{
"model": "gpt-4",
"messages": [
{
"role": "string",
"content": null,
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
}
],
"temperature": 0,
"top_p": 0,
"n": 0,
"stream": true,
"stream_options": {
"include_usage": true
},
"stop": null,
"max_tokens": 0,
"max_completion_tokens": 0,
"presence_penalty": 0,
"frequency_penalty": 0,
"logit_bias": {},
"user": "string",
"tools": [
{
"type": "function",
"function": {
"name": "string",
"description": "string",
"parameters": {}
}
}
],
"tool_choice": null,
"response_format": {
"type": "string",
"json_schema": {}
},
"seed": 0,
"reasoning_effort": "string",
"modalities": [
"string"
],
"audio": {
"voice": "string",
"format": "string"
}
}ToolCall
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| id | string | 否 | |
| type | string | 否 | |
| function | object | 否 | |
| function.name | string | 否 | |
| function.arguments | string | 否 |
数据模型示例
json
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}Tool
| 字段 | 类型 | 必选 | 描述 |
|---|---|---|---|
| type | string | 否 | |
| function | object | 否 | |
| function.name | string | 否 | |
| function.description | string | 否 | |
| function.parameters | object | 否 | JSON Schema 格式的参数定义 |
数据模型示例
json
{
"type": "function",
"function": {
"name": "string",
"description": "string",
"parameters": {}
}
}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"
}