Build This Now
Build This Now
Claude Code ModelsClaude Opus 4.5 in Claude CodeClaude Opus 4.6Claude Sonnet 4.6Claude Opus 4.5Claude Sonnet 4.5Claude Haiku 4.5Claude Opus 4.1Claude 4Claude 3.7 SonnetClaude 3.5 Sonnet v2 and Claude 3.5 HaikuClaude 3.5 SonnetClaude 3Every Claude Model
Get Build This Now
speedy_devvkoen_salo
Blog/Model Picker/Claude Code Models

Claude Code Models

A working guide to picking Sonnet, Opus, Haiku, or opusplan in Claude Code, cutting model costs 60-80% without losing quality.

Problem: A lot of developers reach for Opus on every task and burn through their budget, or stay on Haiku where it cannot keep up. Switching models based on what the task actually needs can pull 60-80% out of your usage costs.

Quick Win: Make Sonnet your default model right now:

claude --model sonnet

You save around 80% on cost and keep strong performance on roughly 90% of daily development work.

Model Aliases

Claude Code ships aliases so you can avoid memorizing version numbers. These are the shortcuts you reach for every day:

AliasBehavior
defaultRecommended model for your account type. Max users get auto-fallback from Opus to Sonnet at limits
sonnetLatest Sonnet model (currently Sonnet 4.5) for daily coding tasks
opusOpus model (currently Opus 4.6) for complex reasoning
haikuFast and efficient Haiku model for simple tasks
sonnet[1m]Sonnet with a 1 million token context window for long sessions (Console/API users)
opusplanUses Opus during plan mode, then switches to Sonnet for execution automatically

The default alias tracks your account type. On certain Max accounts, Claude Code automatically falls back from Opus to Sonnet at a usage threshold, so you keep working without touching a model flag.

Console and API users get sonnet[1m], which opens a 1 million token context window. Long sessions that would otherwise trip the compaction limit sit inside it comfortably. Extended context models bill at different rates, so keep that in mind.

Console and API users can also append the [1m] suffix to a full model name:

/model anthropic.claude-sonnet-4-5-20250929-v1:0[1m]

The Smart Model Strategy

The most expensive habit is running one model for everything. Claude Code gives you several, each tuned for a different kind of work. Swap between them and you can cut usage costs by 80% while the results get better.

Sonnet: Your Daily Driver

Best for: 90% of development work

# Start Claude Code with Sonnet (usually the default)
claude --model sonnet

Perfect for:

  • Feature implementation and bug fixes
  • Code reviews and refactoring
  • API integration and database work
  • Writing tests and documentation

Why Sonnet wins: 90% of Opus capability at 2x the speed, rarely hits usage limits, ideal for pair programming workflow.

Opus: The Heavy Hitter

When to upgrade: Complex architectural decisions only

# Start with Opus for deep analysis sessions
claude --model opus

Use Opus for:

  • Large-scale refactoring across multiple systems
  • Complex debugging with intricate dependencies
  • Architectural decisions requiring deep reasoning
  • Advanced security reviews

Cost reality: 5x more expensive than Sonnet, but justified for tasks requiring maximum reasoning power.

Haiku: The Speed Demon

When to downgrade: Simple, repetitive tasks

# Fast and cheap for basic operations
claude --model haiku

Perfect for:

  • Simple file reads and formatting
  • Basic syntax validation
  • Quick status checks
  • Text transformations

Warning: Don't use Haiku for actual development. It struggles with complex logic and multi-file projects.

Opusplan: The Best of Both Worlds

When to use: Complex tasks where you want Opus reasoning without Opus costs for everything

# Hybrid mode: Opus plans, Sonnet executes
claude --model opusplan

How it works:

  • In plan mode: Uses Opus for complex reasoning and architecture decisions
  • In execution mode: Automatically switches to Sonnet for code generation and implementation

The planning phase runs on Opus for the deep reasoning, then execution drops to Sonnet for the speed and cost on the code-writing pass. Opus quality lands where it matters (up front), and the rest of the session stays cheap.

Refactoring sessions, feature planning, and any workflow that leans on plan mode are a good fit for opusplan. Because Opus pricing only applies during planning, it doubles as a cost optimization tactic.

Tactical Model Switching

Start with Sonnet. Escalate when the task actually demands it.

During Development Sessions

# Start your session with Sonnet
claude --model sonnet

# Mid-session: switch to Opus for complex refactoring
/model opus

# Back to Sonnet for regular work
/model sonnet

# Drop to Haiku for simple tasks
/model haiku

Cost Optimization Pattern

  1. Default: Sonnet for all standard development
  2. Hybrid: Use opusplan for sessions that mix planning and implementation
  3. Escalate: Switch to full Opus only when Sonnet struggles on execution tasks
  4. Delegate: Use Haiku for simple file operations
  5. Monitor: Track usage to optimize model selection

Run it this way and your bill drops 60-80% against a pure-Opus workflow.

Model Selection by Task Type

Code Analysis Speed Rankings

  1. Haiku: Instant but shallow analysis
  2. Sonnet: Fast with excellent depth
  3. Opus: Slower but deepest analysis

Reasoning Quality Rankings

  1. Opus: Superior for complex multi-step problems
  2. Sonnet: Excellent for most development scenarios
  3. Haiku: Basic reasoning only

Cost Efficiency Rankings

  1. Haiku: Cheapest per task (limited capability)
  2. Sonnet: Best performance per dollar
  3. Opus: Premium pricing for premium capability

Model Configuration

There are several places to set your model, and the priority chain is strict. A higher-priority setting always beats a lower one:

  1. During session - /model <alias|name> switches models mid-session (highest priority)
  2. At startup - claude --model <alias|name> sets the model for that session
  3. Environment variable - ANTHROPIC_MODEL=<alias|name> persists across sessions
  4. Settings file - The model field in settings.json for permanent configuration (lowest priority)

To pin a model permanently, add a model field to your settings file:

// ~/.claude/settings.json
{
  "permissions": {},
  "model": "sonnet"
}

With that in place, you stop passing --model every time you start Claude Code.

Controlling Which Models Aliases Map To

Pointing an alias at a specific version, or at a Bedrock or Vertex deployment, is done through environment variables:

Environment VariableControls
ANTHROPIC_DEFAULT_OPUS_MODELModel used for opus, and for opusplan during plan mode
ANTHROPIC_DEFAULT_SONNET_MODELModel used for sonnet, and for opusplan during execution
ANTHROPIC_DEFAULT_HAIKU_MODELModel used for haiku and background functionality
CLAUDE_CODE_SUBAGENT_MODELModel used for sub-agents (overrides the default sub-agent model)

Note that ANTHROPIC_SMALL_FAST_MODEL is deprecated. ANTHROPIC_DEFAULT_HAIKU_MODEL replaces it.

Bedrock, Foundry, and Vertex users lean on these the most, since those platforms want inference profile ARNs, deployment names, or version names rather than the standard Anthropic model IDs.

Checking Your Current Model

Two ways to see what model a session is on:

  • Run /status to display your current model and account information
  • Configure a StatusLine to show the model persistently in your terminal

Prompt Caching Configuration

Prompt caching is on by default in Claude Code and helps with both performance and cost. If you need to turn it off, for debugging, benchmarking, or a specific API setup, these environment variables control it:

Environment VariableEffect
DISABLE_PROMPT_CACHINGDisables caching for all models (overrides per-model)
DISABLE_PROMPT_CACHING_HAIKUDisables caching for Haiku models only
DISABLE_PROMPT_CACHING_SONNETDisables caching for Sonnet models only
DISABLE_PROMPT_CACHING_OPUSDisables caching for Opus models only

Set any of these to 1 to turn caching off. The global DISABLE_PROMPT_CACHING wins over the per-model flags. Disabling caching raises cost and latency, so only do it when there is a specific reason.

Common Model Selection Mistakes

Mistake 1: Using Opus for everything

  • Problem: 5x higher costs with slower responses
  • Solution: Default to Sonnet, escalate selectively

Mistake 2: Staying on Haiku too long

  • Problem: Poor code quality, missed issues
  • Solution: Upgrade to Sonnet for any real development

Mistake 3: Not switching models mid-session

  • Problem: Using wrong model for current task
  • Solution: Use /model opus or /model sonnet to switch instantly

Quick Reference

Task TypeRecommended ModelWhy
Daily codingSonnetBest balance of speed and capability
Plan + implementopusplanOpus reasoning for plans, Sonnet for code
Complex architectureOpusMaximum reasoning depth
Simple file opsHaikuFast and cheap
Long sessionssonnet[1m]1M token window avoids compaction
DebuggingStart Sonnet, escalate to Opus if stuckProgressive escalation

For beginners: Start with Sonnet to learn workflows.

For daily development: Sonnet as default with Opus for complex debugging.

For budget optimization: Strategic switching based on task complexity.

For learning: Check our configuration guide to set up model defaults.

Pick the right model per task and you write code faster while spending less. Sonnet's balanced power handles most of the job. Opus is for the parts that genuinely need its depth.

Next Action: Set up your optimal model configuration with our performance optimization guide, then learn advanced context management techniques.

For detailed specs on every Claude model Anthropic has released, see the complete model timeline.

Related Guides:

  • Deep Thinking Techniques - When to use extended thinking with Opus
  • Efficiency Patterns - Build frameworks for consistent output
  • Usage Optimization - Track and reduce your costs

More in this guide

  • Every Claude Model
    One page, every Claude release. Specs, prices, benchmarks, and when to actually use each model from Claude 3 through Sonnet 4.6.
  • Claude 3.5 Sonnet v2 and Claude 3.5 Haiku
    October 2024 refresh shipped an upgraded Sonnet, a budget Haiku, and the first Claude model that could drive a desktop cursor.
  • Claude 3.5 Sonnet
    Released June 20, 2024, Anthropic's mid-tier model beat its own larger flagship on most benchmarks at a fifth of the cost.
  • Claude 3.7 Sonnet
    February 2025 release added hybrid reasoning. Claude could now pause, think through a hard problem step by step, then answer.
  • Claude 3
    The March 2024 lineup that split Opus, Sonnet, and Haiku into three tiers and set the template the rest of the industry copied.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now

Claude Opus 4.5 in Claude Code

Opus 4.5 shipped with $5/$25 pricing and 76% fewer output tokens than Sonnet 4.5. Set it as your default in two commands.

On this page

Model Aliases
The Smart Model Strategy
Sonnet: Your Daily Driver
Opus: The Heavy Hitter
Haiku: The Speed Demon
Opusplan: The Best of Both Worlds
Tactical Model Switching
During Development Sessions
Cost Optimization Pattern
Model Selection by Task Type
Code Analysis Speed Rankings
Reasoning Quality Rankings
Cost Efficiency Rankings
Model Configuration
Controlling Which Models Aliases Map To
Checking Your Current Model
Prompt Caching Configuration
Common Model Selection Mistakes
Quick Reference

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now