1. 原生OpenAI格式
模力
  • 文档说明
  • Claude
    • Anthropic Messages
      POST
  • 聊天(Chat)
    • 原生OpenAI格式
      • ChatCompletions格式
        POST
      • Responses格式
        POST
    • 原生Gemini格式
      • Gemini文本聊天
      • Gemini媒体识别
    • 原生Claude格式
      POST
  • 图像(Images)
    • Nano Banana生图
      • 官方格式(文生图)
      • 官方格式(图生图)
    • 生图模型
      • GPT Image 特价
        • 创建 gpt-image-2
        • 编辑 gpt-image-2
        • 蒙版 gpt-image-2
        • 创建 gpt-image-2 异步
        • 编辑 gpt-image-2 异步
        • 异步查询图片生成状态
        • 异步查询图片生成结果
      • Gpt-image2图像 OpenAI
        • 生成图像
        • 图片编辑
  • 视频模型
    • Seedance-2.0视频
      • SeeDance2系列视频生成说明
      • 文生视频
      • 首尾帧生成视频
      • 多图参考生成
      • 多模态视频生成
      • 官方格式参数生成
      • 查询视频生成结果
  • 数据模型
    • Schemas
      • User
      • Log
      • Model
      • Token
      • Usage
      • PageInfo
      • Channel
      • Redemption
      • ApiResponse
      • ModelsResponse
      • ErrorResponse
      • Message
      • MessageContent
      • Tool
      • ToolCall
      • GeminiModelsResponse
      • ChatCompletionResponse
      • ChatCompletionRequest
      • ChatCompletionStreamResponse
      • CompletionRequest
      • CompletionResponse
      • ResponseFormat
      • ResponsesRequest
      • ResponsesResponse
      • ResponsesStreamResponse
      • ClaudeRequest
      • ClaudeMessage
      • ClaudeResponse
      • EmbeddingRequest
      • EmbeddingResponse
      • ImageGenerationRequest
      • ImageEditRequest
      • ImageResponse
      • AudioTranscriptionRequest
      • AudioTranslationRequest
      • AudioTranscriptionResponse
      • SpeechRequest
      • RerankRequest
      • RerankResponse
      • VideoRequest
      • ModerationRequest
      • VideoResponse
      • ModerationResponse
      • VideoTaskResponse
      • GeminiRequest
      • VideoTaskMetadata
      • VideoTaskError
      • GeminiResponse
      • OpenAIVideo
      • OpenAIVideoError
    • Schemas
      • ApiResponse
      • PageInfo
      • User
      • Channel
      • Token
      • Redemption
      • Log
  1. 原生OpenAI格式

ChatCompletions格式

POST
/v1/chat/completions
根据对话历史创建模型响应。支持流式和非流式响应。
兼容 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 'https://mliapi.com/v1/chat/completions' \
--header 'Authorization: skxxxx' \
--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
修改于 2026-07-09 13:35:52
上一页
Anthropic Messages
下一页
Responses格式
Built with