-
Notifications
You must be signed in to change notification settings - Fork 446
Update Amazon Bedrock models to add cross-region inference and remove deprecated models #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… deprecated models This change adds a new script to validate all Amazon Bedrock models by making a simple inference request using model identifiers. As a result of that script, made some changes to make sure all model identifiers are usable via Amazon Bedrock: - Added cross-region inference for various models including DeepSeek, Llama, Amazon Nova - Removed some reprecated/EoL'd models including Amazon Titan, Claude v2, Cohere Command Light
|
/cc @rekram1-node. This should make all Amazon Bedrock models usable without workarounds in downstream consumers (For example in Pi). |
|
Yeah I'm game to make it run whenever bedrock models are changed |
|
Appreciate u looking into this, are we gonna be able to cleanup this stuff as a result? |
|
Perfect! Now I can see the specific issue you're referring to. Looking at lines around 246, I can see there's complex logic for handling Amazon Bedrock model ID prefixes for cross-region inference. The PR you've shared addresses exactly this problem! The current code has this complex workaround logic starting around line 246: async getModel(sdk: any, modelID: string, options?: Record<string, any>) {
// Skip region prefixing if model already has a cross-region inference profile prefix
if (modelID.startsWith("global.") || modelID.startsWith("jp.")) {
return sdk.languageModel(modelID)
}
// Region resolution precedence (highest to lowest):
// 1. options.region from opencode.json provider config
// 2. defaultRegion from AWS_REGION environment variable
// 3. Default "us-east-1" (baked into defaultRegion)
const region = options?.region ?? defaultRegion
let regionPrefix = region.split("-")[0]
switch (regionPrefix) {
case "us": {
const modelRequiresPrefix = [
"nova-micro",
"nova-lite",
"nova-pro",
"nova-premier",
"nova-2",
"claude",
"deepseek",
].some((m) => modelID.includes(m))
const isGovCloud = region.startsWith("us-gov")
if (modelRequiresPrefix && !isGovCloud) {
modelID = `${regionPrefix}.${modelID}`
}
break
}
// ... more cases for eu, ap regions
}
return sdk.languageModel(modelID)
}Yes, your PR cleanup will absolutely help eliminate this workaround code! Here's why:
Your PR is exactly the type of systematic cleanup that enables removing technical debt from the OpenCode codebase. Once the model IDs are correct at the source (models.dev), the downstream workarounds become unnecessary. |
|
User opencode-agent[bot] does not have write permissions |
- Add Nova models for Global, US, EU, and APAC regions - Add Llama 3.1/3.2 cross-region profiles for US and EU - Add Claude Sonnet 4/3.7 APAC profiles - Add Claude Sonnet 4.5/3.7/3.5 US Gov profiles - Update validate-bedrock to include ap-southeast-1 region - Skip us-gov models in validation (requires GovCloud access)
|
@rekram1-node added some missing models. I believe most of that logic to add region prefix should go away as now models each will have proper region prefix themselves. I can follow up with OC to remove that logic once this PR is merged. I'll also follow up with Pi to remove the workarounds there as well. Somewhat related topic: I feel like if we add some kind of region parameter to model definition it could help downstream customers to have better model picker by filtering models in available in the selected region, now I believe when someone search for Opus 4.5, they'll see three variants (Global, US and EU). |
|
Yeah that makes sense |

This change adds a new script to validate all Amazon Bedrock models by making a simple inference request using model identifiers. As a result of that script, made some changes to make sure all model identifiers are usable via Amazon Bedrock:
Follow-up for #607. Closes #37.
Validation result before this change (80 models, 24 invalid)
Validation result after this change (67 models)
Changes Made
Models Renamed to Use Cross-Region Inference (
us.prefix)These models require the
us.prefix for cross-region inference and were renamed:anthropic.claude-3-7-sonnet-20250219-v1:0us.anthropic.claude-3-7-sonnet-20250219-v1:0deepseek.r1-v1:0us.deepseek.r1-v1:0meta.llama3-2-1b-instruct-v1:0us.meta.llama3-2-1b-instruct-v1:0meta.llama3-2-3b-instruct-v1:0us.meta.llama3-2-3b-instruct-v1:0meta.llama3-2-11b-instruct-v1:0us.meta.llama3-2-11b-instruct-v1:0meta.llama3-2-90b-instruct-v1:0us.meta.llama3-2-90b-instruct-v1:0meta.llama3-3-70b-instruct-v1:0us.meta.llama3-3-70b-instruct-v1:0meta.llama4-scout-17b-instruct-v1:0us.meta.llama4-scout-17b-instruct-v1:0meta.llama4-maverick-17b-instruct-v1:0us.meta.llama4-maverick-17b-instruct-v1:0amazon.nova-premier-v1:0us.amazon.nova-premier-v1:0amazon.nova-2-lite-v1:0us.amazon.nova-2-lite-v1:0Models Removed (Duplicates with Cross-Region Equivalents)
These models were removed because cross-region equivalents (
us.,eu.,global.) already exist:anthropic.claude-haiku-4-5-20251001-v1:0anthropic.claude-opus-4-1-20250805-v1:0anthropic.claude-opus-4-20250514-v1:0anthropic.claude-opus-4-5-20251101-v1:0anthropic.claude-sonnet-4-20250514-v1:0anthropic.claude-sonnet-4-5-20250929-v1:0Models Removed (Deprecated/End of Life)
These models have been officially deprecated by AWS and return "This model version has reached the end of its life":
amazon.titan-text-express-v1amazon.titan-text-express-v1:0:8kanthropic.claude-instant-v1anthropic.claude-v2anthropic.claude-v2:1cohere.command-light-text-v14cohere.command-text-v14