
The best Claude model for coding in 2026 is Claude Opus 5 for hard agentic engineering and Claude Sonnet 5 for everyday development. Anthropic's own guidance is explicit: start with Claude Opus 5 for complex agentic coding and enterprise work, and reach for Claude Fable 5 only when you need the highest available capability. Sonnet 5 remains the model most developers should live in day to day, because it now costs $2 per million input tokens and $10 per million output tokens, a fifth of Opus 5's output price. This guide covers the current lineup, what changed when Opus 5 shipped in July 2026, the effort setting most teams get wrong, and how to route work so you are not overpaying.
Quick Answer
- Best for hard agentic coding: Claude Opus 5 (
claude-opus-5). Anthropic's recommended starting point for complex agentic coding, released July 24, 2026. - Best everyday default: Claude Sonnet 5 (
claude-sonnet-5). Near-frontier coding quality at $2 / $10 per million tokens, now the permanent price. - Best for maximum capability: Claude Fable 5 (
claude-fable-5), at $10 / $50 per million tokens. Slower and five times Opus 5's output cost. - Best for volume and latency: Claude Haiku 4.5 at $1 / $5 per million tokens. Code review, classification, routing, cheap agent sub-steps.
- Opus 4.8 is now legacy. If you are still on it, Anthropic publishes a migration path to Opus 5, and your carried-over
effortsettings need re-testing. - To ship the result, not just generate it: build the app on Totalum, an AI app builder that produces a real, deployable Next.js application with auth, database, payments, and hosting already wired in.
The Claude models for coding in 2026
Anthropic's models overview splits the lineup into current models and legacy models. That split matters, because most roundups still rank models that Anthropic has moved into the legacy table.
The current models, with their API IDs:
- Claude Opus 5 (
claude-opus-5): built for complex agentic coding and enterprise work. This is the model Anthropic tells you to start with if you are unsure. Released July 24, 2026. - Claude Sonnet 5 (
claude-sonnet-5): the best combination of speed and intelligence, and the cheapest of the frontier tier by a wide margin. - Claude Fable 5 (
claude-fable-5): Anthropic's most capable widely released model, generally available since June 9, 2026. Adaptive thinking is always on and latency is the highest of the family. - Claude Haiku 4.5 (
claude-haiku-4-5): the fastest model with near-frontier intelligence, and the only current model still on a 200k context window. - Claude Mythos 5 (
claude-mythos-5): shares Fable 5's specs and pricing but is invitation-only through Project Glasswing, scoped to defensive cybersecurity workflows. There is no self-serve signup, so it is not a practical choice for general coding.
The legacy table now contains Claude Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Opus 4.5. They still run, and Anthropic still bills them, but it recommends migrating to current models for better performance.
That is the single biggest change since the start of 2026. If your model policy was written around "Opus 4.8 is the flagship," it is out of date: Opus 5 more than doubles Opus 4.8's score on Frontier-Bench v0.1 at a lower cost per task, according to Anthropic's Opus 5 announcement.
Claude model comparison for coding
| Model | Input / output per MTok | Context | Max output | Knowledge cutoff | Best for |
|---|---|---|---|---|---|
| Claude Opus 5 | $5 / $25 | 1M | 128k | May 2026 | Complex agentic coding, large refactors, long autonomous runs |
| Claude Sonnet 5 | $2 / $10 | 1M | 128k | Jan 2026 | Everyday feature work, bug fixing, interactive pair programming |
| Claude Fable 5 | $10 / $50 | 1M | 128k | Jan 2026 | The hardest long-horizon work where cost is not the constraint |
| Claude Haiku 4.5 | $1 / $5 | 200k | 64k | Feb 2025 | PR review at scale, classification, routing, cheap sub-steps |
| Claude Opus 4.8 (legacy) | $5 / $25 | 1M | 128k | Jan 2026 | Nothing new. Migrate to Opus 5 at the same price |
Prices are from Anthropic's pricing page as of August 2026. The Batch API takes 50% off both input and output on every model in the table, which puts Opus 5 batch work at $2.50 / $12.50.
Two pricing details are worth pinning down, because a lot of published comparisons get them wrong.
Sonnet 5's $2 / $10 is now permanent. It launched as introductory pricing scheduled to end August 31, 2026, with a rise to $3 / $15 on September 1. Anthropic has since confirmed that the increase will not happen and that $2 / $10 is the standard price. Any article telling you to budget for a September price rise on Sonnet 5 is stale.
Opus 5 and Opus 4.8 cost exactly the same. Both are $5 / $25. There is no cost argument for staying on Opus 4.8, which is the clearest signal that the legacy tier is a migration target rather than a value option.
Which Claude model is best for coding? Decide by task
The right model is a function of three questions: how hard is the task, how fast do you need the answer, and how many times will you run it. Mapping task types to tiers is faster than agonising over benchmark tables.
| Coding task | Recommended model | Why |
|---|---|---|
| Build a new feature end to end | Sonnet 5 | Best speed-to-quality ratio, and 2.5x cheaper than Opus 5 |
| Refactor across a large codebase | Opus 5 | Purpose-built for complex agentic coding over many files |
| Debug a subtle, cross-layer issue | Opus 5 | Deeper multi-step reasoning finds root causes |
| Write unit tests, fix routine bugs | Sonnet 5 | Fast and accurate on well-scoped work |
| Long autonomous agent session | Opus 5 at xhigh |
Designed for long-horizon agentic runs |
| Automated PR review at scale | Haiku 4.5 | Cheapest per call, fastest response |
| Classify or route agent inputs | Haiku 4.5 | Sub-second, $1 / $5 per MTok |
| Work against very recent libraries | Opus 5 | May 2026 knowledge cutoff, the most recent in the family |
| A frontier problem where budget is irrelevant | Fable 5 | Most capable widely released model |
That last row deserves a caveat. Fable 5 costs five times Opus 5 on output, and Anthropic's own launch data puts Opus 5 at maximum effort within 0.5% of Fable 5's peak CursorBench 3.2 score, at half the cost per task. For coding specifically, Opus 5 is the better economic choice in almost every case.
The knowledge-cutoff row is underrated. Opus 5's reliable knowledge runs through May 2026, while Sonnet 5 and Fable 5 stop at January 2026 and Haiku 4.5 at February 2025. When you are working against a fast-moving framework, the model with the newer cutoff hallucinates fewer deprecated APIs. That is a concrete coding advantage, not a spec-sheet footnote.
Opus 5 vs Sonnet 5 for coding
This is the real decision for most teams, so treat it as a routing problem rather than a winner-takes-all comparison.
Sonnet 5 is the default. It shares Opus 5's 1M context window and 128k max output, runs faster, and costs 2.5x less on both input and output. For feature building, test writing, routine bug fixing, and interactive work, it is the model you should be in most of the day.
Opus 5 is the escalation. Reach for it when a task would take a strong human engineer sustained focus: multi-file refactors, tracing a bug through several layers, architecture work, or an agent running autonomously for a long stretch. It also has the newer knowledge cutoff.
A practical policy that holds up:
- Route all interactive development to Sonnet 5 at default
higheffort. - Escalate to Opus 5 when Sonnet 5 visibly struggles, needs several retries, or the task spans many files.
- Push high-volume, low-complexity operations down to Haiku 4.5.
- Use the Batch API for anything that does not need an answer now, and take the 50% discount.
- Re-check the split every few weeks. Both the models and your workload move.
The cost impact is straightforward arithmetic. Running everything on Opus 5 costs 2.5x what the same token volume costs on Sonnet 5. Routing the routine 80% of work to Sonnet 5 and reserving Opus 5 for the hard 20% cuts a large share of that premium without giving up capability where it matters.
If you have settled on the Opus tier and want the single-model reference, our full guide to Claude Opus 5 covers its exact specs, effort guidance and the three migration traps that break code carried over from Opus 4.8.
The effort parameter: the setting most teams get wrong
Anthropic's effort parameter controls how many tokens Claude spends on a response, including thinking and tool calls. There are five levels: low, medium, high, xhigh, and max. The API default is high on every model, and passing high is identical to omitting the parameter.
Here is the trap. The recommended starting point changed between generations, and carrying old settings forward is a real mistake.
- On Opus 4.7 and Opus 4.8, Anthropic said to start at
xhighfor coding and agentic use cases. - On Opus 5, the guidance is to start with
high, the default, then step up toxhighfor demanding coding and agentic work, ormaxwhen a task justifies unconstrained spending.
Anthropic states the migration rule directly: if you carried effort settings over from an earlier model, run a fresh effort sweep on your evals rather than reusing them. Teams that pinned xhigh globally on Opus 4.8 and then swapped the model ID to Opus 5 are very likely overspending on tokens for no measured quality gain.
Three more Opus 5 specifics worth knowing before you tune:
- Thinking cannot be disabled at
xhighormax. Requests that setthinking: {"type": "disabled"}at those levels return a 400 error. - Effort does not reliably shorten responses on Opus 5. It controls thinking volume, not visible output length. If you want shorter answers, prompt for length instead of lowering effort.
- Set a large
max_tokensatxhighormax. Anthropic suggests starting around 64k so the model has room to think and act across tool calls and subagents.
Sonnet 5 supports xhigh too, which older Sonnet releases did not. One useful calibration point: Sonnet 5 at medium effort is comparable to Sonnet 4.6 at high. If you migrated from Sonnet 4.6 and kept high, you may be able to step down to medium and hold quality while cutting token spend.
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5",
"max_tokens": 65536,
"messages": [{"role": "user", "content": "Refactor this module."}],
"output_config": {"effort": "xhigh"}
}'
One caching caveat: effort shapes the rendered prompt, so changing it between requests invalidates cached prefixes. Pick a level at the start of a long session and hold it constant, and vary effort across workloads instead of inside one cached conversation.
What the coding benchmarks tell you, and what they miss
Be careful here, because this is where secondhand articles invent numbers. For the Claude 5 generation, Anthropic's Opus 5 announcement reports results on Frontier-Bench v0.1, CursorBench 3.2, and the AA Coding Agent Index. It does not publish granular SWE-bench Verified or SWE-bench Pro figures for Opus 5. If you see a precise SWE-bench Pro percentage for Opus 5 in a blog post, it did not come from Anthropic's launch material, so treat it as unverified.
What Anthropic does report is directional and useful:
- On Frontier-Bench v0.1, Opus 5 surpasses all other models and more than doubles Opus 4.8's performance, at a lower cost per task.
- On CursorBench 3.2 at maximum effort, Opus 5 lands within 0.5% of Fable 5's peak score at half the cost per task.
Benchmarks are a useful floor, not the whole story. Three things they consistently miss:
- Agentic behaviour over long sessions. A benchmark task is bounded. Real work is an agent editing dozens of files across a long run, where holding context and not drifting matters more than a single-shot score.
- Latency and throughput. A model that scores marginally higher but responds twice as slowly is the wrong choice for interactive coding or a high-volume pipeline.
- Fit to your codebase. Public benchmark repos are not your repo. The only test that fully counts is running the shortlist on your own tasks for a week.
Use published results to narrow the field to two candidates, then validate on real work before you standardise.
Context windows, tokenizers, and a hidden cost shift
Opus 5, Sonnet 5, and Fable 5 all carry a 1M token context window at standard pricing, with 128k max output. A 900k-token request is billed at the same per-token rate as a 9k-token request, so codebase-scale awareness no longer requires manual chunking. On the Batch API, Opus 5, Sonnet 5, and several legacy models support up to 300k output tokens using the output-300k-2026-03-24 beta header. Haiku 4.5 is the exception at 200k context and 64k output, which is fine for the short, scoped calls it is best at.
Now the detail almost nobody accounts for. Claude 4.7 and later models use a newer tokenizer that produces roughly 30% more tokens for the same text. Sonnet 4.6 and earlier use the previous tokenizer. That means a per-token price comparison across the generation boundary is not apples to apples: migrating from Sonnet 4.6 at $3 / $15 to Sonnet 5 at $2 / $10 is still a clear saving, but the effective gap is narrower than the sticker prices suggest, because the same source file counts as more tokens. Model your costs on measured token counts from your own traffic, not on price ratios alone.
Two other cost levers to know:
- Prompt caching charges a cache hit at 10% of the standard input price. A 5-minute cache write costs 1.25x base input, so caching pays off after a single read.
- Fast mode, in research preview, gives significantly faster output for Opus 5 and Opus 4.8 at $10 / $50 per MTok. It is available on the first-party Claude API only, and not on the Batch API.
Opus 4.8 and the legacy models: should you still use them?
For new work, no. Opus 4.8 sits at the same $5 / $25 as Opus 5 while scoring less than half of it on Frontier-Bench v0.1. Paying the same money for materially less capability is not a tradeoff, it is an oversight.
The honest reasons to stay on a legacy model are narrow: you have a pinned, heavily evaluated production prompt that you have not had time to re-validate, you depend on deprecated extended thinking behaviour, or a compliance process gates model changes. All three are scheduling problems rather than technical ones.
If you are planning a move, Anthropic publishes a migration guide for going from Opus 4.8 to Opus 5, and our own walkthrough of the Claude 4 deprecation and migration path covers the practical sequencing. Our earlier notes on Claude Opus 4.8 with Totalum and Claude Opus 4.7 remain useful background on how the previous generation behaved.
One migration warning worth repeating: change the model ID and re-run your effort sweep in the same cycle. Swapping to Opus 5 while keeping an xhigh default inherited from Opus 4.8 is the most common way teams end up with a bigger bill and conclude, wrongly, that the new model is more expensive.
Common mistakes when picking a Claude coding model
- Ranking a legacy model as the flagship. Opus 4.8 is in Anthropic's legacy table. Any 2026 shortlist that crowns it is describing a lineup that no longer exists.
- Running everything on the top tier. Paying Opus 5 or Fable 5 rates to classify inputs or review trivial diffs is waste. Route those to Haiku 4.5.
- Never escalating. The opposite error: forcing a hard multi-file refactor through a light model, then spending hours cleaning up.
- Reusing effort settings across a model migration. The recommended starting point moved from
xhighon Opus 4.8 tohighon Opus 5. Re-sweep instead of inheriting. - Comparing per-token prices across the tokenizer change. Claude 4.7 and later count roughly 30% more tokens for the same text.
- Quoting benchmark numbers Anthropic did not publish. Precise SWE-bench Pro figures for Opus 5 are not in the launch material.
- Standardising without testing. Locking a team onto one model before trying alternatives on real tasks leaves easy wins unclaimed.
From best model to shipped app
Choosing the best Claude model for coding solves one half of the problem: generating good code. The other half is turning that code into a running product with authentication, a database, payments, file storage, and a live URL. That is where most momentum is lost.
Totalum is an AI app builder that produces real, production-grade Next.js applications built on the TotalumSDK, with auth, database, payments, file storage, AI integrations, deployment, and custom domains included from the first prompt. You describe what you want and you get an owned, deployable app you can keep editing, not a throwaway prototype. Because the same builder is driven by prompt, API, and MCP, it fits into whichever Claude-powered workflow you already run.
If you are wiring a model into an autonomous loop, the Claude Agent SDK is how you give it tools in Python or TypeScript, and Claude Code subagents inherit the lead's model by default, so pinning Haiku 4.5 on triage subagents keeps cost predictable. To extend the model's reach, our roundup of the best MCP servers in 2026 covers what to install first, and Claude Code Skills turn a model into a repeatable specialist.
The client you run the model in matters as much as the model itself. Compare the options in Cline vs Cursor, Cursor vs Claude Code, and Gemini CLI vs Claude Code, and check Claude Code pricing in 2026 before you commit a team budget. If you are weighing Claude against open-weight coding models, our Kimi K2.7-Code vs Claude breakdown covers the cost and benchmark tradeoffs, and the best AI coding agents of 2026 surveys the wider field.
FAQ
What is the best Claude model for coding in 2026?
Claude Opus 5 for hard agentic engineering and Claude Sonnet 5 for everyday development. Anthropic recommends starting with Opus 5 for complex agentic coding, while Sonnet 5 gives you the same 1M context window and 128k max output at $2 / $10 per million tokens, 2.5x cheaper than Opus 5. Use Haiku 4.5 for high-volume, latency-sensitive work.
Is there a Claude Opus 5?
Yes. Claude Opus 5 (claude-opus-5) was released on July 24, 2026 and is Anthropic's recommended model for complex agentic coding and enterprise work. It costs $5 per million input tokens and $25 per million output tokens, the same as Opus 4.8, and it more than doubles Opus 4.8's Frontier-Bench v0.1 score at a lower cost per task.
Should I use Opus 5 or Sonnet 5 for coding?
Default to Sonnet 5 and escalate to Opus 5. Sonnet 5 handles feature work, tests, and routine bug fixing at 2.5x lower cost with faster responses. Move to Opus 5 for multi-file refactors, deep cross-layer debugging, architecture work, long autonomous agent runs, or when you need its more recent May 2026 knowledge cutoff.
Is Claude Opus 4.8 still the flagship coding model?
No. Anthropic has moved Opus 4.8 into its legacy models table alongside Opus 4.7, Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Opus 4.5. Opus 4.8 still runs and costs the same $5 / $25 as Opus 5, which means there is no pricing reason to stay on it for new work.
What effort level should I use for coding on Claude Opus 5?
Start with high, which is the default. Step up to xhigh for demanding coding and agentic work, and to max only when a task justifies unconstrained token spending. This differs from Opus 4.7 and Opus 4.8, where Anthropic recommended starting at xhigh. If you migrated from an earlier model, run a fresh effort sweep on your evals rather than reusing the old setting.
Does Fable 5 code better than Opus 5?
Fable 5 is Anthropic's most capable widely released model, but for coding the economics favour Opus 5. At maximum effort, Opus 5 lands within 0.5% of Fable 5's peak CursorBench 3.2 score at half the cost per task, and Fable 5 costs $10 / $50 per million tokens against Opus 5's $5 / $25. Reserve Fable 5 for frontier problems where budget is not a constraint.
Did Claude Sonnet 5 get more expensive in September 2026?
No. The $2 / $10 per million token pricing launched as introductory pricing through August 31, 2026, with a scheduled increase to $3 / $15 on September 1. Anthropic has confirmed that increase will not occur and that $2 / $10 is now the standard price.
When should I use Claude Haiku 4.5 for coding?
Use Haiku 4.5 when volume or latency matters more than depth: automated pull-request review, classification, routing, boilerplate generation, and cheap sub-steps inside an agent pipeline. It is $1 / $5 per million tokens, the fastest model in the family, and the only current model limited to a 200k context window and 64k max output.
How do I cut the cost of Claude coding workloads?
Four levers compound. Route the routine majority of work to Sonnet 5 and reserve Opus 5 for hard tasks. Use the Batch API for anything not needed immediately, which takes 50% off input and output. Enable prompt caching, where a cache hit costs 10% of the standard input price. And measure your actual token counts, because Claude 4.7 and later models use a tokenizer that produces roughly 30% more tokens for the same text.
Which benchmark should I trust for Claude coding models?
Read Anthropic's own launch material first. For Opus 5 that means Frontier-Bench v0.1, CursorBench 3.2, and the AA Coding Agent Index; Anthropic does not publish granular SWE-bench Verified or SWE-bench Pro figures for this release, so precise SWE-bench numbers in third-party posts are unverified. Use published results to shortlist two models, then validate on your own tasks.
Ready to build with Totalum?
Pick your Claude model for the code, then ship the whole application in one place. Totalum turns your idea into a real, deployable Next.js app with auth, database, payments, and hosting already wired in, and works alongside the AI models you prefer. Start building free at totalum.app.