Skip to main content

How to Change Claude Code Model

I switch between Claude models based on task complexity and token efficiency. Sonnet 5 for daily development work, Haiku 4.5 for lightweight agents and high-frequency tasks (90% capability at 3x cost savings), Fable 5 when I need frontier engineering, codebase-scale migrations, vision-heavy work, or long-context agents. Opus 5 is my current Opus-tier pick, succeeding Opus 4.8 at the same per-token cost when Fable 5's frontier capability isn't required.



How to Use It

Environment Variable - Set the default model in your shell configuration:

# Set default model (add to `~/.bashrc` or `~/.zshrc`)
export ANTHROPIC_MODEL="claude-sonnet-5"

# Latest frontier model
export ANTHROPIC_MODEL="claude-fable-5"

# Current Opus tier
export ANTHROPIC_MODEL="claude-opus-5"

# Previous-generation Opus
export ANTHROPIC_MODEL="claude-opus-4-8"

Command Line Flag - Specify model when starting Claude Code:

# Start with Sonnet 5 (recommended for main development)
claude --model claude-sonnet-5

# Start with Haiku 4.5 (lightweight agents, 90% capability, 3x cost savings)
claude --model claude-haiku-4-5

# Start with Fable 5 (latest frontier — FrontierCode, vision, long-context)
claude --model claude-fable-5

# Start with Opus 5 (current Opus tier, doubles Opus 4.8 on Frontier-Bench)
claude --model claude-opus-5

# Start with Opus 4.8 (previous-generation Opus, ~4× fewer flaw misses, dynamic workflows)
claude --model claude-opus-4-8

# Start with Opus 4.7 (earlier Opus generation, 3× vision, xhigh effort)
claude --model claude-opus-4-7

Mid-Session Switching - Change models during active sessions:

# Full model names
/model claude-fable-5
/model claude-opus-5
/model claude-opus-4-8
/model claude-opus-4-7
/model claude-opus-4-6
/model claude-sonnet-5
/model claude-haiku-4-5

# Shorthand commands (easier to type)
/model opus
/model sonnet
/model haiku

# Alternative shorthand
/mode opus
/mode sonnet
/mode haiku


Why Use Different Models

Each Claude model excels in different scenarios, and switching between them optimizes both performance and cost efficiency based on task requirements.

Benefits:

  • Task Optimization - Match model capabilities to specific development needs and complexity levels
  • Cost Management - Use less expensive models for simpler tasks while reserving premium models for complex work
  • Performance Balance - Optimize response speed and quality based on urgency and complexity requirements
  • Token Efficiency - Manage usage limits by selecting appropriate models for different types of work
  • Workflow Flexibility - Adapt model selection to changing requirements within the same development session


Model Selection Strategy

Claude Sonnet 5 - Default choice for main development work:

  • Daily coding tasks and bug fixes
  • Code reviews and documentation
  • Most refactoring and testing work
  • General development activities

Claude Haiku 4.5 - Near-frontier performance at exceptional cost efficiency:

  • Lightweight custom agents (90% of Sonnet 5 capability)
  • High-frequency tasks (10+ invocations per session)
  • Pair programming with rapid feedback
  • Chat assistants and customer service
  • Worker agents in multi-agent systems
  • 3x cost savings with 2x speed advantage

Claude Fable 5 - Latest frontier model:

  • State-of-the-art on Cognition's FrontierCode benchmark
  • Codebase-scale migrations — Stripe completed a 50M-line Ruby migration in one day
  • State-of-the-art vision (scientific figures, screenshot-to-source, vision-only Pokémon FireRed completion)
  • 3× stronger long-context improvement than Opus 4.8 with file-based memory
  • Top Hebbia Finance Benchmark performance for senior-level financial reasoning
  • Restricted Mythos 5 tier for cybersecurity and life-sciences research under trusted-access programs
  • Pricing: $10/$50 per million tokens

Claude Opus 5 - Current Opus tier:

  • Frontier-Bench score doubles Opus 4.8
  • CursorBench 3.2 within 0.5% of Fable 5 at half the cost
  • OSWorld 2.0 beats Fable 5 at one-third the cost
  • ARC-AGI 3 score 3× the next-best model
  • Fast mode 2.5× faster at 2× cost
  • Mid-conversation tool changes and automatic safety fallbacks (beta)
  • Pricing: $5/$25 per million tokens (same as Opus 4.8)

Claude Opus 4.8 - Previous-generation Opus:

  • ~4× fewer overlooked code flaws than Opus 4.7
  • Dynamic Workflows — hundreds of parallel subagents in Claude Code (Enterprise/Team/Max)
  • Effort control: standard / extra / max
  • Mid-task cache preservation via Messages API system entries
  • More reliable tool calling with fewer steps needed
  • Pricing: $5/$25 per million tokens; fast mode at $10/$50 (3× cheaper than 4.7's fast mode)

Claude Opus 4.7 - Earlier Opus generation:

  • 3× vision resolution — up to 2,576px (~3.75 megapixels)
  • xhigh effort level between high and max
  • Task budgets (public beta) for token spend control
  • Improved instruction following and file-system memory
  • Pricing: $5/$25 per million tokens

See Also: Model Switching Guide|Configuration|Getting Started|Pricing