[FEATURE] Make Claude model ID fully configurable (including AWS China regions and custom models)
Feature Request
Problem
Claude Code currently hardcodes the model selection logic, which prevents users from:
- Using AWS China region models - China regions (cn-northwest-1, cn-north-1) have separate model IDs that follow different naming conventions
- Using custom fine-tuned models - Organizations with custom models cannot use them with Claude Code
- Optimizing costs - Users cannot easily switch between model tiers for different workloads
- Testing new models - When new models are released, users must wait for CLI updates
Related Issues
- #2656 - AWS China regions fail with "unsupported country/region" error
- #11549 - Scenario-based model selection
- #4937 - Model selection for custom commands
Proposed Solution
Add a configuration option to fully override the model ID used by Claude Code:
# Environment variable
export CLAUDE_CODE_MODEL_ID="anthropic.claude-sonnet-4-v1:0" # AWS China
export CLAUDE_CODE_MODEL_ID="arn:aws:bedrock:us-east-1:123456789012:custom-model/my-model" # Custom model
export CLAUDE_CODE_MODEL_ID="claude-opus-4-20250514" # Future model
# OR via settings.json
{
"modelId": "anthropic.claude-sonnet-4-v1:0"
}
This would allow:
-
AWS China support - Use China-specific model IDs (e.g.,
anthropic.claude-sonnet-4-v1:0in cn-northwest-1) - Custom models - Point to fine-tuned models via ARN or custom identifiers
- Future-proofing - Use new models immediately without waiting for CLI updates
- Cost optimization - Easily switch between Haiku/Sonnet/Opus based on task complexity
AWS China Model ID Examples
AWS China regions use different model ID formats:
| Standard Region | China Region |
|---|---|
anthropic.claude-sonnet-4-20250514-v1:0 |
anthropic.claude-sonnet-4-v1:0 |
anthropic.claude-opus-4-20250514-v1:0 |
anthropic.claude-opus-4-v1:0 |
anthropic.claude-haiku-3-5-20241022-v1:0 |
anthropic.claude-haiku-3-5-v1:0 |
These models are available in:
- cn-northwest-1 (Ningxia)
- cn-north-1 (Beijing)
Implementation Notes
Current behavior:
- Claude Code maps internal model names (sonnet, opus, haiku) to specific model IDs
- This mapping is hardcoded in the CLI source
Proposed behavior:
- Check if
CLAUDE_CODE_MODEL_IDorsettings.modelIdis set - If set, use that exact model ID (no validation, pass-through)
- If not set, fallback to current hardcoded mapping
Why pass-through?
- Model IDs vary by platform (Bedrock, Vertex AI, Anthropic API)
- Model IDs vary by region (especially China vs standard regions)
- Custom models have unpredictable identifiers
- New models are released frequently
Alternative: Model Mapping File
If pass-through is too risky, allow users to define custom mappings:
// ~/.claude/model-mappings.json
{
"sonnet": "anthropic.claude-sonnet-4-v1:0",
"opus": "anthropic.claude-opus-4-v1:0",
"haiku": "anthropic.claude-haiku-3-5-v1:0"
}
This preserves the internal model selection logic while allowing regional/custom variations.
Benefits
- Unblocks AWS China users - Immediate workaround for #2656
- Enables enterprise use cases - Custom fine-tuned models
- Reduces maintenance burden - No need to hardcode every regional variant
- Future-proof - Works with models that don't exist yet
Priority
HIGH - This is blocking:
- Users in China regions (large market)
- Enterprise customers with custom models
- Early adopters wanting to test new models
Workaround (Current)
None - users in China regions or with custom models cannot use Claude Code at all.
Is this something you'd accept a PR for? I'm happy to implement this if the approach sounds reasonable.
Same as eu region users. You could switch to v2.0.28 to have a workaround.
We use AWS bedrock and are having a different issue, but wanted to let you know this is working for us:
"env": {
"AWS_REGION": "us-west-2",
"AWS_PROFILE": "<profile-name>",
"CLAUDE_CODE_USE_BEDROCK": "true",
"ANTHROPIC_MODEL": "global.anthropic.claude-opus-4-5-20251101-v1:0",
"ANTHROPIC_SMALL_FAST_MODEL": "us.anthropic.claude-haiku-4-5-20251001-v1:0",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "us.anthropic.claude-haiku-4-5-20251001-v1:0",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "global.anthropic.claude-opus-4-5-20251101-v1:0"
}
So I believe you can do this w/ Bedrock.
From this post, https://aws.plainenglish.io/configuring-claude-code-extension-with-aws-bedrock-and-how-you-can-avoid-my-mistakes-090dbed5215b I could see it works with Bedrock non-us region.
"claudeCode.preferredLocation": "sidebar",
"claudeCode.selectedModel": "eu.anthropic.claude-sonnet-4-5-20250929-v1:0",
"claudeCode.environmentVariables": [
{"name": "AWS_PROFILE", "value": "YOUR_AWS_PROFILE_NAME"},
{"name": "AWS_REGION", "value": "eu-west-1"},
{"name": "BEDROCK_MODEL_ID", "value": "YOUR_INFERENCE_PROFILE_ARN"},
{"name": "CLAUDE_CODE_USE_BEDROCK", "value": "1"}
],
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.