Skip to content

Fix us-gov-{east,west}-1 Bedrock Sonnet 4.5 pricing#28573

Merged
Sameerlite merged 7 commits into
BerriAI:litellm_010626from
Cyberfilo:fix/27120-us-gov-bedrock-sonnet-4-5-pricing
Jun 1, 2026
Merged

Fix us-gov-{east,west}-1 Bedrock Sonnet 4.5 pricing#28573
Sameerlite merged 7 commits into
BerriAI:litellm_010626from
Cyberfilo:fix/27120-us-gov-bedrock-sonnet-4-5-pricing

Conversation

@Cyberfilo

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes #27120.

Pre-Submission checklist

  • Added testing in `tests/test_litellm/` — `tests/test_litellm/test_bedrock_usgov_pricing.py` (6 cases, all pass).
  • My PR passes all unit tests on `make test-unit`.
  • My PR's scope is as isolated as possible — touches only the five us-gov sonnet-4-5 entries.
  • Greptile review pending — will comment `@greptileai` after open.

Type

🐛 Bug Fix

Changes

AWS GovCloud Bedrock pricing carries a +20% premium over the global Anthropic rates, not the +10% premium that applies to commercial US regions. Litellm's five us-gov Claude Sonnet 4.5 entries mirror the commercial-US prices, undercharging customers by ~9%.

Per the AWS Bedrock pricing page:

Field Old (commercial US value) New (AWS GovCloud value)
`input_cost_per_token` 3.3e-06 3.6e-06 ($3.60/MTok)
`output_cost_per_token` 1.65e-05 1.8e-05 ($18.00/MTok)
`cache_creation_input_token_cost` 4.125e-06 4.5e-06 ($4.50/MTok)
`cache_read_input_token_cost` 3.3e-07 3.6e-07 ($0.36/MTok)
`cache_creation_input_token_cost_above_1hr` (missing) 7.2e-06 ($7.20/MTok)

Files

  • `model_prices_and_context_window.json` — corrects five us-gov sonnet-4-5 entries.
  • `litellm/model_prices_and_context_window_backup.json` — same change, 1:1 mirror.
  • `tests/test_litellm/test_bedrock_usgov_pricing.py` — new regression test with six parametrized cases. Includes a 1.2× global→us-gov ratio invariant matching the style of the existing `test_bedrock_anthropic_1hr_cache_pricing.py` and `test_vertex_anthropic_1hr_cache_pricing.py` tests.

Entries corrected

  • `bedrock/us-gov-east-1/anthropic.claude-sonnet-4-5-20250929-v1:0`
  • `bedrock/us-gov-west-1/anthropic.claude-sonnet-4-5-20250929-v1:0`
  • `bedrock/us-gov-east-1/claude-sonnet-4-5-20250929-v1:0` (alias without the `anthropic.` prefix)
  • `bedrock/us-gov-west-1/claude-sonnet-4-5-20250929-v1:0` (alias without the `anthropic.` prefix)
  • `us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0` (cross-region inference profile)

Test plan

```sh
$ python -m pytest tests/test_litellm/test_bedrock_usgov_pricing.py -v
...
============================== 6 passed in 0.32s ===============================
```

Black + ruff clean. Diff is +50 lines, -40 lines (each corrected entry has one fewer line because the 1-hour cache field is now inserted but the 5m field already had a trailing comma — net is balanced; the 10 added lines are the 1-hour field across the 5 entries × 2 files).

Note on scope

The same +10% / +20% confusion likely affects us-gov entries for Haiku 4.5 and other Bedrock-hosted Anthropic models in the GovCloud regions. I limited this PR to the model specifically named in #27120 to keep scope tight; happy to extend coverage in a follow-up.

@greptile-apps

greptile-apps Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects the AWS GovCloud (us-gov-east-1, us-gov-west-1) Bedrock pricing for Claude Sonnet 4.5 from the commercial-US +10% premium to the correct GovCloud +20% premium over global Anthropic rates, and adds a 1-hour cache write tier that was previously absent. All five affected entries have been verified as exactly 1.2× the global rates.

  • Pricing data (model_prices_and_context_window.json + backup): 4 bedrock/us-gov-*/ entries and the us-gov.anthropic.* cross-region inference profile updated; the cross-region profile also has its _above_200k_tokens tier fields corrected and cache_creation_input_token_cost_above_1hr_above_200k_tokens added.
  • Tests (test_bedrock_usgov_pricing.py): New parametrized regression suite covering all 5 model keys, all base pricing fields, the 5 _above_200k_tokens fields on the cross-region profile, and the 1.2× ratio invariant against the global entry.

Confidence Score: 5/5

Safe to merge — purely a JSON pricing data correction with no logic changes and a comprehensive new test suite that locks in the correct values.

All updated pricing values verify exactly as 1.2× the global rates. The new tests cover every field that was previously wrong, including the _above_200k_tokens tier on the cross-region profile that was flagged in the prior review round. Both JSON files are kept in sync. No code paths are modified.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Corrects 5 us-gov Sonnet 4.5 entries to the +20% GovCloud premium; all updated values verify as exactly 1.2× the global rates
litellm/model_prices_and_context_window_backup.json 1:1 mirror of main JSON — same 5 entries corrected with identical values
tests/test_litellm/test_bedrock_usgov_pricing.py New regression tests covering all 5 us-gov model keys, base pricing fields, 200k-tier fields on the cross-region profile, and the 1.2× ratio invariant

Reviews (4): Last reviewed commit: "Apply us-gov 200k-tier GovCloud premium ..." | Re-trigger Greptile

Comment thread tests/test_litellm/test_bedrock_usgov_pricing.py
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

🤖 litellm-agent: This PR is currently BLOCKED from merge.

Score: 2/5

Why blocked:

  • 1 PR-related CI failure (Greptile gate: score 3/5 below required 4/5 — request a Greptile review (@greptileai) and resolve its comments before maintainer review.) (pr_related_failures, -2 pts)
  • Greptile 3/5 (greptile_low, -1 pts)

Details: Score docked for: 1 PR-related CI failure (Greptile gate: score 3/5 below required 4/5 — request a Greptile review (@greptileai) and resolve its comments before maintainer review.); Greptile 3/5.

Fix the issues above and push an update — the bot will re-review automatically.

Note: This bot is still in beta and might not always work as expected. Please share any feedback via Slack.

Terrajlz and others added 2 commits May 22, 2026 13:45
Squash-merged by litellm-agent from devauxbr's PR.
@Cyberfilo

Copy link
Copy Markdown
Contributor Author

Proof of fix

This is a pure data / pricing-JSON change with no visible runtime output — adding the screenshot-exempt justification by surfacing the regression-test run instead.

$ python -m pytest tests/test_litellm/test_*bedrock_usgov_pricing.py -v
... 6 passed in 0.32s ...

JSON validity is also enforced by the existing test_aaamodel_prices_and_context_window_json_is_valid test. Black + ruff clean.

Requesting screenshot-exempt triage per the gate's own instructions for data-only PRs.

@Cyberfilo

Copy link
Copy Markdown
Contributor Author

@greptileai

)

AWS GovCloud Bedrock pricing carries a +20% premium over the global
Anthropic rates, not the +10% premium that applies to commercial US
regions. Litellm's five us-gov Claude Sonnet 4.5 entries mirror the
commercial-US prices (3.3e-06 input, 1.65e-05 output, 4.125e-06 cache
write), undercharging customers by ~9%.

Corrects all five affected entries in both
model_prices_and_context_window.json and the bundled
model_prices_and_context_window_backup.json to match AWS's
published GovCloud rates (per https://aws.amazon.com/bedrock/pricing/):

  - input_cost_per_token              3.3e-06  -> 3.6e-06   ($3.60/MTok)
  - output_cost_per_token             1.65e-05 -> 1.8e-05   ($18.00/MTok)
  - cache_creation_input_token_cost   4.125e-06 -> 4.5e-06  ($4.50/MTok)
  - cache_read_input_token_cost       3.3e-07  -> 3.6e-07   ($0.36/MTok)
  - cache_creation_input_token_cost_above_1hr  (added)      ($7.20/MTok)

Affected entries:
  - bedrock/us-gov-east-1/anthropic.claude-sonnet-4-5-20250929-v1:0
  - bedrock/us-gov-west-1/anthropic.claude-sonnet-4-5-20250929-v1:0
  - bedrock/us-gov-east-1/claude-sonnet-4-5-20250929-v1:0
  - bedrock/us-gov-west-1/claude-sonnet-4-5-20250929-v1:0
  - us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0

New regression test
tests/test_litellm/test_bedrock_usgov_pricing.py pins the corrected
rates across all five entries and asserts the 1.2x global-to-us-gov
ratio invariant, matching the pattern used by the existing Vertex
and EU/AU/JP Bedrock pricing tests.
@Cyberfilo Cyberfilo changed the base branch from litellm_internal_staging to shin_agent_oss_staging_05_22_2026 May 25, 2026 08:17
@Cyberfilo Cyberfilo force-pushed the fix/27120-us-gov-bedrock-sonnet-4-5-pricing branch from ff3ed48 to 6cc1dad Compare May 25, 2026 08:17
{{- end }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- tpl (toYaml .) $ | nindent 8 }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: Helm annotation templates can expose render-time data

tpl evaluates annotation values as Helm templates, so a user who can set podAnnotations can add expressions like {{ .Values.postgresql.auth.password }} or {{ lookup "v1" "Secret" "ns" "name" }} and have Helm write the result into Deployment/Pod metadata. Keep annotations as literal values, or move templated annotations behind a separate opt-in value with a clear warning that it executes templates with Helm's rendering privileges.

Suggested change
{{- tpl (toYaml .) $ | nindent 8 }}
{{- toYaml . | nindent 8 }}

@veria-ai

veria-ai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

PR overview

One security issue remains open in the Helm deployment template: annotation values are evaluated as templates. A user who can control podAnnotations could cause Helm to render sensitive values or cluster data into pod metadata, creating a concrete risk of secret exposure. No issues have been addressed yet, so the PR’s security posture still depends on making annotations literal by default or clearly isolating templated annotations behind an opt-in path.

Open issues (1)

Fixed/addressed: 0 · PR risk: 7/10

@Cyberfilo

Copy link
Copy Markdown
Contributor Author

@greptileai please review commit e1c947a16b — addresses the P2 finding on us-gov.anthropic.* 200k-tier rates. Four existing fields updated from the +10% commercial-US rate to the +20% GovCloud premium, and the missing cache_creation_input_token_cost_above_1hr_above_200k_tokens field added for parity with the us. cross-region profile. Test parametrizes all 5 fields and asserts the 1.2x ratio invariant against anthropic.claude-sonnet-4-5-*.

The us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0 cross-region
inference profile carried _above_200k_tokens fields at the +10%
commercial-US rate while the base tier was correctly at +20%. AWS
GovCloud pricing applies the same +20% uplift across all tiers, so
long-context requests through this profile were undercharging by ~9%.

Updates four existing fields (input/output/cache_creation/cache_read
_above_200k_tokens) and adds cache_creation_input_token_cost_above_1hr
_above_200k_tokens for parity with the us. cross-region entry.

Extends test_bedrock_usgov_pricing.py with five parametrized field
assertions plus a 1.2x ratio invariant across all 200k-tier fields,
so any future regression on either dimension is caught.
@Cyberfilo Cyberfilo force-pushed the fix/27120-us-gov-bedrock-sonnet-4-5-pricing branch from e1c947a to 7a255ba Compare May 25, 2026 11:28
@Cyberfilo

Copy link
Copy Markdown
Contributor Author

@greptileai please review commit 7a255ba896 — re-pushed to invalidate the prior review (which is now showing as edited in shin-agent's verifier). The P2 finding on us-gov.anthropic.* 200k-tier rates is addressed: 4 fields updated to +20% GovCloud premium and a 5th (_above_1hr_above_200k_tokens) added for parity with the us. cross-region profile. Test parametrizes all 5 fields + 1.2× ratio invariant.

@Sameerlite Sameerlite changed the base branch from shin_agent_oss_staging_05_22_2026 to litellm_010626 June 1, 2026 11:07
@Sameerlite Sameerlite merged commit b26b015 into BerriAI:litellm_010626 Jun 1, 2026
32 checks passed
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.

Incorrect cost info for bedrock/us-gov-west-1/claude-sonnet-4-5-20250929-v1:0

4 participants