[BUG] VS Code extension: model switching broken since 2.1.86
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The VS Code extension does not respond to /model opus command and there is no way to switch to Opus model from the extension UI. The CLI version works fine and switches to Opus successfully, but the extension always uses Sonnet 4.5 regardless of settings.
Timeline:
- Extension version 2.1.87 was released ~2 hours ago
- This appears to be a regression - model switching may have broken in recent releases
What I tried:
/model opuscommand in VS Code extension chat → no response, command appears to be ignored- Added
"claudeCode.selectedModel": "opus"to settings.json → no effect, still Sonnet 4.5 - Added
"claudeCode.selectedModel": "claude-opus-4-6"→ no effect - Added
"claudeCode.selectedModel": "opus[1m]"(from issue #35789 workaround) → no effect - Reloaded VS Code window multiple times
- CLI
/model opus→ works perfectly, switches to Opus
Current state:
- CLI: model switching works ✅
- VS Code extension:
/modelcommand not available, settings don't work ❌ - Extension always uses
claude-sonnet-4-5-20250929regardless of settings
What Should Happen?
/model opuscommand should work in VS Code extension (same as CLI)- OR there should be a UI control to switch models
- OR
claudeCode.selectedModelsetting should actually work
Model switching should be consistent between CLI and VS Code extension.
Error Messages/Logs
No error messages - /model opus command is silently ignored in VS Code extension.
Steps to Reproduce
- Open Claude Code extension in VS Code (version 2.1.87)
- Type
/model opusin chat - Observe that command is ignored (no response, no error)
- Try adding
"claudeCode.selectedModel": "opus[1m]"to VS Code settings.json - Reload window
- Ask Claude which model it's using → still Sonnet 4.5
Compare with CLI:
- Run
claudein terminal - Type
/model opus - Model switches to Opus successfully ✅
Claude Model
Sonnet (default) - cannot switch to Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown - possibly before 2.1.87
Claude Code Version
2.1.87 (VS Code extension)
Platform
Anthropic API
Operating System
macOS Darwin 25.0.0
Terminal/Shell
VS Code integrated terminal
Additional Information
Related issues:
- #38331 - opposite problem (switches to Sonnet, gets Opus)
- #35789 - Default shows Opus but sets Sonnet (workaround doesn't help in 2.1.87)
- #33865 - VS Code extension ignores project-level model setting
The claudeCode.selectedModel setting is not documented in the extension's package.json configuration schema, which may explain why it's not working.
9 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I'm getting Unknown Configuration Setting for
"claudeCode.selectedModel": "claude-opus-4-5-20251101"For some reason it automatically switched me to Sonnet 4.6 a few days ago. It's been a frustrating few days.
Why is this still not fixed? This problem is definitely not related to vs code (I tried it in several versions).
There is no issue in version 2.1.85. The bug is reproducible starting from 2.1.86
There is no workaround except downgrading to an older version.
Does anybody at Anthropic actually use this extension?
https://github.com/user-attachments/assets/2c77e7f0-92c7-4760-b64b-56d8ff54136e
+1, vscode shows this is unknown settings: "claudeCode.selectedModel"
When I select the Default model in VS Code (listed as Opus 4.6 with 1M context), it switches me to claude-haiku-4-5-20251001. I cannot access opus[1m] in VS Code at all unless I downgrade the extension to 2.1.85.
Claude Code command line works fine in any version. Please fix!
Downgrading the version fixed the issue for me.
Still busted as of 2.1.109. Just to test I upgraded the extension, restarted VS Code, and I get the same problem. Using "Switch model..." I see:
Choosing Sonnet works fine, but choosing EITHER ONE of the other options switches to Haiku. In fact, they appear to be the same alias because if I choose Haiku and then choose Default (Opus 4.6), I don't get any kind of message. It's only if I'm on Sonnet and then select one of the others that I get the following:
~~~ Switched to claude-haiku-4-5 20251001 ~~~Guess I'm reverting back to 2.1.85 again.
P.S. One note, after reverting back to 2.1.85 and switching to Opus 4.6 (which works) the model name has a redundant [1m] in it. Don't know if this is related.
~~~ Switched to claude-opus-4-6[1m][1m] ~~~Solved it. Posting in case someone has the same problem.
The reason was the
ANTHROPIC_MODELenvironment variable in my~/.zshrc. I added it a long time ago and forgot about it:This variable forces the extension to use Sonnet 4.5 every time it starts, and it overrides only the default model you pick in the UI. That's why:
claudeCode.selectedModelsetting did nothing..zshrc.How to fix it:
``
bash
``env | grep ANTHROPIC_MODEL
grep ANTHROPIC_MODEL ~/.zshrc ~/.bashrc ~/.zshenv ~/.profile 2>/dev/null
export ANTHROPIC_MODEL=...line and fully restart VS Code (Cmd+Q, not just close the window).A small request to the Claude Code team: it would be great if the extension showed a warning when
ANTHROPIC_MODELis overriding the selected model, or if the UI picker had priority over the variable. Right now the model picker silently does nothing because of a variable you set months ago - it's very hard to debug.I spent hours deleting VS Code, Cursor, Keychain entries, configs, and caches before I found this one line.
Hope this helps someone
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.