/model - Switch AI Models Mid-Session in Claude Code
Switch between Opus, Sonnet, and Haiku inside a running Claude Code session. No context lost, pick the right model for the job.
What is /model
Claude Code runs on one AI model at a time. Think of models like engine options. Opus is the most capable (and most expensive), Sonnet is the everyday workhorse, and Haiku is the fastest and cheapest. By default, Claude Code picks a model based on your subscription plan, but you can switch at any time without starting a new session.
/model is the slash command that swaps the engine while you're driving. Your conversation stays intact. You get a different brain processing it.
Claude Code model selection docs
What problems it solves
You're deep into a session on Opus, burning through your context window on a complex refactor. Then you need to do something routine: rename a variable across a few files, fix a typo in a config. You don't need Opus-level reasoning for that. Switching to Sonnet or Haiku for the easy stuff saves your Opus context budget for when it matters.
Or you started on Sonnet because that's your default, but you hit a tricky architectural problem. The kind where you need the model to hold 15 files in memory and reason about how they connect. That's when you switch up to Opus mid-session without losing any of the work you've already done.
How to use it
Type /model by itself and Claude Code shows you an interactive picker:
/modelOr pass the model directly to skip the picker:
/model opusAliases vs full model IDs
You can use short aliases or full model IDs. Aliases always point to the latest version your provider supports:
# Aliases (resolve to latest)
/model opus
/model sonnet
/model haiku
/model best
/model default
# Full model IDs (pin a specific version)
/model claude-opus-4-7
/model claude-opus-4-6
/model claude-sonnet-4-6
/model claude-haiku-4-5-20251001
# Extended context (1M token window)
/model opus[1m]
/model sonnet[1m]
/model claude-opus-4-6[1m]
/model claude-sonnet-4-6[1m]
# Hybrid mode (Opus plans, Sonnet executes)
/model opusplanI use full model IDs when I want a specific version. For example, /model claude-opus-4-6 when I want Opus 4.6 specifically instead of whatever "latest" resolves to today. Append [1m] to any alias or full model ID to unlock the full 1M token context window — useful for large codebases where the default window cuts off important files.
Opus Plan mode
opusplan is a hybrid mode worth knowing about. When you run /model opusplan, Opus handles the planning and reasoning — deciding what to do, which files to touch, what approach to take — while Sonnet handles the execution: writing the actual code, running commands, making edits. You get Opus-level thinking on the hard parts without paying Opus-level cost on every single step.
It works well for large tasks where the strategy matters more than the individual edits. I use it when I have a multi-file refactor or a feature that touches several layers of the stack. Opus figures out the plan, Sonnet cranks through the implementation.
What happens when you switch
Your conversation history stays. The new model picks up where the old one left off. The one thing you lose is the prompt cache. Claude Code caches your conversation so it doesn't re-read everything on each turn. Switching models resets that cache, so the next response takes a bit longer as the new model reads through the full history.
Keyboard shortcut
Option+P on macOS (Alt+P on Windows/Linux) opens the model picker without clearing what you've typed in the prompt. Same thing as /model, faster to reach.
Pro tips
If you want a permanent default so you don't type /model every session, set it at launch:
claude --model opusOr add it to your settings file:
{
"model": "opus"
}I switch to Sonnet or Haiku for quick file edits and back to Opus for anything that needs real reasoning. The cost difference adds up. My last Opus 4.7 session showed $118 in Anthropic API equivalent spend. Same kind of work on Sonnet costs a fraction of that.