Skip to content

Conversation

@ikeda-tomoya-swx
Copy link
Contributor

@ikeda-tomoya-swx ikeda-tomoya-swx commented Jan 5, 2026

Problem

When using Amazon Bedrock with the jp. cross-region inference profile prefix (e.g., jp.anthropic.claude-sonnet-4-5-20250929-v1:0), OpenCode incorrectly adds an additional region prefix, causing the model invocation to fail.

Currently, OpenCode only skips region prefixing for models starting with global., but AWS Bedrock also provides a jp. (Japan) cross-region inference profile, which is required for using certain models in the ap-northeast-1 (Tokyo) region.

Example

When configuring:

{
  "model": "amazon-bedrock/jp.anthropic.claude-sonnet-4-5-20250929-v1:0"
}

With AWS_REGION=ap-northeast-1, OpenCode currently transforms this to apac.jp.anthropic.claude-sonnet-4-5-20250929-v1:0, which is invalid.

Solution

Add jp. to the list of prefixes that skip automatic region prefixing, alongside the existing global. prefix.

Changes

  • Modified packages/opencode/src/provider/provider.ts to recognize jp. prefix as a cross-region inference profile prefix that should not have additional region prefixes added.

Background

The jp. prefix is a Japan-specific cross-region inference profile provided by AWS Bedrock. Unlike the apac. prefix (which covers broader Asia Pacific regions), the jp. prefix routes requests specifically to the Japan (Tokyo) region infrastructure.

Some models like Claude Sonnet 4.5 are available with the jp. inference profile but not with the apac. profile, making this fix necessary for users in the Japan region.

Testing

Tested with:

  • Model: jp.anthropic.claude-sonnet-4-5-20250929-v1:0
  • Region: ap-northeast-1
  • Result: Model invocation succeeds without incorrect prefix transformation

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

The following comment was made by an LLM, it may be inaccurate:

Duplicate PR Check Results

No duplicates found.

The search returned only the PR in question itself (PR #6916). The related PRs found are not duplicates but may be relevant for context:

Related PRs (for reference):

Conclusion:

This appears to be a new, unique fix addressing a specific gap in Bedrock cross-region inference profile support. There are no open PRs attempting to solve the same issue with the jp. prefix.

@rekram1-node
Copy link
Collaborator

/review

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

lgtm

@rekram1-node rekram1-node merged commit bf9ee32 into anomalyco:dev Jan 5, 2026
3 checks passed
ryanwyler pushed a commit to gignit/opencode that referenced this pull request Jan 6, 2026
ruuxi pushed a commit to ruuxi/ngmicode that referenced this pull request Jan 7, 2026
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.

2 participants