Anthropic
Claude Sonnet 5
Anthropic's next-generation Sonnet — near-Opus coding and agentic capability at Sonnet speed and cost, the default for everyday development
Context Length1M tokens
Model TypeLarge Language Model (LLM)
MultimodalText, Image Input
Pricing & Specs
💰 Pricing
Input$3 / M tokens
Output$15 / M tokens
Cache Write5m: $3.75 / MTok; 1h: $6 / MTok
Cache Hit$0.30 / MTok
⚙️ Specs
Context Length1M tokens
Model TypeLarge Language Model (LLM)
MultimodalText, Image Input
Adaptive ThinkingSupported (on by default)
Max Output128K tokens
Release DateJune 30, 2026
Knowledge CutoffJanuary 2026
API CompatibilityClaude API, Claude Code, OpenAI API
API Examples
Python
import anthropic
client = anthropic.Anthropic(
api_key="your-api-key"
)
message = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude!"}
]
)
print(message.content[0].text)cURL
curl https://api.xairouter.com/v1/messages
-H "Content-Type: application/json"
-H "x-api-key: YOUR_API_KEY"
-H "anthropic-version: 2023-06-01"
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude!"}
]
}'Developer Assist
# Set environment variables in terminal
export ANTHROPIC_AUTH_TOKEN=sk-Xvs... # Your API Key
export ANTHROPIC_BASE_URL=https://api.xairouter.com
# Start Claude Code
claude
# Now you can use claude-sonnet-5 model directly for development