[BUG] Claude Code Bedrock Model Configuration Error
Status Fixed / completed
Maintainer reply ✓ Yes — ant-kurt
Activity 11 comments · opened May 30, 2025 · closed Jun 4, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one):
- [ ] Anthropic API
- [X] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: <!-- output of
claude --version--> - Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
- Terminal: <!-- e.g. iTerm2, Terminal App -->
Bug Description
Unable to configure Claude Code to use AWS Bedrock with Claude Sonnet 4. Getting a "provided model identifier is invalid" error when attempting to set the global configuration for Bedrock usage.
Steps to Reproduce
- Run the following command to configure Claude Code for AWS Bedrock:
``bash``
claude config set --global env '{"CLAUDE_CODE_USE_BEDROCK": "true", "ANTHROPIC_MODEL": "apac.anthropic.claude-sonnet-4-20250514-v1:0"}'
- Attempt to use Claude Code with the Bedrock configuration
- Error occurs immediately
Expected Behavior
Claude Code should successfully configure to use AWS Bedrock with Claude Sonnet 4 model and allow normal operation through Bedrock API.
Actual Behavior
Configuration fails with the following error:
API Error (apac.anthropic.claude-sonnet-4-20250514-v1:0): 400 The provided model identifier is invalid.
arn:aws:bedrock:ap-northeast-1:XXXX:inference-profile/apac.anthropic.claude-sonnet-4-20250514-v1:0
Interrupted by user
Additional Context
- Using AWS region: ap-northeast-1 (Asia Pacific - Tokyo)
- The error shows Claude Code is attempting to construct an ARN with an inference profile
- The model identifier format
apac.anthropic.claude-sonnet-4-20250514-v1:0appears to be incorrect for AWS Bedrock - Standard Bedrock model identifiers typically use format like
anthropic.claude-3-5-sonnet-20241022-v2:0 - May be related to regional model availability or incorrect model ID format for Bedrock
11 Comments
Hi @cloudeep-innovation,
That inference profile looks like the correct specifier, from https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html (section "APAC Claude Sonnet 4"). Can you try setting
AWS_REGION=ap-northeast-1too?If that doesn't work, can you try directly invoking the model via the AWS CLI to confirm model availability and region, something like:
Seeing this same issue. Suggested "aws bedrock-runtime invoke-model" call above from @ant-kurt works with region set to either ap-southeast-2 or the suggested ap-northeast-1 but Claude Code reports
API Error (apac.anthropic.claude-sonnet-4-20250514-v1:0): 400 The provided model identifier is invalid.Seeing the same issue with Bedrock.
This works, but with claude code with model set to "arn:aws:bedrock:us-west-2:xxxxxxxxx:application-inference-profile/xxxxxxxxx"
I get: API Error (arn:aws:bedrock:us-west-2:xxxxxxxxx:application-inference-profile/xxxxxxxxx ): 400 The provided model identifier is invalid.
This also works in Clint in VS Code, and Pydentic AI framework.
I am seeing the same issue with my region set to eu-central-1. It works with the aws command but claude code is showing an error 400.
Ensure you're setting the
AWS_REGIONorAWS_DEFAULT_REGIONenvironment variables for the Claude Code process, to a value that matches where the inference profile is available.@ant-kurt, thanks. Setting AWS_REGION fixed the issue for me. Region was set in ~/.aws/config which I guess explains why other applications and the
aws bedrock-runtime invoke-modeltest work but looks like Claude Code doesn't use this and needs the explicit AWS_REGION environment variable set.Same here. The doc says to use
aws configurewhich sets this config file, so it seemed natural that claude code would use it, just as it uses the credentials file.Thank you @ant-kurt
Adding the region worked, thanks! @ant-kurt
Closing this one out since it looks like adding env var
AWS_REGIONfixed this.We have some upcoming docs updates that should make this requirement more clear, and may also explore reading from AWS config in the future.
If anyone is reading this -- does it mean that (for example) I can only invoke Sonnet 4 from
eu-south-2? And I can't even call Opus 4 from EU?@ant-kurt
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.