Claude Code: Opus vs Sonnet vs Haiku, which model for which task

Downshift by Tiago Vilas Boas. Updated

Downshift here is a Go tool for AI coding agents, not the React downshift autocomplete library and unrelated to any car transmission.

TL;DR

Use Haiku for mechanical, checkable work, Sonnet for bounded fixes, and Opus for design across packages and anything touching auth, payments or secrets. At Anthropic's list prices Opus input costs 40 times Haiku's, so the mistake that costs most is running every subagent on Opus by default.

Opus vs Sonnet vs Haiku in Claude Code: what is the difference?

Claude Code exposes the three families as aliases. The model configuration docs describe opus as the latest Opus for complex reasoning, sonnet as the latest Sonnet for daily coding, and haiku as the fast, efficient model for simple tasks. On the Anthropic API those aliases resolve to Opus 5.5, Sonnet 5.5 and Haiku 5.5; on other providers they can point to older versions.

ModelAliasInput / MTokOutput / MTokCache hit / MTok
Claude Opus 5.5opus$4$20$0.20
Claude Sonnet 5.5sonnet$2$10$0.10
Claude Haiku 5.5, prompts up to 100,000 tokenshaiku$0.10$0.50$0.01
Claude Haiku 5.5, prompts over 100,000 tokenshaiku$0.50$2.50$0.05

Check which model the haiku alias runs in your version before you rely on these prices: on Claude Code 2.1.289 (observed 2026-10-15) it ran Claude Haiku 4.5, listed at $1 input and $5 output per MTok. The model a subagent actually used shows in /model and in the session view.

List prices in USD from Anthropic's pricing page, checked on 2026-10-24. They are API rates: on a Pro or Max plan you spend quota instead of dollars, and the ratio between models still tells you how fast a subagent drains it. Prices change; check the page before you budget.

Two ratios matter more than the absolute numbers. Opus input costs 2 times Sonnet's and 40 times Haiku's short-prompt rate. A subagent that reads a large tree pays mostly input, so the model it runs on decides most of its bill.

Which Claude Code model should I use for each task?

This table is a rule of thumb built from Anthropic's own alias descriptions and the risk policy Downshift ships with. It is not a benchmark: I have no quality score per model to show you, and I will not invent one.

Task typeExamplesModelWhy
Mechanical editsRename a symbol, fix typos, add doc comments, list files, read a logHaikuSmall scope and a result you can check with a test, a compiler or grep
Bounded fixesOne failing test, a bug inside one module, a small refactorSonnetAnthropic's default for most coding work, at half the Opus price
Design across packagesArchitecture, a migration plan, a refactor that crosses modulesOpusMulti-step reasoning where a wrong early choice costs more than the tokens
Risky areasAuth, payments, secrets, cryptography, personal data, destructive operationsOpus or your session model, never smallerA subtle mistake here costs far more than any token saving
Unclear request"Clean this up", "do the thing"Keep your session modelNo clear signal, so a cheaper guess is a gamble

The pattern behind the table: go small only when the task is both narrow and verifiable. When either is missing, stay where you are.

Claude Code Haiku vs Sonnet: when is the cheaper one enough?

Haiku earns its place on work where the output is checked by something other than the model: a test suite, a type-checker, a diff you can read in seconds. Renames, comment passes and file inventories fit. At list price Sonnet costs 20 times Haiku per input token on short prompts, so these jobs are where the saving is largest.

Move up to Sonnet as soon as the subagent has to choose between approaches, read code it was not pointed to, or explain why something fails. Two caveats from the pricing page: Haiku 5.5 prompts over 100,000 tokens pay the higher rate in the table, and outside the Anthropic API the haiku alias may resolve to an older Haiku with different prices.

How does Claude Code pick the model for a subagent?

The sub-agents documentation gives this order, first match wins:

  1. The model parameter Claude passes when it starts the subagent.
  2. The model: field in the agent definition, where inherit means the main conversation's model.
  3. The CLAUDE_CODE_SUBAGENT_MODEL environment variable.
  4. The main conversation's model, which is what you get when nothing above is set.
---
name: log-reader
description: Read logs and list the failing tests
model: haiku
---

Two details trip people up. CLAUDE_CODE_SUBAGENT_MODEL alone does not change the built-in Explore and Plan subagents; the docs add CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 to force one model everywhere. And before Claude Code v2.1.251 the variable came first and overrode the agent file, so the order depends on your version.

Why a fixed model per agent is not enough

Every option above picks one model for a whole agent. A general-purpose subagent gets a rename on Monday and a payment migration on Tuesday, and its model: line cannot tell them apart. opusplan does not help here either: it switches by mode, Opus while planning and Sonnet while executing, and never looks at what a subagent was asked to do.

Where Downshift fits

Downshift is a local PreToolUse hook. When Claude Code is about to start a subagent, it reads the task text, scores it with fixed rules, and sets the model and reasoning effort for that one spawn. There is no LLM call in the loop and the task text is never written to disk.

  • Per subagent: the rename goes small, the cross-package design stays on the frontier tier.
  • Doubt keeps your model: when the classifier is not confident, the spawn runs on the model it asked for.
  • Risk areas never go small: auth, payments, secrets, crypto, personal data and destructive operations are kept off the small tier.

Frequently asked questions

Which model does Claude Code use by default?

On Pro, Max, Team, Enterprise and the Anthropic API the default resolves to Opus 5.5, per the model configuration docs checked on 2026-10-24. A subagent with no model field inherits the main conversation's model unless CLAUDE_CODE_SUBAGENT_MODEL is set.

Is Haiku good enough for Claude Code subagents?

For narrow work you can verify, such as renames, log reading or file listing, it usually is. For anything that needs judgment across files, use Sonnet or Opus, and check the result with tests rather than with the model's own summary.

Does opusplan replace choosing a model per task?

No. opusplan switches by mode: Opus in plan mode, Sonnet during execution. It does not look at what each subagent is asked to do.

Does switching models in the middle of a session cost more?

It can. Each model has its own prompt cache, so a switch reads the conversation again without cache hits. Pick the session model at the start and route subagents instead.

How much does routing each subagent save?

In one battery on 2026-10-21 (46 runs, one operator, mechanical delegated tasks), Downshift routing used about 24% fewer tokens per accepted task than native opusplan, with a 95% interval of +2.1% to +46.7%, and about 16% fewer per run. Complex tasks were not measured.

Install Downshift in one command

Stop paying Opus rates for renames. One command installs the binary and wires the hook; run downshift setup --dry-run first to see every change, and downshift setup --undo restores your backups.

curl -fsSL https://raw.githubusercontent.com/tiagovilasboas/downshift/main/install.sh | sh && downshift setup

Claude Code plugin

/plugin install downshift --marketplace tiagovilasboas/downshift

Sources

  1. Anthropic docsmeasured
    platform.claude.com/docs/en/about-claude/pricing
    Model pricing, Haiku 5.5 prompt-length tiers (checked 2026-10-24)
  2. Anthropic docsmeasured
    code.claude.com/docs/en/model-config
    Aliases opus, sonnet, haiku, opusplan and the default model (checked 2026-10-24)
  3. Anthropic docsmeasured
    code.claude.com/docs/en/sub-agents
    Subagent model resolution order, CLAUDE_CODE_SUBAGENT_MODEL and FORCE (checked 2026-10-24)
  4. Anthropic docsmeasured
    code.claude.com/docs/en/costs
    Choose the right model
  5. Anthropic docsmeasured
    code.claude.com/docs/en/prompt-caching
    Each model has its own cache
  6. Downshift repomeasured
    docs/evidence/four-arm-mechanical-2026-10-21.md
    Four-arm battery, 46 runs, intervals