[BUG] Unable to Change LLM Model in Claude Code Despite Setting Environment Variables
I am trying to change the LLM model used by Claude Code by setting the appropriate environment variables as described in the Anthropic documentation.
I have configured the following environment variables:
# Configure Haiku
export ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-3-5-haiku-20240307-v1:0'
# also tried this from the docs
export ANTHROPIC_MODEL='us.anthropic.claude-3-5-haiku-20241022-v1:0'
Despite setting these variables, Claude Code does not appear to respect these configurations, and it continues to use the default model (Claude 3.7 Sonnet). I have verified that the environment variables are correctly set using echo $ANTHROPIC_MODEL and echo $ANTHROPIC_SMALL_FAST_MODEL.
Steps to Reproduce:
Install and authenticate Claude Code as per the documentation.
Set the environment variables using the commands above.
Restart the terminal or relevant process to ensure environment variables take effect.
Run Claude Code using claude and observe which model is being used.
Expected Behavior:
Claude Code should respect the specified environment variables and use the configured models instead of the defaults.
Actual Behavior:
Claude Code does not appear to use the specified models and defaults to the pre-configured model (Claude 3.7 Sonnet).
Additional Context:
- Operating System: Ubuntu 24 on WSL (Windows 11)
- Claude Code Version: Latest
Overrides (via env): │ │
• Model: us.anthropic.claude-3-5-haiku-20240307-v1:0
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"system: Invalid model name"}}
Overrides (via env): │ │
• Model: us.anthropic.claude-3-5-haiku-20241022-v1:0
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗