[FEATURE] Automatic Model Switching for Plan Mode
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Feature Request: Automatic Model Switching for Plan Mode
Summary
Add configuration to automatically switch between models based on workflow phase (planning vs execution), optimizing for both cost and capability.
Problem
Currently, users must manually switch models using /model command when transitioning between planning and execution phases. This leads to:
- Suboptimal model usage: Users often stay on one model for entire session
- Cost inefficiency: Using Opus 4.5 for simple execution tasks burns budget ~5x faster
- Missed opportunities: Not using Opus for complex planning when it would add value
- Manual overhead: Remembering to switch models interrupts flow
Proposed Solution
Enable automatic model switching based on workflow phase:
- Plan Mode (
EnterPlanMode) → Use specified planning model (e.g., Opus 4.5) - Execution Mode (normal operation) → Use specified execution model (e.g., Sonnet 4.5)
- Quick Tasks (optional) → Use fast model (e.g., Haiku)
Use Cases
Use Case 1: Architecture & Implementation
User: "Implement user authentication with OAuth"
Claude Code:
1. Enters plan mode → AUTO-SWITCHES to Opus 4.5
2. Creates comprehensive architectural plan
3. Exits plan mode → AUTO-SWITCHES to Sonnet 4.5
4. Executes implementation efficiently
Benefit: Best model for planning, cost-effective execution
Use Case 2: Complex Refactoring
User: "Refactor this monolith into microservices"
Claude Code:
1. Plan mode (Opus) → Design service boundaries, data flow, migration strategy
2. Execution mode (Sonnet) → Implement refactoring, run tests, create PRs
Benefit: Opus for complex decisions, Sonnet for code changes
Use Case 3: Simple Tasks
User: "Fix this typo in README"
Claude Code:
→ Stays in Sonnet/Haiku (no plan mode needed)
Benefit: No unnecessary model escalation
Proposed Solution
Proposed Configuration
Option A: Settings File
.claude/settings.json:
{
"models": {
"plan_mode": "opus",
"execution_mode": "sonnet",
"quick_tasks": "haiku"
},
"auto_switch_models": true
}
Option B: Environment Variables
export CLAUDE_PLAN_MODEL="opus"
export CLAUDE_EXEC_MODEL="sonnet"
export CLAUDE_AUTO_SWITCH="true"
Option C: CLI Flag
claude code --plan-model opus --exec-model sonnet --auto-switch
Implementation Details
When to Switch
Switch to Plan Model:
EnterPlanModetool is invoked- User explicitly requests planning ("plan the implementation...")
- Task complexity score exceeds threshold (optional)
Switch to Execution Model:
ExitPlanModetool is invoked- Plan is approved by user
- Direct code modification commands (Write, Edit, Bash for git operations)
Switch to Quick Model (optional):
- Simple read operations (Read, Glob, Grep)
- Documentation-only changes
- Running tests/linting
User Control
Users should be able to:
- Override: Manual
/modelcommand always takes precedence - Disable: Set
auto_switch_models: false - Lock:
/model opus --lockprevents auto-switching for session - Review: See which model is active in status line/prompt
Status Line Integration
Show active model and switching events:
[Opus 4.5] Planning... → Implementation plan ready
[Switching to Sonnet 4.5]
[Sonnet 4.5] Executing... → 5 files modified
Cost/Performance Analysis
Example Session: "Implement OAuth Authentication"
Without Auto-Switching (All Opus):
- Planning: 50K tokens @ Opus rates = $3.75
- Execution: 200K tokens @ Opus rates = $15.00
- Total: $18.75
With Auto-Switching (Opus → Sonnet):
- Planning: 50K tokens @ Opus rates = $3.75
- Execution: 200K tokens @ Sonnet rates = $3.00
- Total: $6.75 (64% cost reduction)
Without Auto-Switching (All Sonnet):
- Planning: 50K tokens @ Sonnet rates = $0.75
- Execution: 200K tokens @ Sonnet rates = $3.00
- Total: $3.75
- Trade-off: Lower quality planning, potential rework costs
Benefits
- Cost Optimization: Use expensive models only when needed
- Quality Optimization: Best model for each phase
- User Experience: Seamless transitions, no manual intervention
- Flexibility: User can override or disable as needed
- Transparency: Clear visibility into model usage
Alternative Solutions
Alternatives Considered
Alternative 1: Always Ask User
Claude: "This looks complex. Switch to Opus for planning? (y/n)"
Drawback: Interrupts flow, requires user decision
Alternative 2: Token Budget Thresholds
Automatically downgrade when approaching token limits.
Drawback: Doesn't optimize for task type, reactive not proactive
Alternative 3: Per-Tool Model Selection
Each tool (Read, Write, Bash) specifies preferred model.
Drawback: Too granular, hard to maintain
Related Features
- [ ] Model performance analytics (track which model was used for what)
- [ ] Cost tracking per session
- [ ] Recommend model switches based on task complexity
- [ ] Custom model presets (e.g., "architect" = opus+sonnet)
Questions for Maintainers
- Should auto-switching be opt-in or opt-out?
- Should quick_tasks auto-switching be a separate flag?
- How should this interact with MCP servers that might specify model preferences?
- Should project-level settings override user-level settings?
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
Example User Stories
As a solo developer, I want Opus for architecture decisions and Sonnet for implementation, so I can maximize quality while managing costs.
As a team lead, I want to configure default models for my team's projects, so everyone follows cost-effective best practices.
As a cost-conscious user, I want to use Haiku for simple tasks and Sonnet for complex ones, reserving Opus only for critical planning.
Success Metrics
- % of users who enable auto-switching
- Average cost reduction per session
- User satisfaction with automatic transitions
- Frequency of manual overrides (high = poor auto-detection)
Additional Context
Additional Context
This feature would be particularly valuable for:
- Large refactoring projects (plan with Opus, execute with Sonnet)
- API design (plan with Opus, implement with Sonnet)
- Architecture decisions (Opus) vs bug fixes (Sonnet/Haiku)
- Complex CI/CD setup (plan with Opus) vs routine updates (Sonnet)
26 Comments
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
I like this!
Just in case someone else stumbles here, I think this has been added: https://code.claude.com/docs/en/model-config#opusplan-model-setting
opusplanis currently totally broken. It selects Opus 4.1 for planning while Opus 4.6 is available and Sonnet 4.5 for execution, while Sonnet 4.5 is availablethis would be very useful!
Multi tier routing has been part of attune-ai for Claude-code for quite
some time.
On Thu, Mar 5, 2026 at 9:32 PM Douglas Silverio @.***>
wrote:
@sholub89
I use the following setup (atlhough I use it for AWS Bedrock, never tried it with Antrophic's cloud)
This uses the correct models. Maybe something similar could work for you as well.
@adam-kiss-sg , thank you. I noticed that the subscription version works perfectly fine, and it selects the right models, while the API version is bugged
Adding weight here — this remains one of the highest-friction points in a cost-conscious Claude Code workflow.
Current state (March 2026): The
opusplanshorthand exists (documented at code.claude.com/docs/en/model-config#opusplan-model-setting) but as @sholub89 noted, it resolves to hardcoded model versions rather than latest Opus/Sonnet. On the API path this means you may get Opus 4.1 + Sonnet 4.5 when Opus 4.6 and Sonnet 4.6 are available. The workaround (@adam-kiss-sg's env var approach) works for Bedrock but is clunky for direct API users.What's still missing:
planModel/executeModelconfig pair that resolves model aliases dynamically (not hardcoded versions)The core ask is simple: make the model follow the mode, not the user's memory. Planning benefits from maximum reasoning capacity; execution of already-decided steps is a throughput problem where Sonnet/Haiku excel.
This pattern is now widely documented as best practice in the community — native support would validate and normalize it.
I agree this would be super helpful, and probably something that would save anthropic cost on there subscription plans, as most people would probably leave it to auto switch. Sonnet with a really well defined plan can smash it out no problem, so this is for sure something we need.
Is there any third party plugins for CC that can do this?
Would be very helpful indeed!
Any update on this? I am on an enterprise subscription and opusplan mode is not switching the models correctly. I go to plan mode and it still says sonnet is being used.
I don't think so but they do take pull requests but looking at the things they shoul are fixing seems to be focusing on Enterprise users right now
Could this solve your issue? https://github.com/oussama-kh/mcp-llama-swap
Currently works for local llm models only, but maybe you can fork and adapt it to your case.
The (in my opinion) cleanest and most obvious implementation of this would be to offer the sonnet switch when the user is asked if the Edits should be implemented, so like this:
The plan/execute split is leakier than it looks. Real "execution" isn't a flat pipe of mechanical edits — it's punctuated by mini-planning moments: a test fails and the model needs to reason about why, an interface decision forces a tradeoff the plan didn't anticipate, a refactor surfaces a question that wasn't visible upfront. If the switch flips to Sonnet on ExitPlanMode and stays there, those moments silently get the cheaper brain — and the user sees worse output without knowing the model changed under them.
Worth defining re-escalation signals beyond plan-mode boundaries: repeated tool-call failures, the model itself flagging uncertainty, cross-file reasoning, or N+ edits converging on the same region.
+1 on this. One thing worth keeping in mind for the implementation: the existing
opusplanpreset is effectively hardcoded to a specific Opus↔Sonnet pair. As new models are released, that approach doesn't scale — every new model would need its own bespoke "X-plan" alias.It would be great if the eventual implementation generalized
opusplaninto a configurable pair (e.g.plan_model/exec_modelas proposed in Option A), so users could set any model for either role:This way, as future models are added to Claude Code, users get an "X-plan" style preset for free without waiting for a new hardcoded alias. Today there's no hook event for
EnterPlanMode/ExitPlanModeand no way to switch models automatically based on plan-mode state, so this currently has to be done manually via/model.I agree, especially with the new Fable models released, it people might want to use that for planning instead of opus.
+1, and I'd add a data center angle to this: I'm a daily subscriber using chat, Code, and Cowork. I manually switch between Haiku/Sonnet/Opus depending on the task, but I forget, and end up running simple stuff on a bigger model than it needs. Multiply that by however many subscribers do the same thing — auto-routing wouldn't just save users' usage allowance, it'd cut unnecessary load on Anthropic's compute too. Seems like a win on both sides of the table.
I'm not sure why this issue is still open because this already works on my local machine, just type
/model opusplan+1 — this is even more important now that Fable is out, since Fable is quite expensive to run for an entire session. Being able to use it just for planning (falling back to a cheaper model for execution) is exactly the use case this issue is asking for.
Worth noting: Codex CLI already supports this pattern natively (distinct planning vs. execution model config), so there's precedent for it working well in practice.
Related: #8358, #26556
@dannytrue this issue should stay open —
opusplanand this request solve different problems.opusplanis a hardcoded Opus↔Sonnet pair; it doesn't let you choose which models are used for planning vs. execution. This request is about a genericplan_model/exec_modelsetting that works with any model pair — e.g. I want Fable 5 for planning and Sonnet 5 for implementation, whichopusplancan't do no matter how it's configured.This must also support the ability to specify an effort level per model for planning versus execution. :-)
Yes please I would like to see
this is not really it, it's similar but new model came out Fable 5 and this doesn't work any more during regular sessions, only if Fable 5 reaches limit.
+1 for this to become a real feature
Actually we could go all the way and specify
+1, we definitely need this!