Anthropic Messages API
Chuizi.AI proxies the Anthropic Messages API as a native passthrough. Your request body goes directly to Anthropic with zero format conversion, and automatic failover ensures high availability. The response comes back in Anthropic's own format, including streaming SSE event types.
This matters if you use Claude Code, Cursor, Cline, or OpenCode. These tools expect the Anthropic Messages API, not OpenAI's format. With Chuizi.AI, you set two environment variables and everything works.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /anthropic/v1/messages | Create a message (streaming and non-streaming) |
GET | /anthropic/v1/models | List available Anthropic models |
Authentication
Chuizi.AI accepts your ck- API key through two headers. Use whichever your tool expects:
| Header | Format | Example |
|---|---|---|
x-api-key | ck-your-key-here | Anthropic SDK default |
Authorization | Bearer ck-your-key-here | OpenAI convention |
Both resolve to the same user account, balance, and rate limits.
Required Headers
| Header | Value | Notes |
|---|---|---|
anthropic-version | 2023-06-01 | Required. Passed through to upstream. |
content-type | application/json | Required for POST requests. |
How It Differs from OpenAI /v1/chat/completions
If you are used to the OpenAI Chat Completions format, these are the key structural differences in Anthropic's Messages API:
| Concept | OpenAI Chat Completions | Anthropic Messages |
|---|---|---|
| System prompt | messages array entry with role: "system" | Top-level system field (string or array of blocks) |
| Content format | String or array of content parts | Always an array of content blocks ([{type: "text", text: "..."}]) |
| Stop indicator | finish_reason: "stop" | stop_reason: "end_turn" |
| Max tokens | Optional (max_tokens or max_completion_tokens) | Required (max_tokens) |
| Token usage | usage.prompt_tokens, usage.completion_tokens | usage.input_tokens, usage.output_tokens |
| Streaming events | data: {"choices": [...]} chunks | Typed events: message_start, content_block_delta, message_delta |
| Model prefix | anthropic/claude-sonnet-4-6 | claude-sonnet-4-6 (bare name) or anthropic/claude-sonnet-4-6 |
Request Format
{ "model": "claude-sonnet-4-6", "max_tokens": 1024, "system": "You are a helpful assistant.", "messages": [ { "role": "user", "content": "Explain how TCP handshakes work." } ] }
Supported Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name. Bare names (claude-sonnet-4-6) and prefixed names (anthropic/claude-sonnet-4-6) both work. |
max_tokens | integer | Yes | Maximum tokens to generate. |
messages | array | Yes | Conversation messages. |
system | string or array | No | System prompt. Can be a string or an array of content blocks (useful for caching). |
stream | boolean | No | Enable SSE streaming. Default: false. |
temperature | number | No | Sampling temperature, 0-1. |
top_p | number | No | Nucleus sampling threshold. |
top_k | integer | No | Top-K sampling. |
stop_sequences | array | No | Custom stop sequences. |
tools | array | No | Tool definitions for function calling. |
tool_choice | object | No | Tool selection strategy. |
metadata | object | No | Request metadata (e.g., user_id for abuse tracking). |
Response Format
Non-streaming
{ "id": "msg_01XFDUDYJgAACzvnptvVoYEL", "type": "message", "role": "assistant", "content": [ { "type": "text", "text": "TCP uses a three-way handshake to establish a connection..." } ], "model": "claude-sonnet-4-6", "stop_reason": "end_turn", "usage": { "input_tokens": 25, "output_tokens": 150 } }
Next Steps
- Choosing a Protocol — Compare OpenAI, Anthropic, and Gemini protocols side by side
- Claude Code Integration — Detailed setup guide for Claude Code with Chuizi.AI
- Cache Discount Pricing — Save up to 90% on input costs with Anthropic prompt caching