
TL;DR
Everything developers need to migrate from Sonnet 4.6 to Sonnet 5 - three breaking API changes, the new effort parameter, tokenizer impact, and when to use each effort level. Verified against Anthropic's official docs on July 4, 2026.
| Source | Description |
|---|---|
| Introducing Claude Sonnet 5 | Anthropic official announcement (June 30, 2026) |
| Sonnet 5 Migration Guide | Official migration documentation |
| What's New in Sonnet 5 | Feature changelog |
| Effort Parameter Docs | Reasoning effort configuration |
| Prompting Claude Sonnet 5 | Prompting best practices |
| Claude Pricing | Current pricing for all Claude plans |
Claude Sonnet 5 shipped on June 30, 2026 as Anthropic's most agentic Sonnet model yet. It's a drop-in replacement for Sonnet 4.6 - but "drop-in" doesn't mean zero changes. There are three breaking API changes that will hard-fail your code if you don't handle them, plus a new tokenizer that quietly increases your token counts by up to 35%.
This guide covers what breaks, what to change, and how to use the new effort parameter to control reasoning depth.
Last updated: July 4, 2026
Before updating your model ID, verify these four items:
claude-sonnet-4-6 to claude-sonnet-5temperature, top_p, or top_k set to non-default values returns a 400 errorthinking: {type: "enabled", budget_tokens: N} returns a 400 error - use the new effort parameter insteadIf your current code is simple (no sampling params, no extended thinking), the migration is just changing the model ID. Otherwise, read on.
What changed: Requests that set temperature, top_p, or top_k to non-default values return a 400 error.
Why: Anthropic's position is that sampling parameters introduce unpredictable output quality and are incompatible with adaptive thinking. Sonnet 5's reasoning process adjusts dynamically based on effort level, so manual sampling control isn't supported.
Migration:
// Before (Sonnet 4.6)
const response = await anthropic.messages.create({
model: "claude-sonnet-4-6",
temperature: 0.7,
top_p: 0.9,
messages: [{ role: "user", content: "..." }]
});
// After (Sonnet 5) - remove sampling params
const response = await anthropic.messages.create({
model: "claude-sonnet-5",
messages: [{ role: "user", content: "..." }]
});
If you were using low temperature for deterministic outputs, the replacement is using low effort level, which produces more consistent results with less exploration.
What changed: Setting thinking: {type: "enabled", budget_tokens: N} returns a 400 error.
Why: Sonnet 5 uses adaptive thinking that automatically adjusts based on task complexity. Instead of specifying a fixed token budget for reasoning, you set an effort level and the model allocates thinking tokens as needed.
Migration:
// Before (Sonnet 4.6)
const response = await anthropic.messages.create({
model: "claude-sonnet-4-6",
thinking: { type: "enabled", budget_tokens: 10000 },
messages: [{ role: "user", content: "..." }]
});
// After (Sonnet 5) - use effort parameter
const response = await anthropic.messages.create({
model: "claude-sonnet-5",
thinking: { type: "enabled", effort: "high" },
messages: [{ role: "user", content: "..." }]
});
The effort values are: low, medium, high (default), max, and xhigh.
Newsletter
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools, delivered free every week.
From the archive
Jul 4, 2026 • 8 min read
Jul 4, 2026 • 8 min read
Jul 4, 2026 • 9 min read
Jul 4, 2026 • 8 min read
What changed: On Sonnet 4.6, requests without a thinking field ran without thinking. On Sonnet 5, the same requests run with adaptive thinking at high effort by default.
Impact: Your existing prompts will use more tokens and potentially produce different outputs. This is usually an improvement, but it changes behavior.
To disable thinking entirely:
const response = await anthropic.messages.create({
model: "claude-sonnet-5",
thinking: { type: "disabled" },
messages: [{ role: "user", content: "..." }]
});
To match Sonnet 4.6 behavior more closely: Use medium effort, which Anthropic says is comparable to Sonnet 4.6 at high effort.
Sonnet 5's key feature is selectable reasoning effort. Instead of controlling thinking with a token budget, you set a semantic effort level.
| Effort | Use Case | Cost | Default |
|---|---|---|---|
low | Simple classification, quick lookups, high-volume tasks | Lowest | No |
medium | Cost-saving step-down, comparable to Sonnet 4.6 at high | Low-Medium | No |
high | Complex reasoning, coding, agentic tasks | Medium | Yes |
max | Maximum quality for difficult problems | High | No |
xhigh | Advanced coding, complex agentic work requiring extended exploration | Highest | No |
Using effort in the API:
const response = await anthropic.messages.create({
model: "claude-sonnet-5",
thinking: { type: "enabled", effort: "xhigh" },
max_tokens: 16000, // Leave headroom for thinking
messages: [{ role: "user", content: "Debug this failing test..." }]
});
Important: At high, xhigh, or max effort, leave headroom in max_tokens so the model has room for thinking and tool calls.
Use low when:
Use medium when:
Use high (default) when:
Use xhigh when:
Use Opus 4.8 instead when:
xhigh and costs are approaching Opus anywaySonnet 5 uses an updated tokenizer. The same input text produces approximately 1.0-1.35x more tokens than Sonnet 4.6, depending on content type.
Practical impact:
Migration steps:
max_tokens limits sized close to expected output length| Benchmark | Sonnet 5 | Sonnet 4.6 | Opus 4.8 |
|---|---|---|---|
| SWE-Bench Verified | 85.2% | 72.1% | 91.6% |
| SWE-Bench Pro | 63.2% | 58.1% | 73.5% |
| Terminal-Bench 2.1 | 80.4% | 67.0% | 74.6% |
| OSWorld-Verified | 81.2% | 78.5% | 87.3% |
Sonnet 5 at 80.4% on Terminal-Bench 2.1 beats Opus 4.8's 74.6% - the first time a Sonnet model has outperformed its Opus sibling on a major coding benchmark.
| Period | Input ($/MTok) | Output ($/MTok) |
|---|---|---|
| Now through Aug 31, 2026 | $2 | $10 |
| After Aug 31, 2026 | $3 | $15 |
The introductory pricing combined with the tokenizer change means:
Here's a full before/after showing all three breaking changes:
// Before: Sonnet 4.6 with all deprecated features
const response = await anthropic.messages.create({
model: "claude-sonnet-4-6",
temperature: 0.3,
thinking: { type: "enabled", budget_tokens: 8000 },
max_tokens: 4000,
messages: [{
role: "user",
content: "Review this PR and suggest improvements..."
}]
});
// After: Sonnet 5 with equivalent intent
const response = await anthropic.messages.create({
model: "claude-sonnet-5",
thinking: { type: "enabled", effort: "high" },
max_tokens: 8000, // Increased for thinking headroom
messages: [{
role: "user",
content: "Review this PR and suggest improvements..."
}]
});
Sonnet 4.6 remains available. Consider staying on it if:
temperature, top_p, top_k) for your use caseAnthropic hasn't announced an EOL date for Sonnet 4.6 yet.
The model ID is claude-sonnet-5. Use this in API calls to specify the model. The previous model ID claude-sonnet-4-6 continues to work for Sonnet 4.6.
Yes, but not manually. Sonnet 5 uses adaptive thinking controlled by the effort parameter (low, medium, high, max, xhigh). Setting a manual budget_tokens returns a 400 error. The model automatically allocates thinking tokens based on the effort level and task complexity.
Sonnet 5 has a 1M-token context window and 128K max output tokens. There is no long-context pricing premium - the same per-token rates apply regardless of context length.
The same text maps to approximately 1.0-1.35x more tokens with Sonnet 5's tokenizer compared to Sonnet 4.6. Anthropic set introductory pricing to be "cost-neutral" overall, but your actual cost change depends on your content type and effort level.
Yes. Sonnet 5 is now the default model in Claude Code with a native 1M-token context window. Interactive Claude Code in the terminal uses your subscription limits; programmatic usage (Agent SDK, claude -p) draws from the API credit pool.
August 31, 2026. After that date, pricing moves from $2/$10 per MTok to $3/$15 per MTok.
Use Sonnet 5 at low/medium effort for high-volume, well-scoped tasks where cost matters. Use Opus 4.8 for complex, open-ended tasks or when you need maximum capability. At xhigh effort, Sonnet 5 costs approach Opus 4.8 while performing slightly worse on several benchmarks - at that point, Opus is often the better choice.
Yes. Pass thinking: { type: "disabled" } to turn off adaptive thinking entirely. This produces simpler, faster responses but loses the reasoning capability.
Read next
Anthropic releases Claude Sonnet 5 with improved agentic capabilities, better tool use, and an introductory pricing deal. Here's what developers need to know.
6 min readClaude Sonnet 5 lands near Opus 4.8 on some tasks for a fraction of the price - but a new tokenizer runs about 30 percent more tokens. Here is the upgrade decision for builders, with the numbers.
6 min readOpus 4.7 is here. Sharper coding, longer agentic runs, better tool use, and a price that finally makes Opus livable for production. Here's everything devs need to know.
10 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Anthropic's AI. Opus 4.6 for hard problems, Sonnet 4.6 for speed, Haiku 4.5 for cost. 200K context window. Best coding m...
View ToolAnthropic's smallest Claude 4.5 model. Near-frontier coding performance at one-third the cost of Sonnet 4 and up to 4-5x...
View ToolAnthropic's recommended default for complex work, released May 28, 2026. 1M context, 128K output, $5/$25 per million tok...
View ToolAnthropic's flagship reasoning model. Best-in-class for coding, long-context analysis, and agentic workflows. 1M token c...
View ToolEvery coding agent in one window. Stop alt-tabbing between Claude, Codex, and Cursor.
View AppTurn a one-liner into a working Claude Code skill. From idea to installed in a minute.
View AppUnlock pro skills and share private collections with your team.
View AppLow, medium, high, xhigh, and max for adaptive reasoning control.
Claude CodeUse opus, sonnet, haiku, and best to switch models easily.
Claude CodeHybrid mode: Opus for planning, Sonnet for execution.
Claude Code
To learn for free on Brilliant, go to https://brilliant.org/DevelopersDigest/ . You’ll also get 20% off an annual premium subscription TOOLS I USE → Wispr Flow (voice-to-text): https://dub.sh/...

In this video, I dive into an in-depth comparison between the latest AI models GPT-4.5 and Claude 3.7 Sonnet. 📊 You'll learn about the strengths and weaknesses of each model, as well as...

In this video, I demonstrate Claude Code, a tool by Anthropic currently in limited research preview. This enables developers to delegate tasks directly from the terminal. I walk through installatio...

Anthropic releases Claude Sonnet 5 with improved agentic capabilities, better tool use, and an introductory pricing deal...

Claude Sonnet 5 lands near Opus 4.8 on some tasks for a fraction of the price - but a new tokenizer runs about 30 percen...

Anthropic's Claude Science combines scientific tools, local code execution, and HPC integration into one AI workbench. H...

Anthropic's most capable model launched, got suspended by a US export-control order, and returned today. Here is what Fa...

Anthropic shipped two names for one architecture on June 9, 2026. Here is what separates Fable 5 from Mythos 5, who can...

Anthropic's Claude Haiku 4.5 delivers Sonnet 4-level coding performance at one-third the cost and twice the speed. Here...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.