fix: add 1h cache pricing for vertex claude sonnet 4.6 - #26409
Conversation
Low: No security issues foundThis PR adds a Status: 0 open Posted by Veria AI · 2026-04-24T10:40:59.348Z |
Greptile SummaryThis PR adds Confidence Score: 5/5This PR is safe to merge — it adds a missing pricing field to both the production and backup JSON files, with two complementary regression tests covering both paths. Both JSON files (root production and bundled backup) are correctly updated. The previous gap where the root file was missing the field has been addressed in this version of the PR. The new test in test_claude_opus_4_6_config.py directly asserts the root JSON contains the field, closing the test coverage gap from prior review. The factory.py diff is purely cosmetic reformatting with no logic impact. No P0 or P1 issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds cache_creation_input_token_cost_above_1hr: 6e-06 for both vertex_ai/claude-sonnet-4-6 and vertex_ai/claude-sonnet-4-6@default — addresses previous concern about the root production file being missing the field. |
| litellm/model_prices_and_context_window_backup.json | Adds the same cache_creation_input_token_cost_above_1hr: 6e-06 entries to the bundled backup JSON for both vertex_ai model variants. |
| tests/test_litellm/test_claude_opus_4_6_config.py | New test test_vertex_ai_claude_sonnet_4_6_has_1h_cache_write_pricing_in_root_map directly reads the root JSON file to confirm both vertex_ai entries contain the correct 1h cache pricing field. |
| litellm/litellm_core_utils/prompt_templates/factory.py | Pure Black formatter reformatting of multi-line expressions — no logic changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[generic_cost_per_token\ncustom_llm_provider=vertex_ai\nmodel=claude-sonnet-4-6] --> B{Load model info}
B -->|LITELLM_LOCAL_MODEL_COST_MAP=True| C[model_prices_and_context_window_backup.json]
B -->|Production remote fetch| D[model_prices_and_context_window.json]
C --> E[cache_creation_input_token_cost_above_1hr: 6e-06]
D --> E
E --> F{Token type?}
F -->|ephemeral_5m_input_tokens| G[cost x 3.75e-06]
F -->|ephemeral_1h_input_tokens| H[cost x 6e-06]
H --> I[prompt_cost = 6.0 for 1M tokens]
Reviews (4): Last reviewed commit: "style: format prompt template factory" | Re-trigger Greptile
e14b226 to
45f3857
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
cache_creation_input_token_cost_above_1hrforvertex_ai/claude-sonnet-4-6vertex_ai/claude-sonnet-4-6@defaultgeneric_cost_per_tokenValidation
LITELLM_LOCAL_MODEL_COST_MAP=Truethatgeneric_cost_per_token(..., custom_llm_provider="vertex_ai")returns(6.0, 0.0)forephemeral_1h_input_tokens=1_000_000