[PR #12056] fix: prevent double-prefixing of Bedrock cross-region inference models #14049

Closed
opened 2026-02-16 18:18:52 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12056

State: closed
Merged: Yes


Summary

  • Fixed issue where Bedrock models with pre-existing cross-region inference profile prefixes (us., eu., etc.) were being double-prefixed
  • Added tests for cross-region prefix detection

Problem

Models from models.dev may already include cross-region inference profile prefixes like:

  • us.anthropic.claude-opus-4-5-20251101-v1:0 → "Claude Opus 4.5 (US)"
  • eu.anthropic.claude-opus-4-5-20251101-v1:0 → "Claude Opus 4.5 (EU)"
  • global.anthropic.claude-opus-4-5-20251101-v1:0 → "Claude Opus 4.5 (Global)"

Previously, only global. and jp. prefixes were checked, causing models with us., eu., apac., or au. prefixes to be double-prefixed (e.g., us.us.anthropic.claude-...), which AWS rejects as invalid.

Solution

Expanded the prefix check to include all cross-region inference profile prefixes:

  • global.
  • us.
  • eu.
  • jp.
  • apac.
  • au.

Models that already have a regional prefix are now passed through to the SDK without modification, while models without prefixes continue to get prefixed based on the user's region.

Backward Compatibility

This fix is backward compatible:

  • Models without prefixes (e.g., anthropic.claude-opus-4-5-20251101-v1:0) will continue to be prefixed based on the user's AWS region
  • Models with prefixes (e.g., us.anthropic.claude-opus-4-5-20251101-v1:0) will be used as-is

Fixes #12052

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12056 **State:** closed **Merged:** Yes --- ## Summary - Fixed issue where Bedrock models with pre-existing cross-region inference profile prefixes (us., eu., etc.) were being double-prefixed - Added tests for cross-region prefix detection ## Problem Models from models.dev may already include cross-region inference profile prefixes like: - `us.anthropic.claude-opus-4-5-20251101-v1:0` → "Claude Opus 4.5 (US)" - `eu.anthropic.claude-opus-4-5-20251101-v1:0` → "Claude Opus 4.5 (EU)" - `global.anthropic.claude-opus-4-5-20251101-v1:0` → "Claude Opus 4.5 (Global)" Previously, only `global.` and `jp.` prefixes were checked, causing models with `us.`, `eu.`, `apac.`, or `au.` prefixes to be double-prefixed (e.g., `us.us.anthropic.claude-...`), which AWS rejects as invalid. ## Solution Expanded the prefix check to include all cross-region inference profile prefixes: - `global.` - `us.` - `eu.` - `jp.` - `apac.` - `au.` Models that already have a regional prefix are now passed through to the SDK without modification, while models without prefixes continue to get prefixed based on the user's region. ## Backward Compatibility This fix is backward compatible: - Models **without** prefixes (e.g., `anthropic.claude-opus-4-5-20251101-v1:0`) will continue to be prefixed based on the user's AWS region - Models **with** prefixes (e.g., `us.anthropic.claude-opus-4-5-20251101-v1:0`) will be used as-is Fixes #12052
yindo added the pull-request label 2026-02-16 18:18:52 -05:00
yindo closed this issue 2026-02-16 18:18:52 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14049