Skip to content

Conversation

@unexge
Copy link
Contributor

@unexge unexge commented Feb 3, 2026

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 deprecated/EoL'd models including Amazon Titan, Claude v2, Cohere Command Light

Follow-up for #607. Closes #37.


Validation result before this change (80 models, 24 invalid)
Found 80 models to validate via inference
Testing against regions: us-west-2, us-east-1, eu-central-1
Concurrency: 3, Max attempts: 3

⚠️  This will make actual API calls (minimal token usage)

[1/80] ai21.jamba-1-5-mini-v1:0: ✓ (us-east-1)
[2/80] ai21.jamba-1-5-large-v1:0: ✓ (us-east-1)
[3/80] amazon.nova-2-lite-v1:0: ✗ Not found in any region
[4/80] amazon.nova-lite-v1:0: ✓ (us-east-1)
[5/80] amazon.nova-premier-v1:0: ✗ Not found in any region
[6/80] amazon.nova-micro-v1:0: ✓ (us-east-1)
[7/80] amazon.titan-text-express-v1: ✗ Not found in any region
[8/80] amazon.titan-text-express-v1:0:8k: ✗ Not found in any region
[9/80] amazon.nova-pro-v1:0: ✓ (us-east-1)
[10/80] anthropic.claude-3-5-sonnet-20241022-v2:0: ✓ (us-west-2)
[11/80] anthropic.claude-3-5-sonnet-20240620-v1:0: ✓ (us-west-2)
[12/80] anthropic.claude-3-5-haiku-20241022-v1:0: ✓ (us-west-2)
[13/80] anthropic.claude-3-haiku-20240307-v1:0: ✓ (us-west-2)
[14/80] anthropic.claude-3-opus-20240229-v1:0: ✓ (us-west-2)
[15/80] anthropic.claude-3-7-sonnet-20250219-v1:0: ✗ Not found in any region
[16/80] anthropic.claude-3-sonnet-20240229-v1:0: ✓ (us-west-2)
[17/80] anthropic.claude-haiku-4-5-20251001-v1:0: ✗ Not found in any region
[18/80] anthropic.claude-instant-v1: ✗ Not found in any region
[19/80] anthropic.claude-opus-4-20250514-v1:0: ✗ Not found in any region
[20/80] anthropic.claude-opus-4-5-20251101-v1:0: ✗ Not found in any region
[21/80] anthropic.claude-opus-4-1-20250805-v1:0: ✗ Not found in any region
[22/80] anthropic.claude-sonnet-4-20250514-v1:0: ✗ Not found in any region
[23/80] anthropic.claude-sonnet-4-5-20250929-v1:0: ✗ Not found in any region
[24/80] anthropic.claude-v2: ✗ Not found in any region
[25/80] anthropic.claude-v2:1: ✗ Not found in any region
[26/80] cohere.command-light-text-v14: ✗ Not found in any region
[27/80] cohere.command-r-plus-v1:0: ✓ (us-west-2)
[28/80] cohere.command-r-v1:0: ✓ (us-west-2)
[29/80] cohere.command-text-v14: ✗ Not found in any region
[30/80] deepseek.r1-v1:0: ✗ Not found in any region
[31/80] deepseek.v3-v1:0: ✓ (us-west-2)
[32/80] eu.anthropic.claude-haiku-4-5-20251001-v1:0: ✓ (eu-central-1)
[33/80] eu.anthropic.claude-opus-4-5-20251101-v1:0: ✓ (eu-central-1)
[34/80] global.anthropic.claude-haiku-4-5-20251001-v1:0: ✓ (us-west-2)
[35/80] eu.anthropic.claude-sonnet-4-5-20250929-v1:0: ✓ (eu-central-1)
[36/80] eu.anthropic.claude-sonnet-4-20250514-v1:0: ✓ (eu-central-1)
[37/80] global.anthropic.claude-sonnet-4-5-20250929-v1:0: ✓ (us-west-2)
[38/80] global.anthropic.claude-sonnet-4-20250514-v1:0: ✓ (us-west-2)
[39/80] global.anthropic.claude-opus-4-5-20251101-v1:0: ✓ (us-west-2)
[40/80] google.gemma-3-27b-it: ✓ (us-west-2)
[41/80] google.gemma-3-4b-it: ✓ (us-west-2)
[42/80] google.gemma-3-12b-it: ✓ (us-west-2)
[43/80] meta.llama3-1-8b-instruct-v1:0: ✓ (us-west-2)
[44/80] meta.llama3-1-70b-instruct-v1:0: ✓ (us-west-2)
[45/80] meta.llama3-2-11b-instruct-v1:0: ✗ Not found in any region
[46/80] meta.llama3-2-90b-instruct-v1:0: ✗ Not found in any region
[47/80] meta.llama3-2-3b-instruct-v1:0: ✗ Not found in any region
[48/80] meta.llama3-2-1b-instruct-v1:0: ✗ Not found in any region
[49/80] meta.llama3-8b-instruct-v1:0: ✓ (us-west-2)
[50/80] meta.llama3-70b-instruct-v1:0: ✓ (us-west-2)
[51/80] meta.llama3-3-70b-instruct-v1:0: ✗ Not found in any region
[52/80] minimax.minimax-m2: ✓ (us-west-2)
[53/80] meta.llama4-scout-17b-instruct-v1:0: ✗ Not found in any region
[54/80] meta.llama4-maverick-17b-instruct-v1:0: ✗ Not found in any region
[55/80] mistral.ministral-3-8b-instruct: ✓ (us-west-2)
[56/80] mistral.ministral-3-14b-instruct: ✓ (us-west-2)
[57/80] mistral.mistral-7b-instruct-v0:2: ✓ (us-west-2)
[58/80] mistral.mixtral-8x7b-instruct-v0:1: ✓ (us-west-2)
[59/80] mistral.mistral-large-2402-v1:0: ✓ (us-west-2)
[60/80] mistral.voxtral-mini-3b-2507: ✓ (us-west-2)
[61/80] mistral.voxtral-small-24b-2507: ✓ (us-west-2)
[62/80] nvidia.nemotron-nano-12b-v2: ✓ (us-west-2)
[63/80] moonshot.kimi-k2-thinking: ✓ (us-west-2)
[64/80] openai.gpt-oss-120b-1:0: ✓ (us-west-2)
[65/80] nvidia.nemotron-nano-9b-v2: ✓ (us-west-2)
[66/80] openai.gpt-oss-20b-1:0: ✓ (us-west-2)
[67/80] openai.gpt-oss-safeguard-120b: ✓ (us-west-2)
[68/80] qwen.qwen3-235b-a22b-2507-v1:0: ✓ (us-west-2)
[69/80] openai.gpt-oss-safeguard-20b: ✓ (us-west-2)
[70/80] qwen.qwen3-32b-v1:0: ✓ (us-west-2)
[71/80] qwen.qwen3-coder-480b-a35b-v1:0: ✓ (us-west-2)
[72/80] qwen.qwen3-coder-30b-a3b-v1:0: ✓ (us-west-2)
[73/80] qwen.qwen3-vl-235b-a22b: ✓ (us-west-2)
[74/80] qwen.qwen3-next-80b-a3b: ✓ (us-west-2)
[75/80] us.anthropic.claude-haiku-4-5-20251001-v1:0: ✓ (us-west-2)
[76/80] us.anthropic.claude-opus-4-5-20251101-v1:0: ✓ (us-west-2)
[77/80] us.anthropic.claude-opus-4-1-20250805-v1:0: ✓ (us-west-2)
[78/80] us.anthropic.claude-opus-4-20250514-v1:0: ✓ (us-west-2)
[79/80] us.anthropic.claude-sonnet-4-20250514-v1:0: ✓ (us-west-2)
[80/80] us.anthropic.claude-sonnet-4-5-20250929-v1:0: ✓ (us-west-2)
======================================================================
SUMMARY
======================================================================
Total models: 80
Succeeded: 56
Failed: 24
----------------------------------------------------------------------
FAILED MODELS:
----------------------------------------------------------------------
  - amazon.nova-2-lite-v1:0
    Error: Not found in any region
  - amazon.nova-premier-v1:0
    Error: Not found in any region
  - amazon.titan-text-express-v1
    Error: Not found in any region
  - amazon.titan-text-express-v1:0:8k
    Error: Not found in any region
  - anthropic.claude-3-7-sonnet-20250219-v1:0
    Error: Not found in any region
  - anthropic.claude-haiku-4-5-20251001-v1:0
    Error: Not found in any region
  - anthropic.claude-instant-v1
    Error: Not found in any region
  - anthropic.claude-opus-4-1-20250805-v1:0
    Error: Not found in any region
  - anthropic.claude-opus-4-20250514-v1:0
    Error: Not found in any region
  - anthropic.claude-opus-4-5-20251101-v1:0
    Error: Not found in any region
  - anthropic.claude-sonnet-4-20250514-v1:0
    Error: Not found in any region
  - anthropic.claude-sonnet-4-5-20250929-v1:0
    Error: Not found in any region
  - anthropic.claude-v2
    Error: Not found in any region
  - anthropic.claude-v2:1
    Error: Not found in any region
  - cohere.command-light-text-v14
    Error: Not found in any region
  - cohere.command-text-v14
    Error: Not found in any region
  - deepseek.r1-v1:0
    Error: Not found in any region
  - meta.llama3-2-11b-instruct-v1:0
    Error: Not found in any region
  - meta.llama3-2-1b-instruct-v1:0
    Error: Not found in any region
  - meta.llama3-2-3b-instruct-v1:0
    Error: Not found in any region
  - meta.llama3-2-90b-instruct-v1:0
    Error: Not found in any region
  - meta.llama3-3-70b-instruct-v1:0
    Error: Not found in any region
  - meta.llama4-maverick-17b-instruct-v1:0
    Error: Not found in any region
  - meta.llama4-scout-17b-instruct-v1:0
    Error: Not found in any region
Validation result after this change (67 models)
Found 67 models to validate via inference
Testing against regions: us-west-2, us-east-1, eu-central-1
Concurrency: 3, Max attempts: 3

⚠️  This will make actual API calls (minimal token usage)

[1/67] ai21.jamba-1-5-mini-v1:0: ✓ (us-east-1)
[2/67] amazon.nova-lite-v1:0: ✓ (us-east-1)
[3/67] ai21.jamba-1-5-large-v1:0: ✓ (us-east-1)
[4/67] anthropic.claude-3-5-haiku-20241022-v1:0: ✓ (us-west-2)
[5/67] amazon.nova-micro-v1:0: ✓ (us-east-1)
[6/67] amazon.nova-pro-v1:0: ✓ (us-east-1)
[7/67] anthropic.claude-3-haiku-20240307-v1:0: ✓ (us-west-2)
[8/67] anthropic.claude-3-5-sonnet-20240620-v1:0: ✓ (us-west-2)
[9/67] anthropic.claude-3-5-sonnet-20241022-v2:0: ✓ (us-west-2)
[10/67] anthropic.claude-3-sonnet-20240229-v1:0: ✓ (us-west-2)
[11/67] anthropic.claude-3-opus-20240229-v1:0: ✓ (us-west-2)
[12/67] cohere.command-r-plus-v1:0: ✓ (us-west-2)
[13/67] cohere.command-r-v1:0: ✓ (us-west-2)
[14/67] deepseek.v3-v1:0: ✓ (us-west-2)
[15/67] eu.anthropic.claude-haiku-4-5-20251001-v1:0: ✓ (eu-central-1)
[16/67] eu.anthropic.claude-sonnet-4-20250514-v1:0: ✓ (eu-central-1)
[17/67] eu.anthropic.claude-opus-4-5-20251101-v1:0: ✓ (eu-central-1)
[18/67] eu.anthropic.claude-sonnet-4-5-20250929-v1:0: ✓ (eu-central-1)
[19/67] global.anthropic.claude-haiku-4-5-20251001-v1:0: ✓ (us-west-2)
[20/67] global.anthropic.claude-sonnet-4-20250514-v1:0: ✓ (us-west-2)
[21/67] global.anthropic.claude-opus-4-5-20251101-v1:0: ✓ (us-west-2)
[22/67] google.gemma-3-12b-it: ✓ (us-west-2)
[23/67] google.gemma-3-27b-it: ✓ (us-west-2)
[24/67] global.anthropic.claude-sonnet-4-5-20250929-v1:0: ✓ (us-west-2)
[25/67] meta.llama3-1-8b-instruct-v1:0: ✓ (us-west-2)
[26/67] google.gemma-3-4b-it: ✓ (us-west-2)
[27/67] meta.llama3-1-70b-instruct-v1:0: ✓ (us-west-2)
[28/67] meta.llama3-8b-instruct-v1:0: ✓ (us-west-2)
[29/67] meta.llama3-70b-instruct-v1:0: ✓ (us-west-2)
[30/67] minimax.minimax-m2: ✓ (us-west-2)
[31/67] mistral.mistral-7b-instruct-v0:2: ✓ (us-west-2)
[32/67] mistral.ministral-3-8b-instruct: ✓ (us-west-2)
[33/67] mistral.ministral-3-14b-instruct: ✓ (us-west-2)
[34/67] mistral.mixtral-8x7b-instruct-v0:1: ✓ (us-west-2)
[35/67] mistral.mistral-large-2402-v1:0: ✓ (us-west-2)
[36/67] mistral.voxtral-mini-3b-2507: ✓ (us-west-2)
[37/67] mistral.voxtral-small-24b-2507: ✓ (us-west-2)
[38/67] moonshot.kimi-k2-thinking: ✓ (us-west-2)
[39/67] nvidia.nemotron-nano-12b-v2: ✓ (us-west-2)
[40/67] openai.gpt-oss-120b-1:0: ✓ (us-west-2)
[41/67] openai.gpt-oss-20b-1:0: ✓ (us-west-2)
[42/67] nvidia.nemotron-nano-9b-v2: ✓ (us-west-2)
[43/67] openai.gpt-oss-safeguard-120b: ✓ (us-west-2)
[44/67] openai.gpt-oss-safeguard-20b: ✓ (us-west-2)
[45/67] qwen.qwen3-235b-a22b-2507-v1:0: ✓ (us-west-2)
[46/67] qwen.qwen3-32b-v1:0: ✓ (us-west-2)
[47/67] qwen.qwen3-coder-480b-a35b-v1:0: ✓ (us-west-2)
[48/67] qwen.qwen3-coder-30b-a3b-v1:0: ✓ (us-west-2)
[49/67] qwen.qwen3-vl-235b-a22b: ✓ (us-west-2)
[50/67] qwen.qwen3-next-80b-a3b: ✓ (us-west-2)
[51/67] us.amazon.nova-2-lite-v1:0: ✓ (us-west-2)
[52/67] us.amazon.nova-premier-v1:0: ✓ (us-west-2)
[53/67] us.anthropic.claude-3-7-sonnet-20250219-v1:0: ✓ (us-west-2)
[54/67] us.anthropic.claude-haiku-4-5-20251001-v1:0: ✓ (us-west-2)
[55/67] us.anthropic.claude-opus-4-5-20251101-v1:0: ✓ (us-west-2)
[56/67] us.anthropic.claude-opus-4-1-20250805-v1:0: ✓ (us-west-2)
[57/67] us.anthropic.claude-opus-4-20250514-v1:0: ✓ (us-west-2)
[58/67] us.deepseek.r1-v1:0: ✓ (us-west-2)
[59/67] us.anthropic.claude-sonnet-4-20250514-v1:0: ✓ (us-west-2)
[60/67] us.anthropic.claude-sonnet-4-5-20250929-v1:0: ✓ (us-west-2)
[61/67] us.meta.llama3-2-1b-instruct-v1:0: ✓ (us-west-2)
[62/67] us.meta.llama3-2-3b-instruct-v1:0: ✓ (us-west-2)
[63/67] us.meta.llama3-2-11b-instruct-v1:0: ⊘ Geo-restricted
[64/67] us.meta.llama3-2-90b-instruct-v1:0: ⊘ Geo-restricted
[65/67] us.meta.llama3-3-70b-instruct-v1:0: ✓ (us-west-2)
[66/67] us.meta.llama4-maverick-17b-instruct-v1:0: ⊘ Geo-restricted
[67/67] us.meta.llama4-scout-17b-instruct-v1:0: ⊘ Geo-restricted
======================================================================
SUMMARY
======================================================================
Total models: 67
Succeeded: 63
Skipped (geo-restricted): 4
Failed: 0
----------------------------------------------------------------------
SKIPPED MODELS (geo-restricted, exist but not testable from this location):
----------------------------------------------------------------------
  - us.meta.llama3-2-11b-instruct-v1:0
  - us.meta.llama3-2-90b-instruct-v1:0
  - us.meta.llama4-maverick-17b-instruct-v1:0
  - us.meta.llama4-scout-17b-instruct-v1:0


Changes Made

Models Renamed to Use Cross-Region Inference (us. prefix)

These models require the us. prefix for cross-region inference and were renamed:

Old Model ID New Model ID Display Name
anthropic.claude-3-7-sonnet-20250219-v1:0 us.anthropic.claude-3-7-sonnet-20250219-v1:0 Claude Sonnet 3.7 (US)
deepseek.r1-v1:0 us.deepseek.r1-v1:0 DeepSeek-R1 (US)
meta.llama3-2-1b-instruct-v1:0 us.meta.llama3-2-1b-instruct-v1:0 Llama 3.2 1B Instruct (US)
meta.llama3-2-3b-instruct-v1:0 us.meta.llama3-2-3b-instruct-v1:0 Llama 3.2 3B Instruct (US)
meta.llama3-2-11b-instruct-v1:0 us.meta.llama3-2-11b-instruct-v1:0 Llama 3.2 11B Instruct (US)
meta.llama3-2-90b-instruct-v1:0 us.meta.llama3-2-90b-instruct-v1:0 Llama 3.2 90B Instruct (US)
meta.llama3-3-70b-instruct-v1:0 us.meta.llama3-3-70b-instruct-v1:0 Llama 3.3 70B Instruct (US)
meta.llama4-scout-17b-instruct-v1:0 us.meta.llama4-scout-17b-instruct-v1:0 Llama 4 Scout 17B Instruct (US)
meta.llama4-maverick-17b-instruct-v1:0 us.meta.llama4-maverick-17b-instruct-v1:0 Llama 4 Maverick 17B Instruct (US)
amazon.nova-premier-v1:0 us.amazon.nova-premier-v1:0 Nova Premier (US)
amazon.nova-2-lite-v1:0 us.amazon.nova-2-lite-v1:0 Nova 2 Lite (US)

Models 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:0
  • anthropic.claude-opus-4-1-20250805-v1:0
  • anthropic.claude-opus-4-20250514-v1:0
  • anthropic.claude-opus-4-5-20251101-v1:0
  • anthropic.claude-sonnet-4-20250514-v1:0
  • anthropic.claude-sonnet-4-5-20250929-v1:0

Models 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":

Model ID Status
amazon.titan-text-express-v1 End of life
amazon.titan-text-express-v1:0:8k End of life
anthropic.claude-instant-v1 End of life
anthropic.claude-v2 End of life
anthropic.claude-v2:1 End of life
cohere.command-light-text-v14 End of life
cohere.command-text-v14 End of life

… 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
@unexge
Copy link
Contributor Author

unexge commented Feb 3, 2026

/cc @rekram1-node. This should make all Amazon Bedrock models usable without workarounds in downstream consumers (For example in Pi).
Not sure if we want to run the Bedrock validator on the CI as it takes some time to run, and it consumes some tokens. Maybe we can just run them whenever we update Bedrock models, but I think it's useful to have a validation script to verify all model identifiers are valid.

@rekram1-node
Copy link
Contributor

Yeah I'm game to make it run whenever bedrock models are changed

@rekram1-node
Copy link
Contributor

Appreciate u looking into this, are we gonna be able to cleanup this stuff as a result?

https://github.com/anomalyco/opencode/blob/dcff5b6596cfe94135a2bd59406e874194177fe2/packages/opencode/src/provider/provider.ts#L246

@opencode-agent
Copy link
Contributor

opencode-agent bot commented Feb 3, 2026

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:

  1. Root Cause: The complex logic exists because some Bedrock models were defined without proper cross-region prefixes in the models.dev database, requiring runtime workarounds to add prefixes like us., eu., global., etc.

  2. Your Solution: By updating the model IDs directly in the TOML files to include the correct prefixes (e.g., us.amazon.nova-premier-v1:0, us.deepseek.r1-v1:0), you eliminate the need for this runtime transformation.

  3. Cleanup Opportunity: Once all Bedrock models have correct prefixes in the models.dev database, much of this complex switch/case logic can be simplified or removed entirely.

  4. Benefits:

    • Cleaner, more maintainable code
    • Fewer runtime transformations
    • More predictable model ID handling
    • Reduced complexity in the provider logic

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.

New%20session%20-%202026-02-03T18%3A14%3A35.484Z
opencode session  |  github run

@opencode-agent
Copy link
Contributor

opencode-agent bot commented Feb 3, 2026

User opencode-agent[bot] does not have write permissions

github run

- 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)
@unexge
Copy link
Contributor Author

unexge commented Feb 3, 2026

@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).

@rekram1-node
Copy link
Contributor

Yeah that makes sense

@rekram1-node rekram1-node merged commit 02f7969 into anomalyco:dev Feb 3, 2026
1 check passed
@unexge unexge deleted the push-lpupkorvtnuw branch February 3, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS Bedrock cross-region inference

2 participants