Claude Sonnet 4
Anthropic Claude Sonnet 4 β pricing, 1000k context window, API cost calculator and alternatives.
By Anthropic
Specs
- Provider
- Anthropic
- Slug
- anthropic/claude-sonnet-4
- Capabilities
- vision, tools
Pricing freshness
- Tier
- standard
- Currency
- USD
- As of
- 2026-05-08 17:08 UTC
Pricing history
Tracking Claude Sonnet 4 pricing since 2026-05-08. We'll plot the chart here once it changes.
Quickstart β call Claude Sonnet 4 from your app
curl https://api.anthropic.com/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'
Official docs: https://docs.anthropic.com/en/api/messages
# pip install anthropic
from anthropic import Anthropic
client = Anthropic() # reads ANTHROPIC_API_KEY from env
resp = client.messages.create(
model="claude-sonnet-4",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.content[0].text)
Official docs: https://docs.anthropic.com/en/api/messages
// npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic(); // reads ANTHROPIC_API_KEY from env
const resp = await client.messages.create({
model: "claude-sonnet-4",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.content[0].text);
Official docs: https://docs.anthropic.com/en/api/messages
Related models
Similar capabilities, context window, and price tier β drawn from across the catalog so you can compare alternatives in one click.
Frequently asked questions
What is Claude Sonnet 4?
Claude Sonnet 4 is a large language model API from Anthropic with a 1M-token context window. It costs $3 per 1M input tokens and $15 per 1M output tokens.
How much does Claude Sonnet 4 cost?
Claude Sonnet 4 is priced at $3 per 1M input tokens and $15 per 1M output tokens via the Anthropic API. A 50/50 input/output workload of 1M total tokens costs about $9.
What is the context window of Claude Sonnet 4?
Claude Sonnet 4 supports up to 1M tokens of context per request β roughly 2000 pages of English text or 125000 lines of code at a typical density.
Does Claude Sonnet 4 support vision, tool use, or JSON mode?
Claude Sonnet 4 supports image input (vision) and tool/function calling. It does not support structured JSON mode.
Who makes Claude Sonnet 4?
Claude Sonnet 4 is built and operated by Anthropic. Pricing, context window, and capabilities on this page are refreshed nightly from Anthropic's public catalog.
Can I self-host Claude Sonnet 4?
Claude Sonnet 4 is API-only β its weights are not publicly distributed by Anthropic, so it cannot be self-hosted today.