Skip to main content
TokenCost logoTokenCost

Best LLM for Claude Code

Find the best Claude model for Claude Code based on coding capability, agentic performance, and cost per session, from Haiku 4.5 up to Fable 5.

Claude Code is Anthropic's agentic coding CLI that works directly from your terminal. It runs Anthropic's Claude models, and as of July 2026 the lineup spans four price tiers: Haiku 4.5 at $1/$5 per million tokens, Sonnet 5 at $3/$15 (with introductory $2/$10 pricing through August 31), Opus 4.8 at $5/$25, and Fable 5 at $10/$50. You can switch tiers mid-session with the /model command, so the real question is not which model to commit to but which tier to use for which kind of work.

Agentic coding is especially demanding: the model needs to maintain context across multi-step file edits, tool calls, and iterative debugging without losing track. It is also token-heavy, so the gap between a $1/$5 model and a $10/$50 model compounds quickly. A session that reads 100K tokens of code and writes 10K tokens of edits costs about $0.15 on Haiku 4.5, $0.45 on Sonnet 5 at standard pricing, $0.75 on Opus 4.8, and $1.50 on Fable 5, before prompt caching discounts.

We ranked the current Claude models by their effectiveness in real Claude Code workflows, considering agentic task completion, SWE-bench scores, context handling, output limits, and cost per session. Benchmark numbers below are vendor-reported where noted, so treat small gaps as ties.

Top Models for Claude Code in 2026

#1
Claude Opus 4.8
Anthropic
Best for Claude CodeBoth suites · 86.8
In: $5/1M
Out: $25/1M
Ctx: 1.0M

The best default for serious Claude Code work. Opus 4.8 scores 88.6 on SWE-bench Verified and 69.2 on SWE-bench Pro, with a full 1M context window and 128K max output for large refactors. A new Fast mode ($10/$50 at roughly 2.5x speed, via /fast in Claude Code) is worth it when iteration latency is the bottleneck. Cache hits at $0.50/MTok keep long sessions affordable.

#2
Claude Sonnet 5
Anthropic
Best valueBoth suites · 83.1Non-default tier
In: $2/1M
Out: $10/1M
Ctx: 1.0M

Launched June 30 and arguably the best value in the lineup right now: introductory $2/$10 pricing runs through August 31, 2026, then $3/$15. Sonnet 5 scores 85.2 on SWE-bench Verified and is statistically tied with Opus 4.8 on GDPval-AA Elo (1618 vs 1615), with the same 1M context and 128K output. One honest caveat: its new tokenizer counts roughly 30% more tokens for the same text than Sonnet 4.6, so per-token comparisons flatter it slightly less than the sticker price suggests.

#3
Claude Fable 5
Anthropic
Terminal-Bench only · 84.6
In: $10/1M
Out: $50/1M
Ctx: 1.0M

Anthropic's most capable widely released model, with Anthropic-reported scores of ~95 on SWE-bench Verified and ~80 on SWE-bench Pro. At $10/$50 it costs exactly 2x Opus 4.8, and access has been bumpy: after a free launch window in June it was pulled on capacity and redeployed in mid-July behind metered usage credits. It also requires 30-day data retention (no zero-data-retention option). Reach for it on the hardest debugging and architectural work; for most sessions Opus 4.8 is close enough at half the price.

#4
Claude Opus 4.7
Anthropic
Terminal-Bench only · 83.1Non-default tier
In: $5/1M
Out: $25/1M
Ctx: 1.0M

Superseded by Opus 4.8 on May 28 at the same $5/$25 price, so there is little reason to pick it for new work. It remains a capable model with the same 1M context, and it shares the current tokenizer, so choose it only if you need its specific behavior for reproducibility or compatibility.

#5
Claude Sonnet 4.6
Anthropic
Terminal-Bench only · 71.2Non-default tier
In: $3/1M
Out: $15/1M
Ctx: 1.0M

The previous daily driver, still priced at $3/$15 but limited to a 200K context and 64K output. Its older tokenizer counts fewer tokens for the same code than Sonnet 5's, which narrows the effective price gap a little, but Sonnet 5's intro pricing ($2/$10 through August 31) and stronger benchmarks make the upgrade straightforward for most users.

#6
Claude Haiku 4.5
Anthropic
Lowest priceNo published score
In: $1/1M
Out: $5/1M
Ctx: 200K

The cheapest Claude Code option at $1/$5. Haiku 4.5 handles simple edits, file generation, and quick fixes well, and it is fast. Its limits show on bigger jobs: a 200K context window (versus 1M for the tiers above) and an 8K max output make it a poor fit for large file rewrites or long agentic loops. Use it for routine tasks and step up to Sonnet 5 when it starts thrashing.

How We Ranked These Models

Order is computed, not hand-picked. Each model is scored on the published pass-rate suites it has (SWE-bench Verified 0.55, Terminal-Bench 2.1 0.45), renormalised over the suites present, then charged 1 quality point for every doubling of its blended price (3:1 input-to-output tokens). Models with no published score are never given one: they are listed after every scored model, ordered by context window, and labelled as unscored. Claude Code runs Anthropic models only, so the field is restricted to Anthropic. It is a terminal agent, so Terminal-Bench 2.1 is weighted close to SWE-bench Verified (0.45 against 0.55). Price is nearly irrelevant to the order because switching tiers mid-session with /model is free. See the full ranking method.

Agentic Task Completion
How reliably the model completes multi-step coding tasks autonomously, including file edits, command execution, and iterative debugging in Claude Code's agentic loop.
Coding Benchmarks
Performance on SWE-bench Verified, SWE-bench Pro, and Terminal-Bench, which measure real-world code generation, bug fixing, and terminal-driven agentic work.
Cost per Session
Total token cost for typical Claude Code sessions (50K-200K tokens). Agentic workflows are token-heavy, so per-token pricing and cache-hit rates matter more than single-turn use.
Context Window & Output Limits
How much code the model can see at once and how much it can write in one pass. The current 1M-context tiers handle large repos; Haiku's 200K context and 8K output cap it to smaller tasks.

Frequently Asked Questions