feat: add multi-region support for AWS Bedrock#1897
Draft
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
regionConfigto 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)regionsto Claude Sonnet 4 as a proof of concept (same pattern as Alibaba)aws_bedrock_regionto provider key options, API schemas, and UI labelsHow it works
https://bedrock-runtime.<region>.amazonaws.comregionsarray on the provider mappingexpandProviderRegionscreates separate routing candidates per region (e.g.,anthropic.claude-sonnet-4-20250514-v1:0:us-east-1)LLM_AWS_BEDROCK_API_KEY__<REGION>env varsStill TODO
regionsto remaining AWS Bedrock models (anthropic.ts, meta.ts)aws_bedrock_region_prefixin favor of direct regional endpointsTest plan
pnpm buildstripRegionFromModelNameremoves suffix before sending to AWS🤖 Generated with Claude Code