Skip to content

Add 1-hour cache write pricing for us-gov Haiku 4.5#28574

Merged
Sameerlite merged 6 commits into
BerriAI:litellm_010626from
Cyberfilo:fix/usgov-bedrock-anthropic-1hr-cache
Jun 1, 2026
Merged

Add 1-hour cache write pricing for us-gov Haiku 4.5#28574
Sameerlite merged 6 commits into
BerriAI:litellm_010626from
Cyberfilo:fix/usgov-bedrock-anthropic-1hr-cache

Conversation

@Cyberfilo

Copy link
Copy Markdown
Contributor

Relevant issues

Related to the us-gov pricing audit that surfaced #27120 — Haiku 4.5's us-gov entries had correct 5m rates but were missing the 1-hour cache field. Companion to the parallel Sonnet 4.5 fix PR.

Pre-Submission checklist

  • Added testing in `tests/test_litellm/` — `tests/test_litellm/test_bedrock_usgov_haiku_1hr_cache.py`.
  • My PR passes all unit tests on `make test-unit`.
  • My PR's scope is as isolated as possible — adds the 1-hour cache field to two us-gov Haiku 4.5 entries.
  • Greptile review pending — will comment `@greptileai` after open.

Type

🐛 Bug Fix

Changes

AWS Bedrock GovCloud applies a +20% premium over global Anthropic rates. For Haiku 4.5:

5m cache write 1h cache write
Global (`anthropic.claude-haiku-4-5-20251001-v1:0`) $1.25 / MTok $2.00 / MTok
us-gov (1.2× global) $1.50 / MTok (already correct) $2.40 / MTok (added in this PR)

The 5-minute rate was already at the correct +20% premium. Only the `cache_creation_input_token_cost_above_1hr` field was missing.

Adds `cache_creation_input_token_cost_above_1hr: 2.4e-06` to:

  • `bedrock/us-gov-east-1/anthropic.claude-haiku-4-5-20251001-v1:0`
  • `bedrock/us-gov-west-1/anthropic.claude-haiku-4-5-20251001-v1:0`

…in both `model_prices_and_context_window.json` and `litellm/model_prices_and_context_window_backup.json`.

Adds `tests/test_litellm/test_bedrock_usgov_haiku_1hr_cache.py` with two parametrized cases plus the 1.6× 5m-to-1h ratio invariant check.

Test plan

```sh
$ python -m pytest tests/test_litellm/test_bedrock_usgov_haiku_1hr_cache.py -v
...
============================== 2 passed in 0.10s ===============================
```

Black + ruff clean. Diff: 4 lines in JSON files (2 each) + 50 lines of new test = 54 insertions total.

@greptile-apps

greptile-apps Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds the missing cache_creation_input_token_cost_above_1hr: 2.4e-06 field to the bedrock/us-gov-east-1 and bedrock/us-gov-west-1 Haiku 4.5 entries in both pricing JSON files. The value is consistent with the existing +20% GovCloud premium: global rate is $2.00/MTok → us-gov is $2.40/MTok, and the 1.6× ratio relative to the already-correct 5m rate ($1.50/MTok) checks out.

  • Both model_prices_and_context_window.json and the backup file receive identical 2-line additions, keeping them in sync.
  • A new parametrized test in tests/test_litellm/ validates the 5m rate, the new 1h rate, and the 1.6× ratio invariant for both us-gov regions using only local file reads.

Confidence Score: 5/5

Pure data addition to two pricing JSON fields; no logic paths are altered and both files remain consistent with each other.

The change is isolated to four JSON lines adding a single well-defined pricing field. The value is mathematically correct (1.2× global, 1.6× existing 5m rate), both files are updated in lock-step, and the new tests exercise the changed entries without touching any shared infrastructure.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds cache_creation_input_token_cost_above_1hr: 2.4e-06 to both us-gov-east-1 and us-gov-west-1 Haiku 4.5 entries; value is correctly 1.2× the global $2.00/MTok rate and 1.6× the existing 5m rate.
litellm/model_prices_and_context_window_backup.json Mirrors the same two-line addition to the backup JSON, keeping root and backup in sync.
tests/test_litellm/test_bedrock_usgov_haiku_1hr_cache.py New parametrized test covering both us-gov regions; validates the 5m rate, the new 1h rate, and the 1.6× ratio invariant using only local JSON file reads (no network calls).

Reviews (3): Last reviewed commit: "chore: trigger shin-agent re-eval on ret..." | Re-trigger Greptile

Comment thread tests/test_litellm/test_bedrock_usgov_haiku_1hr_cache.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: 3/5

Why blocked:

  • 1 PR-related CI failure (This PR will be auto-closed as it lacks a screenshot for proof of fix. Please include one in the PR description. Add the screenshot-exempt label if this PR has no visible output (e.g. pure docs, CI config).) (pr_related_failures, -2 pts)

Details: Score docked for: 1 PR-related CI failure (This PR will be auto-closed as it lacks a screenshot for proof of fix. Please include one in the PR description. Add the screenshot-exempt label if this PR has no visible output (e.g. pure docs, CI config).).

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.

@Cyberfilo

Copy link
Copy Markdown
Contributor Author

@greptileai

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_haiku_1hr_cache.py -v
... 2 passed in 0.13s ...

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.

AWS Bedrock GovCloud applies a +20% premium over global Anthropic
rates. Global Haiku 4.5 5m/1h cache write is $1.25 / $2.00 per MTok;
us-gov is therefore $1.50 / $2.40 per MTok (the 5m rate was already
correct in litellm; the 1h field was missing).

Adds `cache_creation_input_token_cost_above_1hr: 2.4e-06` to the
two us-gov Haiku 4.5 entries in both pricing JSON files:

  - bedrock/us-gov-east-1/anthropic.claude-haiku-4-5-20251001-v1:0
  - bedrock/us-gov-west-1/anthropic.claude-haiku-4-5-20251001-v1:0

New parametrized regression test
tests/test_litellm/test_bedrock_usgov_haiku_1hr_cache.py pins both
entries and enforces the 1.6x 5m-to-1h ratio invariant matching the
pattern used by the existing Bedrock and Vertex 1h-cache tests.

Companion to the us-gov Sonnet 4.5 pricing fix.
@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/usgov-bedrock-anthropic-1hr-cache branch from bccd17c to 104a78f Compare May 25, 2026 08:17
@Cyberfilo Cyberfilo force-pushed the fix/usgov-bedrock-anthropic-1hr-cache branch from 0ed9f60 to de7e420 Compare May 25, 2026 11:29
@Cyberfilo

Copy link
Copy Markdown
Contributor Author

@greptileai please review commit de7e4203d3 — re-pushed to refresh the previously-verified review (shin-agent currently flagging it as edit-unverifiable). Pure-data PR adding cache_creation_input_token_cost_above_1hr: 2.4e-06 to two us-gov Haiku 4.5 entries per AWS docs (1.6× 5m). 2 parametrized regression tests.

@Sameerlite Sameerlite changed the base branch from shin_agent_oss_staging_05_22_2026 to litellm_010626 June 1, 2026 11:01
@Sameerlite Sameerlite merged commit 37102f7 into BerriAI:litellm_010626 Jun 1, 2026
25 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.

4 participants