Claude Code Model Selection: Use the Right AI for Every Task
Aliases, Not Model IDs
Claude Code lets you reference models by alias instead of full API ID. The aliases stay stable as Anthropic ships new versions, which means your scripts and slash commands keep working without code changes when the underlying model updates.
| Alias | Resolves To | When to Use |
|---|---|---|
default | Account default (usually Sonnet 4.6) | Most tasks — let Claude Code decide |
sonnet | Latest Sonnet (4.6 today) | Daily driver for writing code, tests, refactors |
opus | Latest Opus (4.7 today) | Complex reasoning, hard debugging, architecture |
haiku | Latest Haiku (4.5 today) | Review, formatting, log analysis, fast utility tasks |
sonnet[1m] | Sonnet 4.6 with 1M context window | Large codebases that need the full window loaded |
opusplan | Opus for planning, Sonnet for execution | Multi-file refactors, architectural changes, agent design |
The Smart Routing Strategy
Default to Sonnet 4.6 for everything. It handles the bulk of real development work at a third of the cost of Opus and runs faster end to end. Escalate to opus when you hit a genuinely hard problem — a bug that does not match any obvious pattern, an architecture decision with multiple competing constraints, or a refactor that touches the structure of the system.
Reach for opusplan when the task has a clear planning phase followed by mechanical execution. The Opus model maps out the change, then Sonnet does the file edits. You get reasoning depth where it matters without paying Opus rates on the bulk of the token spend.
Use haiku for the unglamorous work: reviewing diffs, parsing log files, formatting JSON, drafting commit messages, scanning for obvious issues. Haiku 4.5 at $1/$5 per million tokens is so cheap that the cost vanishes from your bill — but it is sharp enough to catch real problems.
Cost Comparison by Routing Strategy
| Strategy | Effective $/Mtok Input | Relative Cost |
|---|---|---|
| All Opus 4.7 | $5.00 | 1.00x (baseline) |
| All Sonnet 4.6 | $3.00 | 0.60x |
| Smart mix (80% Sonnet, 15% Opus, 5% Haiku) | $3.20 | 0.64x |
| Aggressive (60% Haiku, 35% Sonnet, 5% Opus) | $1.90 | 0.38x |
Going from all Opus to smart routing saves about 36 percent. Going aggressive with Haiku for utility work saves over 60 percent. The quality of the work does not drop because each task is going to a model that handles it well.
Tactical Commands
# Start a session pinned to a specific model
claude --model sonnet
claude --model opus
claude --model haiku
# Switch mid-session
/model sonnet
/model haiku
/model opus
# Use the 1M context Sonnet variant
claude --model 'sonnet[1m]'
# Plan with Opus, execute with Sonnet
claude --model opusplan
Routing by Task Type
| Task | Recommended Model |
|---|---|
| Writing a new function or test | Sonnet 4.6 |
| Debugging a tricky issue across files | Opus 4.7 |
| Reviewing a pull request diff | Haiku 4.5 |
| Multi-file refactor | opusplan |
| Reading a 500K-token codebase | sonnet[1m] |
| Drafting a commit message | Haiku 4.5 |
| Architecture or schema design | Opus 4.7 |
| Generating test data | Haiku 4.5 |
The Discipline
The developers who get the most out of Claude Code are not the ones paying for the most expensive model. They are the ones who picked the right model for each task. The savings are real and the quality difference is invisible — because each piece of work landed at a model that handled it well.
Get Started with Claude Code
Start building with Claude Code today. Free to download, powerful enough for production.