Skip to content

feat: add multi-region support for AWS Bedrock#1897

Draft
rcogal wants to merge 6 commits intomainfrom
feat/aws-bedrock-regions
Draft

feat: add multi-region support for AWS Bedrock#1897
rcogal wants to merge 6 commits intomainfrom
feat/aws-bedrock-regions

Conversation

@rcogal
Copy link
Copy Markdown
Collaborator

@rcogal rcogal commented Mar 27, 2026

Summary

  • Add regionConfig to the AWS Bedrock provider with 6 regions (us-east-1, us-west-2, eu-west-1, eu-central-1, ap-northeast-1, ap-southeast-1)
  • Add model-level regions to Claude Sonnet 4 as a proof of concept (same pattern as Alibaba)
  • Update endpoint resolution to call regional endpoints directly when a region is selected, skipping the legacy cross-region inference prefix
  • Add aws_bedrock_region to provider key options, API schemas, and UI labels

How it works

  1. Each AWS Bedrock region maps to its own endpoint: https://bedrock-runtime.<region>.amazonaws.com
  2. Models define which regions they're available in via the regions array on the provider mapping
  3. expandProviderRegions creates separate routing candidates per region (e.g., anthropic.claude-sonnet-4-20250514-v1:0:us-east-1)
  4. Users select a region in the provider key UI → gateway locks routing to that region
  5. Per-region API keys supported via LLM_AWS_BEDROCK_API_KEY__<REGION> env vars

Still TODO

  • Add regions to remaining AWS Bedrock models (anthropic.ts, meta.ts)
  • Look up per-model region availability from AWS docs
  • Consider deprecating aws_bedrock_region_prefix in favor of direct regional endpoints

Test plan

  • Verify build passes with pnpm build
  • Test region selection in provider key creation UI
  • Test request routing to different regional endpoints
  • Verify stripRegionFromModelName removes suffix before sending to AWS

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 817c493a-0e4b-49c8-8840-125816fafb80

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/aws-bedrock-regions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

romel lauron and others added 5 commits March 28, 2026 00:43
Add region availability to all AWS Bedrock provider mappings:
- All 6 regions: Claude 3.7 Sonnet, Sonnet 4/4.5/4.6, Haiku 4.5,
  Opus 4.5/4.6
- US only (us-east-1, us-west-2): Opus 4/4.1, 3.5 Haiku/Sonnet,
  all Meta Llama models

Also fix endpoint prefix: derive cross-region inference prefix
(us./eu./apac.) from the selected region instead of skipping it,
since many newer models are CR-only on AWS Bedrock.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Model names with colons (e.g. v1:0:us-east-1) broke the naive
split(":")[0] region stripping. Add fallback lookup by searching
all model mappings when direct model.id match fails.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The model lookup in calculateCosts failed for region-expanded
names like "v1:0:us-east-1" because split(":")[0] stripped the
version too. Add fallback that searches expanded providers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	packages/models/src/models/anthropic.ts
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.

1 participant