Claude Messages API field guide
Claude Messages API: four models, one integration
Choose a Claude model, compare every token rate in one place, then copy a complete Anthropic Messages request. The endpoint, authentication, streaming shape, and cache usage fields stay the same across the family.
All Claude model prices in one table
Compare official Claude API rates with AIReiter promotional prices per 1M tokens. Input and output savings reach approximately 69% across Opus, Sonnet, and Fable.
| Model | Best fit | Input | Output | Cache read | Cache creation |
|---|---|---|---|---|---|
| Claude Opus 4.8 | Deep reasoning | Official $5.00AIReiter $1.56 | Official $25.00AIReiter $7.76 | - | - |
| Claude Opus 4.7 | Proven flagship | Official $5.00AIReiter $1.56 | Official $25.00AIReiter $7.76 | - | - |
| Claude Sonnet 5Best value | Production default | Official $2.00AIReiter $0.63 | Official $10.00AIReiter $3.11 | Official $0.20AIReiter $0.07 | Official $2.50AIReiter $0.78 |
| Claude Fable 5 | Creative specialist | Official $10.00AIReiter $3.42 | Official $50.00AIReiter $17.06 | Official $1.00AIReiter $3.42 | Official $12.50AIReiter $4.27 |
How to Configure
Choose one of three integration methods. All three use the same Messages endpoint and model IDs.
/api/v1/messagesAnthropic SDK
For backend services, assistants, and agents. Set baseURL once and call client.messages.create.
Client base URL
https://aireiter.com/apiFinal request URL
https://aireiter.com/api/v1/messagesModel
claude-sonnet-5Authentication header
x-api-keyCopy the complete configuration
The selected model is already inserted. Replace the example key before sending the request.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.AIREITER_API_KEY,
baseURL: "https://aireiter.com/api",
});
const message = await client.messages.create({
model: "claude-sonnet-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Review this API design." }],
});
console.log(message.content);/api/v1/messagesCC Switch (GUI)
Manage the Anthropic provider visually, then switch Claude models without editing configuration files.
Client base URL
https://aireiter.com/apiFinal request URL
https://aireiter.com/api/v1/messagesModel
claude-sonnet-5Authentication header
x-api-keyCopy the complete configuration
The selected model is already inserted. Replace the example key before sending the request.
Provider name: AIReiter
API format: Anthropic
Base URL: https://aireiter.com/api
API key: sk-your-key
Model: claude-sonnet-5/api/v1/messagesTerminal curl
Verify the endpoint, key, and model ID directly before debugging an SDK or desktop client.
Client base URL
https://aireiter.com/apiFinal request URL
https://aireiter.com/api/v1/messagesModel
claude-sonnet-5Authentication header
x-api-keyCopy the complete configuration
The selected model is already inserted. Replace the example key before sending the request.
curl "https://aireiter.com/api/v1/messages" \
-H "x-api-key: $AIREITER_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"stream": false,
"messages": [
{ "role": "user", "content": "Explain this change step by step." }
]
}'Messages API reference
Core request parameters
These eight fields cover the common text, streaming, tool-use, and prompt-caching workflows without turning this page into a full protocol specification.
| Parameter | Requirement | Purpose |
|---|---|---|
model | Required | Claude model ID to route the request. |
messages | Required | Conversation turns sent to the model. |
max_tokens | Required | Maximum number of output tokens. |
system | Optional | Top-level instructions and stable context. |
stream | Optional | Return incremental SSE events when true. |
temperature | Optional | Control response randomness. |
tools | Optional | Tool definitions available to the model. |
cache_control | Optional | Mark reusable content for prompt caching. |
Streaming
Receive text as it is generated
Set stream to true and read Server-Sent Events until message_stop. Text arrives through content_block_delta events.
curl "https://aireiter.com/api/v1/messages" \
-H "x-api-key: $AIREITER_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"stream": true,
"messages": [{ "role": "user", "content": "Explain this API." }]
}'Prompt caching
Cache stable prompt prefixes
Add cache_control to stable system content. The first eligible request may create the cache; later matching prefixes can report cache reads.
{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"system": [{
"type": "text",
"text": "<stable project context>",
"cache_control": { "type": "ephemeral" }
}],
"messages": [{ "role": "user", "content": "Review this change." }]
}cache_creation_input_tokens · cache_read_input_tokens
Claude Code setup
Point Claude Code at one base URL
Claude Code already speaks the Messages protocol. Set the AIReiter base URL and token once, then choose any available Claude model without changing the transport.
- Client base URL
- https://aireiter.com/api
- Authentication variable
- ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_BASE_URL="https://aireiter.com/api"
export ANTHROPIC_AUTH_TOKEN="$AIREITER_API_KEY"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
cd ~/your-project
claude --model claude-sonnet-5Client compatibility
Use the same endpoint across your Claude workflow
The protocol stays Anthropic-native. Only the configuration surface changes between Claude Code, CC Switch, an SDK, and direct HTTP requests.
Claude Code
Set environment variables once, then launch Claude Code in any project directory.
ANTHROPIC_BASE_URLCC Switch
Create an Anthropic provider and use the base URL without appending /v1/messages.
https://aireiter.com/apiDirect API
Send Messages requests with x-api-key and anthropic-version headers.
/v1/messagesClaude API questions
Which URL should the SDK use?
Set the SDK base URL to https://aireiter.com/api. The Anthropic SDK appends /v1/messages; use the full URL only for direct HTTP requests.
How do I confirm a cache hit?
Check usage.cache_read_input_tokens in the response. A repeated request alone does not prove that the stable prefix was reused.
How do I switch Claude models?
Keep the endpoint and headers unchanged, then replace only the model field with claude-opus-4-8, claude-opus-4-7, claude-sonnet-5, or claude-fable-5.
