← All posts
·4 min read

Claude Code Models: Opus vs Sonnet vs Haiku

Claude CodeModelsComparison
Claude Code Models: Opus vs Sonnet vs Haiku

Choosing the right model in Claude Code

Claude Code supports multiple Claude models, and the one you use matters more than most developers realize. Opus is the smartest but slowest and most expensive. Haiku is the fastest and cheapest but less capable. Sonnet sits in the middle.

The right choice depends on the task, not a blanket preference.

The three models

Model Strength Speed Cost Best for
Opus 4 Deepest reasoning, most capable Slowest Highest Complex architecture, multi-file refactors, hard bugs
Sonnet 4 Best balance of speed and quality Medium Medium Daily coding, most tasks, default choice
Haiku 4.5 Fastest responses Fastest Lowest Quick questions, simple edits, classification, logging

When to use Opus

Opus is Claude's most powerful model. Use it when the task requires deep reasoning or complex planning:

  • Multi-file refactors spanning 10+ files with interdependencies
  • Architecture decisions where you need Claude to consider trade-offs
  • Hard debugging where the bug is subtle and requires understanding system-wide interactions
  • Code review for critical paths (auth, payments, data handling)
  • Planning complex features before implementation

Opus costs more tokens and responds slower, but the quality gap on hard tasks is significant. A task that takes Sonnet three attempts to get right, Opus often nails on the first try.

When to use Sonnet

Sonnet is the default for good reason. It handles 80% of coding tasks well:

  • Feature implementation: writing new code from specs
  • Standard refactoring: renaming, restructuring, extracting functions
  • Test writing: generating test cases from existing code
  • Documentation: writing docs, comments, README files
  • Daily workflows: your /start, /sync, /review commands

If you're not sure which model to use, Sonnet is the answer. Switch to Opus only when Sonnet struggles.

When to use Haiku

Haiku is 3-5x faster than Sonnet and significantly cheaper. Use it for tasks where speed matters more than depth:

  • Quick lookups: "what does this function do?"
  • Simple edits: fixing a typo, changing a constant, adding an import
  • Classification: "is this a bug or a feature request?"
  • Logging and tagging: lightweight metadata operations
  • Automated hooks: quality checks that run on every tool call

Haiku is ideal for automated tasks that run frequently. A hook that classifies every session with Opus would be expensive; with Haiku, it's pennies.

Switching models in Claude Code

Change the default model:

/config
# Set model to opus, sonnet, or haiku

Or use the /fast command to toggle speed-optimized settings on and off during a session.

In .claude/settings.json, set the project default:

{
  "model": "sonnet"
}

Model routing: the smart approach

The best strategy isn't picking one model. It's routing different tasks to different models:

Task type Model Rationale
Main coding session Sonnet Best daily driver
Complex debugging Opus Worth the cost for hard problems
Automated hooks (Stop, PreToolUse) Haiku Runs on every call, needs to be cheap
Sub-agents for research Sonnet Good enough for search and analysis
Sub-agents for quality review Opus Critical path, needs deep reasoning
Quick questions mid-task Haiku Fast answers, low cost

This is how production Claude Code setups work: not one model for everything, but the right model for each job.

Cost implications

On the Max plan ($100-200/mo), you get included usage with rate limits. Model choice affects how quickly you hit those limits:

  • Opus: Burns through quota ~3x faster than Sonnet
  • Sonnet: Standard consumption rate
  • Haiku: ~3-5x more efficient than Sonnet

On the API plan (pay-per-token):

Model Input (per 1M tokens) Output (per 1M tokens)
Opus 4 $15 $75
Sonnet 4 $3 $15
Haiku 4.5 $0.80 $4

The cost difference is dramatic. An hour of heavy Opus usage can cost $20+. The same hour with Haiku might cost $2.

Model selection in practice

Here's a real workflow showing model routing:

  1. /start (Sonnet): Load memory, review tasks, plan the day
  2. Implement feature (Sonnet): Write the code for a new API endpoint
  3. Hit a confusing bug (switch to Opus): Deep debugging session
  4. Bug fixed (back to Sonnet): Continue implementation
  5. /review (Opus): Critical code review before merging
  6. /wrap-up (Haiku): Quick session summary and state save
  7. Stop hook (Haiku): Automated quality classification

Total: ~70% Sonnet, ~20% Opus, ~10% Haiku. Maximum quality where it matters, minimum cost where it doesn't.

Configuring per-agent models

In Claude Code commands and agent definitions, you can specify which model each agent uses:

---
name: auditor
model: opus
tools:
  - Read
  - Grep
---

Quality-critical agents get Opus. Fast utility agents get Haiku. Main session stays on Sonnet. Each piece gets the right tool.

The system approach

Model routing is one piece of a larger puzzle. Combined with persistent memory, automated hooks, and structured commands, you get a system that's both powerful and cost-efficient.

Claudify configures all of this: model routing across 9 agents, Haiku for automated hooks, and Sonnet/Opus for main work. Optimized out of the box.

Get Claudify: Smart model routing, 21 commands, 1,727 skills. One install.

More like this

Ready to upgrade your Claude Code setup?

Get Claudify
Featured on Dofollow.Tools AI Toolz Dir