Growth Kit 2.0 is here! CRO, Paid Ads & more! Code Kit v4.6 released for CC's new Task System.
Claude FastClaude Fast

Claude Code Models: Choose the Right AI for Every Task

Master tactical model selection in Claude Code. Learn when to use Sonnet vs Opus for optimal performance, cost efficiency, and speed.

Problem: Developers waste money using Opus for everything, or struggle with Haiku when they need more power. Tactical model switching can optimize your usage costs by 60-80%.

Quick Win: Set Sonnet as your default model right now:

claude --model sonnet

This saves 80% on costs while maintaining excellent performance for 90% of development tasks.

Model Aliases

Claude Code provides model aliases so you don't need to remember exact version numbers. These are the shortcuts you'll use daily:

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.5) 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 adapts to your account type. For certain Max users, Claude Code automatically falls back from Opus to Sonnet when you hit a usage threshold, keeping you productive without manual switching.

The sonnet[1m] alias is available to Console and API users and unlocks a 1 million token context window. This is valuable for extended sessions where you'd otherwise hit context compaction limits. Note that extended context models have different pricing.

For Console/API users, the [1m] suffix can also be added to full model names:

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

The Smart Model Strategy

Most developers make a costly mistake: using one model for everything. Claude Code offers multiple models, each optimized for different scenarios. Strategic switching can reduce your usage costs by 80% while improving performance.

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

This gives you Opus-quality planning with Sonnet-speed execution. You get the deep architectural reasoning of Opus where it matters most (the planning phase), then the fast, cost-efficient execution of Sonnet for the actual code changes.

opusplan is an excellent choice for refactoring sessions, feature planning, and any workflow where you use planning mode regularly. It is also a strong cost optimization strategy since you only pay Opus rates during the planning phase.

Tactical Model Switching

The ClaudeFast approach: Start with Sonnet, escalate when needed.

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

This approach can reduce costs by 60-80% compared to using Opus for everything.

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

Claude Code gives you multiple ways to set your model, with a clear priority chain. Higher-priority settings override lower ones:

  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)

For permanent model configuration, add the model field to your settings file:

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

This eliminates the need to pass --model every time you start Claude Code.

Controlling Which Models Aliases Map To

If you need to override which actual model an alias points to (for example, to pin a specific version or use a Bedrock/Vertex deployment), use these 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)

The deprecated ANTHROPIC_SMALL_FAST_MODEL variable has been replaced by ANTHROPIC_DEFAULT_HAIKU_MODEL.

These are especially useful for Bedrock, Foundry, and Vertex users who need to specify inference profile ARNs, deployment names, or version names instead of standard Anthropic model IDs.

Checking Your Current Model

You can see which model you're currently using in two ways:

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

Prompt Caching Configuration

Claude Code automatically uses prompt caching to optimize performance and reduce costs. If you need to disable it (for debugging, benchmarking, or specific API configurations), use these environment variables:

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 disable. The global DISABLE_PROMPT_CACHING takes precedence over per-model settings. Disabling prompt caching increases costs and latency, so only do this when you have 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.

Master model selection and you'll code faster while spending less. Most tasks need Sonnet's balanced power, not Opus's premium capabilities.

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:

Last updated on