The short answer
There is no single best Claude model for coding. Anthropic ships a fleet you route between, and the right pick depends on how hard the task is, how much latency you can tolerate, and how many times you plan to run it. Default to Sonnet 5, escalate hard agentic work to Opus 5, push high-volume steps to Haiku 4.5, and keep Fable 5 for the very hardest long-horizon jobs. The better question is "which model is best for this task?"
Which Claude model is best for coding? (quick recommendation)
Start with the table. It maps coding tasks to a recommended model by urgency and volume.
| Coding task | Recommended model | Why |
|---|---|---|
| Feature work, generation, tests, debugging | Sonnet 5 | Best speed + intelligence |
| Complex agentic coding, large refactors, long runs | Opus 5 | Deep reasoning, long horizon |
| High-volume checkable steps (PR triage, routing) | Haiku 4.5 | Fastest, lowest price |
| Hardest capability ceiling | Fable 5 | Top capability; Opus 5 usually wins economics |
Read it as a default-and-escalate ladder. Sonnet 5 is the everyday default; move up to Opus 5 when the task rewards deeper reasoning, and drop to Haiku 4.5 for high volume or the lowest latency. Before you switch models, though, tune effort first. It's often a better lever than jumping to a bigger model.
The current Claude model lineup (2026)
The current first-party lineup, dated 2026-08-22:
| Model | In / Out $/MTok | Context / Max out | Latency | Cutoff |
|---|---|---|---|---|
Fable 5 claude-fable-5 | $10 / $50 | 1M / 128k | Slower | Jan 2026 |
Opus 5 claude-opus-5 | $5 / $25 | 1M / 128k | Moderate | May 2026 |
Sonnet 5 claude-sonnet-5 | $2 / $10 | 1M / 128k | Fast | Jan 2026 |
Haiku 4.5 claude-haiku-4-5 | $1 / $5 | 200k / 64k | Fastest | Feb 2025 |
The three big 5-generation models (Fable 5, Opus 5, and Sonnet 5) all default to a 1M-token context window; Haiku 4.5 is the only current model still at 200k. Opus 5's May 2026 knowledge cutoff is the most recent in the family, which is a real edge when you're coding against fast-moving frameworks.
Why Opus 4.8 and Sonnet 4.6 are legacy
If you're still on Opus 4.8, there's no cost reason to stay: Opus 5 lands at the same $5 / $25 per-MTok pricing shown in the table above. Any ranking that still lists Opus 4.8 as the flagship just hasn't been updated. Name the 5-generation models when you pick, and migrate anything pinned to 4.x.
Sonnet 5 vs Opus 5 for coding
Sonnet 5 is the drop-in everyday default: a capability upgrade over Sonnet 4.6 at a lower price, with its biggest gains in coding and agentic tasks. Reach for Opus 5 when the task rewards deeper reasoning.
Where Opus 5 pays for itself
Opus 5 is a real step up from Opus 4.8 in deep reasoning and long-horizon coding: multi-file features and larger refactors without leaving stubs, stronger code review and bug-finding, long agent loops, and test-time-compute scaling. Opus 5 also self-verifies, so drop any carried-over "verify twice" instructions. They just waste tokens.
Where Fable 5 fits
Fable 5 leads on the hardest long-horizon work, but for coding the economics favor Opus 5. On Anthropic's own SWE-bench Pro subset (a non-leaderboard subset, not the public benchmark), Opus 5 alone matched Fable 5 alone, 91.7% versus 91.3%, which is inside run-to-run noise, and it did so at about 60% of the cost.
The effort parameter and the xhigh migration trap
The effort parameter trades intelligence for latency and cost within one model. It has five levels (low, medium, high, xhigh, max) and the API default is high. Here's the trap: Opus 4.7 and 4.8 recommended starting at xhigh, but Opus 5 recommends starting at high and stepping up only when a task justifies it. Teams that pinned xhigh and swapped the model ID overspend for no measured gain, so re-run a fresh effort sweep whenever you migrate.
A few 5-generation API details:
- On Opus 5, thinking is on by default, and
thinking: {"type": "disabled"}returns a 400 atxhigh/max. Set a largemax_tokens(~64k) so the model has room to act. - Hold effort constant within a session — changing it mid-session invalidates the prompt cache.
- On Sonnet 5, manual extended thinking and non-default sampling params return 400s; use adaptive thinking with
effort. - Sonnet 5's new tokenizer counts about 30% more tokens for the same text, so recount rather than reusing old counts.
Where Haiku 4.5 (the fastest model) wins
Haiku 4.5 is the fastest model in the lineup, with near-frontier intelligence and the lowest price. When someone asks for the cheapest Claude model that still codes well, this is the answer.
It's at its best on high-volume work with checkable outputs: PR review at scale, classification, routing, and cheap sub-steps inside a larger agent. The honest limit is that it falls behind on long agentic coding loops, so keep it to bounded, verifiable steps and escalate the hard decisions. That matches Anthropic's efficiency-first approach: start here and upgrade only when you hit a specific, measured capability gap.
A latency-aware escalation policy you can copy
A reusable two-stage routing policy you can lift into a runbook:
- Default checkable work to Sonnet 5 or Opus 5 at
loweffort. - Re-run only the failures at the default
higheffort. - Escalate hard decisions to a higher-intelligence advisor model.
- Push bulk, independent work to cheaper workers or Haiku 4.5.
- Measure cost per completed task, not per token.
Figure 1: Latency-aware escalation policy
Advisor and orchestrator routing
Anthropic documents two multi-model patterns. In the advisor pattern, a lower-cost executor runs the loop and escalates hard decisions to a higher-intelligence advisor; the catch is that a low-effort executor can stop asking, so watch the consult rate. In the orchestrator pattern, a frontier model holds the loop and hands bulk independent work to cheaper workers, which pays off when work fans across many files or spills past one context window. One constraint to know about: task budgets (beta) exist on Opus 5, Fable 5, Opus 4.8, and 4.7, but not Sonnet 5.
Run at low effort, re-run failures higher
When outcomes are checkable, meaning you have tests or a verifier, run everything at low first and re-run only the failures at the default. On Anthropic's SWE-bench Pro subset this reached about 93% passing for roughly $0.70 per task, versus 91.7% for $1.39 running everything at the default. Roughly the same pass rate at about half the cost, and you pay for it in latency on the failures.

Cost per completed task, not per token
This is the decision unit for the whole guide: a capable model that finishes in fewer turns beats its per-token premium. See cost per completed task for the fuller framing. Two free levers cut cost: prompt caching (reads at 0.1x input) and the Batch API (50% off for work that can wait 24 hours). If routing is tangled up with plan limits, the sibling guide to check Claude usage limits owns that detail.
Run the same-harness model experiment
The cleanest way to settle a routing decision is a controlled experiment: run the identical task in the same coding-agent harness against different models, then compare cost per completed task and latency.
The Fast fast CLI helps here because it keeps your existing harness and routes its model calls to a separately billed catalog model. To be precise about what that means: it's "same harness, different model," not a quota increase and not acceleration of an unchanged proprietary model. The default routed catalog model is glm-5.2.
# 1. Install the Fast CLI and sign in.
# New accounts start with a $26 welcome credit, so there is room to run the comparison first.
npm install -g @inference/fast
fast login
# 2. Route Claude Code to a chosen catalog model.
# `on` maps Claude Code's six model slots to one callable model (default glm-5.2),
# backs up your original ~/.claude/settings.json, then restart Claude Code.
CATALOG_ID=glm-5.2
fast claude on --model "$CATALOG_ID"
# 3. Verify the live route. Start a new Claude Code session and send a short prompt;
# the request appears under the Usage dashboard at /dashboard/usage.
fast claude status
# 4. Restore your original settings byte-for-byte when the experiment is done.
fast claude offInstall and sign in with npm install -g @inference/fast then fast login. fast claude on --model <catalog-id> maps Claude Code's six model slots to one callable catalog model, backing up your original settings first. Verify the live route under the Usage dashboard at /dashboard/usage, then restore byte-for-byte with fast claude off. New accounts start with $26 in free credit.
For how the six slots map, see how to connect Claude Code to Fast; the fast CLI commands reference covers install, login, and on/off/status. And if you're chasing a slow agent rather than a model choice, the sibling guide to diagnose Claude Code slowness owns that.
Run Claude Code on Fast Inference
Keep the Claude Code harness, route model traffic to a selected Fast model, and restore your original settings with fast claude off.
See the Claude Code guideRelated reading
- Run Claude Code on Fast Inference — connect Claude Code, choose a model, verify the route.
- Inference Economics — the cost-per-completed-task argument in full.
- Codex Usage and Limits — sibling that owns usage-meter and limit detail.
References
- Claude models overview [C-001][C-002][C-003][C-004][C-005][C-006][C-008]
- Choosing the right model [C-007][C-010]
- Optimizing for cost and intelligence [C-015][C-016][C-017][C-018]
- What's new in Opus 5 [C-011]
- What's new in Sonnet 5 [C-013][C-014]
- Best Claude Model for Coding in 2026 [C-009]
- Fast Inference docs — Claude Code integration,
fastCLI [C-019][C-020][C-021][C-022][C-023][C-024]