[BUG] VS Code extension /model does not change the active model when ANTHROPIC_MODEL is set (v2.1.168)
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?
In the Claude Code VS Code extension, the /model selector does not actually change the active model if ANTHROPIC_MODEL is configured in VS Code settings via claudeCode.environmentVariables.
Instead, the extension appears to keep using the model from ANTHROPIC_MODEL, regardless of what is selected through /model.
This does not reproduce in Claude Terminal, where /model works as expected.
What Should Happen?
The model selected via /model should become the active model for the session.
Error Messages/Logs
The session continues using the model from `ANTHROPIC_MODEL`, and the `/model` selection does not take effect.
Steps to Reproduce
- Install Claude Code VS Code extension
2.1.168 - Configure Claude Code in VS Code with Bedrock-related environment variables
- Add
ANTHROPIC_MODELtoclaudeCode.environmentVariables - Open a new Claude Code session in VS Code
- Run
/model - Select a different model than the one set in
ANTHROPIC_MODEL - Send a prompt
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.168
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
If I remove ANTHROPIC_MODEL from claudeCode.environmentVariables, /model starts working again in the VS Code extension.
This strongly suggests that ANTHROPIC_MODEL from extension-injected environment variables overrides the model selected via /model.
Comparison with Claude Terminal
The same issue does not occur in Claude Terminal.
In Terminal, /model changes the active model correctly, which suggests the problem is specific to the VS Code extension integration layer.
Suspected cause
After reverse engineering the extension bundle, it looks like:
- the extension injects
claudeCode.environmentVariablesinto the spawned Claude process environment /modelin the VS Code extension does not appear to use a live session-level model switch path- the effective model seems to remain pinned to
ANTHROPIC_MODELwhen that env var is present
So this may be a precedence issue between:
- model selected via
/model - extension-applied flag/settings updates
- environment variable
ANTHROPIC_MODEL
Workaround
Remove ANTHROPIC_MODEL from:
claudeCode.environmentVariables
After that, /model works correctly again in the VS Code extension.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗