ANTHROPIC_MODEL environment variable ignored on Bedrock - hardcoded to anthropic.claude-3-5-sonnet-20240620-v1:0
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?
Bug Description
Claude Code v2.0.67 is ignoring the ANTHROPIC_MODEL environment variable when using AWS Bedrock, causing all main model calls to fail.
Environment
- Claude Code version: 2.0.67
- Platform: macOS
- Provider: AWS Bedrock (us-west-2)
- Installation method: Homebrew
Configuration
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-west-2
export ANTHROPIC_MODEL=us.anthropic.claude-sonnet-4-20250514-v1:0
export ANTHROPIC_SMALL_FAST_MODEL=us.anthropic.claude-haiku-4-5-20251001-v1:0
Expected Behavior
Claude Code should use the model specified in ANTHROPIC_MODEL (Sonnet 4 inference profile)
What Should Happen?
Actual Behavior
Claude Code ignores ANTHROPIC_MODEL and is hardcoded to use anthropic.claude-3-5-sonnet-20240620-v1:0, which results in ValidationException errors because this model requires an inference profile for on-demand invocation.
Evidence
- CloudWatch logs show Claude Code attempting to invoke
anthropic.claude-3-5-sonnet-20240620-v1:0(direct model ID) instead of the configured inference profile - All main model calls return ValidationException
ANTHROPIC_SMALL_FAST_MODELenvironment variable IS being respected (Haiku 4.5 calls succeed)- AWS CLI can successfully invoke models using the same credentials and inference profiles
Impact
This bug completely blocks AWS Bedrock users from using Claude Code, making it impossible to leverage AWS startup credits or enterprise Bedrock deployments.
Workaround
None currently available. The ANTHROPIC_MODEL variable appears to be completely ignored for the main model.
Error Messages/Logs
Steps to Reproduce
Steps to Reproduce
- Install Claude Code v2.0.67
- Configure AWS Bedrock with valid credentials:
aws configure
- Set environment variables in
~/.zshrc(or~/.bashrc):
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-west-2
export ANTHROPIC_MODEL=us.anthropic.claude-sonnet-4-20250514-v1:0
export ANTHROPIC_SMALL_FAST_MODEL=us.anthropic.claude-haiku-4-5-20251001-v1:0
- Reload shell:
source ~/.zshrc - Verify environment variables are set:
env | grep ANTHROPIC_MODEL - Launch Claude Code:
claude - Send any message:
hello
Expected: Claude Code uses Sonnet 4 inference profile
Actual: API Error 400 - Claude Code attempts to use anthropic.claude-3-5-sonnet-20240620-v1:0 instead of configured model
Additional verification:
- Enable AWS Bedrock CloudWatch logging
- Monitor logs with:
aws logs tail /aws/bedrock/modelinvocations --follow --region us-west-2 - Logs show
anthropic.claude-3-5-sonnet-20240620-v1:0being invoked despite env var configuration
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.67
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗