Skip to content

fix: add 1h cache pricing for vertex claude sonnet 4.6 - #26408

Closed
biubiubiuboomboomboom wants to merge 1 commit into
BerriAI:mainfrom
biubiubiuboomboomboom:codex/fix-vertex-ai-claude-sonnet-4-6-cache-pricing
Closed

fix: add 1h cache pricing for vertex claude sonnet 4.6#26408
biubiubiuboomboomboom wants to merge 1 commit into
BerriAI:mainfrom
biubiubiuboomboomboom:codex/fix-vertex-ai-claude-sonnet-4-6-cache-pricing

Conversation

@biubiubiuboomboomboom

Copy link
Copy Markdown

Summary

  • add cache_creation_input_token_cost_above_1hr for vertex_ai/claude-sonnet-4-6
  • add the same 1h cache write rate for vertex_ai/claude-sonnet-4-6@default
  • add a regression test covering Vertex Claude Sonnet 4.6 1h cache write pricing through generic_cost_per_token

Validation

  • verified locally with LITELLM_LOCAL_MODEL_COST_MAP=True that generic_cost_per_token(..., custom_llm_provider="vertex_ai") returns (6.0, 0.0) for ephemeral_1h_input_tokens=1_000_000
  • added a regression test for the same scenario

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@veria-ai

veria-ai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Low: Pricing data addition for vertex AI model

This PR adds a cache_creation_input_token_cost_above_1hr pricing field for two existing Vertex AI Claude Sonnet 4.6 model entries in the pricing JSON, along with a corresponding test. No security-relevant changes.


Status: 0 open
Risk: 1/10

Posted by Veria AI · 2026-04-24T10:14:52.867Z

@biubiubiuboomboomboom

Copy link
Copy Markdown
Author

Closing and reopening against because fork PRs to are blocked by repository policy.

@codspeed-hq

codspeed-hq Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing biubiubiuboomboomboom:codex/fix-vertex-ai-claude-sonnet-4-6-cache-pricing (e14b226) with main (7b47dff)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the missing cache_creation_input_token_cost_above_1hr field (6e-06) to the vertex_ai/claude-sonnet-4-6 and vertex_ai/claude-sonnet-4-6@default entries in the backup pricing JSON, and includes a regression test. The value 6e-06 is consistent with the same model's azure_ai/claude-sonnet-4-6 counterpart and with claude-sonnet-4-20250514 on the direct Anthropic provider.

Confidence Score: 5/5

Safe to merge — changes are limited to a data file addition and a clean, non-networked regression test.

Both changes are minimal and targeted: a JSON field addition with a value consistent across all equivalent provider entries, and a test that uses the local cost map with no external calls. No logic, routing, or auth code is touched.

No files require special attention.

Important Files Changed

Filename Overview
litellm/model_prices_and_context_window_backup.json Adds cache_creation_input_token_cost_above_1hr: 6e-06 to both vertex_ai/claude-sonnet-4-6 and vertex_ai/claude-sonnet-4-6@default; value is consistent with the model's azure_ai and anthropic pricing counterparts.
tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py Adds test_vertex_ai_claude_sonnet_4_6_1h_cache_writes_are_priced which uses the local model cost map (no real network calls) and correctly validates the new pricing field end-to-end.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["generic_cost_per_token(model='claude-sonnet-4-6', provider='vertex_ai')"] --> B["Resolve pricing key\n'vertex_ai/claude-sonnet-4-6'"]
    B --> C{"cache_creation_input_token_cost_above_1hr\npresent?"}
    C -- "Before PR: No" --> D["ephemeral_1h tokens\nbilled at 5m rate (3.75e-06)"]
    C -- "After PR: Yes (6e-06)" --> E["ephemeral_1h tokens\nbilled at 1h rate (6e-06)"]
    E --> F["prompt_cost = 1_000_000 × 6e-06 = 6.0 ✓"]
Loading

Reviews (1): Last reviewed commit: "fix: add vertex claude sonnet 4.6 1h cac..." | Re-trigger Greptile

@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants