Vibe Coding for Production
Getting startedFirst steps

Choosing a model

How Claude Fable, Opus, Sonnet, and Haiku differ in capability, speed, and cost, and when to use each in Claude Code.

Claude Code can run more than one model family. As of September 2026, the main aliases are Fable, Opus, Sonnet, and Haiku. They are families, not frozen checkpoints: aliases move to newer models as Anthropic ships them. On the first-party Anthropic API, fable resolves to Fable 5.1, while opus and sonnet resolve to Opus 5 and Sonnet 5. Provider mappings and account availability differ.

Exact aliases (what you type in /model) and availability depend on your plan, region, and Claude Code version. Use Anthropic’s Model configuration as the source of truth for your install.

Skill level at a glance

Think in terms of reasoning depth, context use, and reliability on messy real code, not a precise IQ score.

FamilyRelative strengthTypical sweet spot
FableHighest tier for the hardest and longest-running tasks; designed to sustain autonomous work and verify outcomesMulti-hour implementation, broad migrations, and difficult work larger than a normal sitting
OpusVery high, strong on ambiguous specs, cross-file design, subtle bugs, security reasoning, and long chains of dependent decisionsArchitecture, risky refactors, deep reviews, “I have tried Sonnet twice and we are still wrong”
SonnetHigh, solid default for professional coding: most features, refactors, and debugging without paying Opus latency and cost on every turnDay-to-day implementation, most PR-sized work, collaborative iteration
HaikuLower on hard multi-step reasoning, excellent when the task is narrow, local, or pattern-shapedQuick edits, formatting, simple boilerplate, high-volume small tasks, read-mostly exploration where speed matters

Haiku is not “dumb”, it is optimized for speed and cost. It will miss nuances that Opus or Sonnet catch when the problem is under-specified or touches many files.

Fable

What it is best at

  • Tasks larger than a single sitting, with long autonomous runs and many dependent steps.
  • Broad changes where the agent must investigate first, keep a goal in view, and repeatedly verify progress.
  • The hardest work where capability matters more than latency or cost.

Tradeoffs

  • It is not the default model on any account or provider; select it explicitly with /model fable or claude --model fable.
  • Availability depends on the organization and provider. Fable usage may require usage credits, and non-interactive runs do not show the interactive billing consent prompt.
  • Fable is more expensive than Opus, Sonnet, or Haiku on the first-party API.

Opus

What it is best at

  • Ambiguous goals where the right shape of the solution is not obvious yet.
  • Large or risky refactors where mistakes are expensive.
  • Security- and correctness-heavy reasoning (threat modeling, tricky concurrency, authz edges).
  • Synthesis across many files or docs when you need one coherent answer.

Tradeoffs

  • Slower and more expensive per token than Sonnet or Haiku.
  • For tiny edits, Opus is often overkill, you pay extra without much benefit.

When to reach for it

  • You are stuck after a Sonnet pass, or the problem is known-hard.
  • You want a pre-merge or architecture review where missing an issue hurts.
  • You are defining API contracts, data models, or migration strategies that will be expensive to unwind.

One-million-token context windows

Claude 4.6 and later models include a context window up to about one million tokens at standard pricing. In Claude Code, use aliases such as sonnet[1m] or opus[1m] when the base alias does not already select a native 1M model. That is a ceiling, not an instruction to fill it.

Pricing (API, list rates)
Anthropic bills per input and output token at the model’s published rates. Claude 4.6 and later models charge the standard per-token rate across the full 1M window: a 900K-token request uses the same rate as a 9K-token request, but consumes 100 times as many input tokens. See Claude pricing; numbers change, so treat that page as canonical.

Back-of-envelope API cost
If Opus is listed at $5 / million input tokens, a single request whose input is 900K tokens is on the order of 900K ÷ 1M × $5 ≈ $4.50 in input charges before output tokens, tool overhead, cache rules, or your cloud markup (Bedrock / Vertex / Azure may differ). Multi-turn agent sessions re-send context-like material often, so real spend scales with total tokens across turns, not “one big paste.”

Claude Code vs raw API
In Claude Code, what you pay is shaped by your plan and usage meters, not only public API list prices. Use /usage so students see session reality rather than spreadsheet theory.

A huge context is easy to pack with semi-relevant files, old tool output, and meandering chat. That dilutes instructions and can make retrieval less reliable (see Context placement and retrieval), producing lower-quality edits than a smaller, curated context while still charging for every token you sent. 1M is for when you truly need breadth, not for lazy retrieval. See Context size and limits.

Sonnet

What it is best at

  • Most coding work: implement features, fix bugs, update tests, iterate on UX copy tied to code.
  • Balanced reasoning: good at following your repo’s patterns without Opus-level latency on every message.

Tradeoffs

  • On very hard or security-critical reviews, Sonnet may need a second pass with Opus or a dedicated review workflow.

When to use it as default

  • Main session for a feature branch when you want quality and speed in balance.
  • Pair programming style back-and-forth where you expect many turns.

Haiku

What it is best at

  • Fast feedback: small diffs, renames, comment cleanup, straightforward test fixes.
  • Tight loops: “try this / revert / try again” where latency dominates your flow.
  • Read-biased exploration when you explicitly configure a custom subagent to use Haiku.

Tradeoffs

  • Weaker when the task needs long-horizon planning, subtle invariants, or many interacting constraints.
  • More likely to hallucinate a plausible shortcut on unfamiliar APIs if you do not anchor with files or docs.

When to use it

  • Obvious, local tasks with a clear definition of done.
  • Cost-sensitive or high-volume automation where Sonnet would be wasteful.
  • Subagents or tools where the job is bounded (for example read-only mapping of a folder).

How to pick a model in Claude Code

  • Session default: /model (and related UI) picks what the main conversation uses. See Model configuration.
  • Per subagent: custom agents can set their own model in frontmatter (for example Haiku for a fast reviewer, Opus for a security pass). See Subagents.
  • Effort / thinking: on supported models, effort controls how hard the model thinks on a turn; it is separate from the model-family choice but pairs with it. See UltraThink.

Claude Code’s built-in Explore subagent now inherits the main conversation’s model (capped at Opus on the Claude API); it no longer always uses Haiku. Define your own Explore agent with model: haiku if you want that cost boundary.

Practical habit: Sonnet for the bulk, Haiku for bounded cheap passes, Opus for a hard slice, and Fable for the longest, hardest autonomous tasks. Two passes (Sonnet implements, Opus reviews) remain useful when stakes are high.

Example prompts

Escalate mid-task:

Switch to the strongest model you have available for this message only. The bug crosses async + caching + auth; previous fixes only masked it. Trace the full data flow, then propose the smallest correct fix.

Stay cheap on a narrow job:

Use the fastest model tier for this: rename the helper to match our style guide, update imports and tests only, no behavior changes.

See also

On this page