1. 对话完整传参示例
聚合API接口文档
  • 常用请求
    • 获取模型
      • 获取模型
      • 获取模型 - gemini
    • 文本嵌入
      • 文本嵌入
      • 文本嵌入 - gemini
    • 系统级请求
      • 获取用户剩余额度
      • 全局消费统计
    • 令牌余额查询
      GET
    • 基本请求
      POST
    • 流式请求
      POST
    • 连续对话
      POST
    • 识图请求 - url
      POST
    • 识图请求 - base64
      POST
    • 工具调用
      POST
    • 文档重排序
      POST
    • 流式出图/视频
      POST
    • GPT开思考
      POST
    • codex模型请求
      POST
    • 视频识别
      POST
    • PDF识别
      POST
    • 结构化输出
      POST
  • 图片/视频生成
    • OpenAI Image格式
      • 文生图
      • 图生图
    • Grok生图格式
      • 生成图像
      • 编辑图像
    • Seedance视频格式
      • Seedance 素材库
        • 提交素材审核任务
        • 查询素材审核任务
      • 创建视频生成任务
      • 查询视频生成任务
    • Veo
      • 创建视频生成任务
      • 查询视频任务状态
    • Gemini生图格式
      POST
  • 高阶用法
    • Gemini原生格式
      • 普通对话
      • 开启思考
      • 流式请求
      • 结构化输出
      • 函数调用
      • PDF识别
      • 图像识别
      • 视频识别
    • Anthropic原生格式
      • 普通对话
      • 流式请求
      • 开启思考
      • 图像识别
      • 函数调用
      • 内置联网
    • 对话完整传参示例
      • OpenAI对话格式 - chat
        POST
      • OpenAI对话格式 - responses
        POST
      • Claude对话格式 - messages
        POST
      • Gemini对话格式 - v1beta
        POST
  • 在代码工具使用
    • 在cc switch中使用
    • 在codex中使用
    • 在gemini cli中使用
    • 在claudecode中使用
  • 数据模型
    • Schemas
      • ModelsResponse
      • GeminiModelsResponse
      • ChatCompletionRequest
      • ChatCompletionResponse
      • CompletionRequest
      • CompletionResponse
      • ResponsesRequest
      • ResponsesResponse
      • ClaudeRequest
      • ClaudeResponse
      • EmbeddingRequest
      • EmbeddingResponse
      • ImageGenerationRequest
      • ImageResponse
      • AudioTranscriptionResponse
      • SpeechRequest
      • RerankRequest
      • RerankResponse
      • VideoRequest
      • ModerationRequest
      • VideoResponse
      • ModerationResponse
      • GeminiRequest
      • GeminiResponse
      • OpenAIVideoError
      • Model
      • Message
      • MessageContent
      • ToolCall
      • Tool
      • ResponseFormat
      • Usage
      • ClaudeMessage
      • VideoTaskMetadata
      • ChatCompletionStreamResponse
      • ResponsesStreamResponse
      • ImageEditRequest
      • AudioTranscriptionRequest
      • AudioTranslationRequest
      • OpenAIVideo
    • SeedanceGenerationRequest
    • MaterialReviewRequest
    • VideoGenerationRequest
    • SeedanceMetadata
    • MaterialReviewMetadata
    • VideoSubmitResponse
    • VideoTaskResponse
    • SeedanceTool
    • MaterialContentItem
    • MediaURL
    • HTTPSMediaURL
    • VideoModel
    • VideoTaskError
    • ReferenceContentItem
    • SubmitTaskResponse
    • SubmitVideoResponse
    • TaskQueryResponse
    • TaskErrorResponse
    • MaterialTaskRecord
    • OpenAIErrorResponse
    • TaskRecord
    • TaskProperties
    • MaterialTaskData
    • SeedanceTaskData
    • MaterialTaskContent
    • SeedanceUsage
    • MaterialReviewResult
    • SeedanceResultContent
    • MaterialTaskError
    • ErrorResponse
    • SeedanceTaskError
  1. 对话完整传参示例

OpenAI对话格式 - chat

POST
/v1/chat/completions
最后修改时间:2025-11-29 03:42:38
根据对话历史创建模型响应。支持流式和非流式响应。
兼容 OpenAI Chat Completions API。

请求参数

Header 参数

Body 参数application/json

示例
{
    "model": "gpt-4",
    "messages": [
        {
            "role": "system",
            "content": "string",
            "name": "string",
            "tool_calls": [
                {
                    "id": "string",
                    "type": "function",
                    "function": {
                        "name": "string",
                        "arguments": "string"
                    }
                }
            ],
            "tool_call_id": "string",
            "reasoning_content": "string"
        }
    ],
    "temperature": 1,
    "top_p": 1,
    "n": 1,
    "stream": false,
    "stream_options": {
        "include_usage": true
    },
    "stop": "string",
    "max_tokens": 0,
    "max_completion_tokens": 0,
    "presence_penalty": 0,
    "frequency_penalty": 0,
    "logit_bias": {
        "property1": 0,
        "property2": 0
    },
    "user": "string",
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "string",
                "description": "string",
                "parameters": {}
            }
        }
    ],
    "tool_choice": "none",
    "response_format": {
        "type": "text",
        "json_schema": {}
    },
    "seed": 0,
    "reasoning_effort": "low",
    "modalities": [
        "text"
    ],
    "audio": {
        "voice": "string",
        "format": "string"
    }
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location '/v1/chat/completions' \
--header 'Authorization: Bearer {{key}}' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gpt-4",
    "messages": [
        {
            "role": "system",
            "content": "string",
            "name": "string",
            "tool_calls": [
                {
                    "id": "string",
                    "type": "function",
                    "function": {
                        "name": "string",
                        "arguments": "string"
                    }
                }
            ],
            "tool_call_id": "string",
            "reasoning_content": "string"
        }
    ],
    "temperature": 1,
    "top_p": 1,
    "n": 1,
    "stream": false,
    "stream_options": {
        "include_usage": true
    },
    "stop": "string",
    "max_tokens": 0,
    "max_completion_tokens": 0,
    "presence_penalty": 0,
    "frequency_penalty": 0,
    "logit_bias": {
        "property1": 0,
        "property2": 0
    },
    "user": "string",
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "string",
                "description": "string",
                "parameters": {}
            }
        }
    ],
    "tool_choice": "none",
    "response_format": {
        "type": "text",
        "json_schema": {}
    },
    "seed": 0,
    "reasoning_effort": "low",
    "modalities": [
        "text"
    ],
    "audio": {
        "voice": "string",
        "format": "string"
    }
}'

返回响应

🟢200成功
application/json
成功创建响应
Bodyapplication/json

示例
{
    "id": "string",
    "object": "chat.completion",
    "created": 0,
    "model": "string",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "system",
                "content": "string",
                "name": "string",
                "tool_calls": [
                    {
                        "id": "string",
                        "type": "function",
                        "function": {
                            "name": "string",
                            "arguments": "string"
                        }
                    }
                ],
                "tool_call_id": "string",
                "reasoning_content": "string"
            },
            "finish_reason": "stop"
        }
    ],
    "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"
}
🟠400请求有误
🟠429
修改于 2025-11-29 03:42:38
上一页
内置联网
下一页
OpenAI对话格式 - responses
Built with