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 Claude Format

POST
/v1/messages

Introduction#

Claude's native message interface, suitable for native Anthropic clients such as Claude Code. This interface complies with Anthropic's API specifications and provides full feature support for Claude models, including advanced capabilities like Extended Thinking and tool calling.
You can test different scenarios by switching the Body example below or by setting the stream field to true.
All requests share the following headers:
x-api-key: sk-xxx (or use Authorization)
anthropic-version: 2023-06-01
content-type: application/json
When stream=true, the response will be an SSE stream (content-type: text/event-stream), and the event types follow the native Anthropic specification (message_start / content_block_start / content_block_delta / content_block_stop / message_delta / message_stop).

请求参数

Body 参数application/json必填

示例
{
    "model": "claude-sonnet-4.5",
    "max_tokens": 1024,
    "messages": [
        {
            "role": "user",
            "content": "Hello, nice to meet you"
        }
    ]
}

请求示例代码

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/messages' \
--header 'Content-Type: application/json' \
--data '{
    "model": "claude-sonnet-4.5",
    "max_tokens": 1024,
    "messages": [
        {
            "role": "user",
            "content": "Hello, nice to meet you"
        }
    ]
}'

返回响应

🟢200
application/json
Bodyapplication/json

示例
{
    "model": "claude-sonnet-4-5-20250929",
    "id": "msg_bdrk_01DJBYweRg351XHSgq6JcTsE",
    "type": "message",
    "role": "assistant",
    "content": [
        {
            "type": "text",
            "text": "Hello! Nice to meet you too! How are you doing today? Is there anything I can help you with?"
        }
    ],
    "stop_reason": "end_turn",
    "usage": {
        "input_tokens": 13,
        "cache_creation_input_tokens": 0,
        "cache_read_input_tokens": 0,
        "cache_creation": {
            "ephemeral_5m_input_tokens": 0,
            "ephemeral_1h_input_tokens": 0
        },
        "output_tokens": 26
    }
}
🟠400
🟠401
🟠403
修改于 2026-11-02 09:46:28
上一页
Native Gemini Format
下一页
Responses Request (openai)
Built with