1. Chat
PeakkAI-Doc
English
  • 中文
  • English
  • 首页
  • English
    • Home Page
    • PeakkAI-API
      • Model
        • Native OpenAI Format
        • Native Gemini Format
      • Chat
        • Native OpenAI Format
          POST
        • Native Gemini Format
          POST
        • Native Claude Format
          POST
        • Responses Request (openai)
          POST
      • Audio
        • Native OpenAI Format TTS
        • Native Gemini Format TTS
      • Images
        • Native OpenAI Format Image Editing (JSON)
        • Native OpenAI Format Image Generation
        • Native OpenAI Format Image Editing (Multipart)
        • Native Gemini Format Image Generation
      • Video
        • Seedance2.0 format
          • Create Video Generation Task
          • Query Video Generation Task Status
      • Vector
        • Embeddings
          • Create Embedding
      • Translation
        • Speech Translation
    • AI application
      • PeakkAI API Integration with Claude Code
      • PeakkAI API Integration with Cursor
      • PeakkAI API Integration with Codex-cli
      • PeakkAI API Integration with Codex Desktop
      • PeakkAI API Integration with Hermes Agent
  1. Chat

Native OpenAI Format

POST
/v1/chat/completions
POST /v1/chat/completions

请求参数

Authorization
Bearer Token
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
or
Header 参数

Body 参数application/json

示例
{
    "model": "GPT-5.2-Chat",
    "messages": [
        {
            "role": "developer",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Hello!"
        }
    ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location 'https://api.peakkai.ai/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "model": "GPT-5.2-Chat",
    "messages": [
        {
            "role": "developer",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "Hello!"
        }
    ]
}'

返回响应

🟢200
application/json
Bodyapplication/json

示例
{
    "id": "chatcmpl-B9MBs8CjcvOU2jLn4n570S5qMJKcT",
    "object": "chat.completion",
    "created": 1741569952,
    "model": "gpt-5.4",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Hello! How can I assist you today?",
                "refusal": null,
                "annotations": []
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 6,
        "completion_tokens": 0,
        "total_tokens": 6
    },
    "service_tier": "default"
}
🟠400
🔴500
修改于 2026-11-02 09:46:28
上一页
Native Gemini Format
下一页
Native Gemini Format
Built with