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.

Claude Opus 4.8claude-opus-4-8Deep reasoning
Claude Opus 4.7claude-opus-4-7Proven flagship
Claude Sonnet 5claude-sonnet-5Production default
Claude Fable 5claude-fable-5Creative specialist
Save69%

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.

ModelBest fitInputOutputCache readCache creation
Claude Opus 4.8Deep reasoningOfficial $5.00AIReiter $1.56Official $25.00AIReiter $7.76--
Claude Opus 4.7Proven flagshipOfficial $5.00AIReiter $1.56Official $25.00AIReiter $7.76--
Claude Sonnet 5Best valueProduction defaultOfficial $2.00AIReiter $0.63Official $10.00AIReiter $3.11Official $0.20AIReiter $0.07Official $2.50AIReiter $0.78
Claude Fable 5Creative specialistOfficial $10.00AIReiter $3.42Official $50.00AIReiter $17.06Official $1.00AIReiter $3.42Official $12.50AIReiter $4.27

How to Configure

Choose one of three integration methods. All three use the same Messages endpoint and model IDs.

Messages API/api/v1/messages

Anthropic SDK

For backend services, assistants, and agents. Set baseURL once and call client.messages.create.

Client base URL

https://aireiter.com/api

Final request URL

https://aireiter.com/api/v1/messages

Model

claude-sonnet-5

Authentication header

x-api-key

Copy the complete configuration

The selected model is already inserted. Replace the example key before sending the request.

Copy-ready
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);
Messages API/api/v1/messages

CC Switch (GUI)

Manage the Anthropic provider visually, then switch Claude models without editing configuration files.

Client base URL

https://aireiter.com/api

Final request URL

https://aireiter.com/api/v1/messages

Model

claude-sonnet-5

Authentication header

x-api-key

Copy the complete configuration

The selected model is already inserted. Replace the example key before sending the request.

Copy-ready
Provider name: AIReiter
API format: Anthropic
Base URL: https://aireiter.com/api
API key: sk-your-key
Model: claude-sonnet-5
Messages API/api/v1/messages

Terminal curl

Verify the endpoint, key, and model ID directly before debugging an SDK or desktop client.

Client base URL

https://aireiter.com/api

Final request URL

https://aireiter.com/api/v1/messages

Model

claude-sonnet-5

Authentication header

x-api-key

Copy the complete configuration

The selected model is already inserted. Replace the example key before sending the request.

Copy-ready
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.

ParameterRequirementPurpose
modelRequiredClaude model ID to route the request.
messagesRequiredConversation turns sent to the model.
max_tokensRequiredMaximum number of output tokens.
systemOptionalTop-level instructions and stable context.
streamOptionalReturn incremental SSE events when true.
temperatureOptionalControl response randomness.
toolsOptionalTool definitions available to the model.
cache_controlOptionalMark 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
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.

request.json
{
  "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
terminal
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-5

Client 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_URL

CC Switch

Create an Anthropic provider and use the base URL without appending /v1/messages.

https://aireiter.com/api

Direct API

Send Messages requests with x-api-key and anthropic-version headers.

/v1/messages

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