fix: apply regional pricing multiplier to all non-global regions - #2806
Merged
steebchen merged 2 commits intoJun 30, 2026
Merged
Conversation
Contributor
WalkthroughAdds AWS Bedrock regional token-price scaling for non-global regions and updates tests to cover provider expansion and downstream cost calculations, including cache-write and cache-read scenarios. ChangesAWS Bedrock Regional Pricing Uplift
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
analogpvt
force-pushed
the
fix/bedrock-regional-pricing
branch
2 times, most recently
from
June 23, 2026 19:26
b9d559c to
559ae0d
Compare
analogpvt
force-pushed
the
fix/bedrock-regional-pricing
branch
from
June 24, 2026 17:03
b80bd3d to
e2fe036
Compare
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/models/src/region-helpers.ts`:
- Around line 56-77: The regional pricing helper is still gated to aws-bedrock
only, so non-global regions for other providers never get the uplift. Update
applyAwsBedrockRegionalPricing in region-helpers.ts to apply the multiplier to
every mapping with a non-global region, and remove the providerId check so
expandProviderRegions() consistently adjusts all regional pricing while still
skipping global mappings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 31c557fd-7f82-408c-b357-0ffc19e55e16
📒 Files selected for processing (3)
apps/gateway/src/lib/costs.spec.tspackages/models/src/providers.spec.tspackages/models/src/region-helpers.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/models/src/providers.spec.ts
- apps/gateway/src/lib/costs.spec.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
This PR applies a 1.1x pricing multiplier to non-global AWS Bedrock regional mappings.
global.This PR targets only the pricing changes, as the region configs themselves are already merged in
main.Pricing rationale (why 1.1x)
The
1.1xis not arbitrary — it matches AWS Bedrock's real pricing structure, verified against the AWS pricing calculator and AWS docs:globalmappings keep1x.us/eu/apac(jp, au). The AWS pricing calculator shows this as an exact× 1.10(e.g.$1.00 → $1.10input,$5.00 → $5.50output), not a rounded approximation.Note that AWS markets this delta as "global cross-Region inference offers approximately 10% savings ... compared to geographic cross-Region inference" (AWS docs). That framing describes the same fact from the opposite end: non-global routing is a ~10% premium, and global simply avoids it. Measured as a discount the figure is actually
1 − 1/1.1 = 9.09%, which AWS rounds up to "approximately 10%." Modeling it as a× 1.1uplift on the non-global regions (rather than a× 0.9discount on global) is therefore the correct and exact representation.Summary by CodeRabbit