Repository navigation
fix(pricing): add missing cache_read_input_token_cost to azure/us/ and azure/eu/ gpt-4o-2024-11-20 - #37830
fix(pricing): add missing cache_read_input_token_cost to azure/us/ and azure/eu/ gpt-4o-2024-11-20#37830AbhAy120204 wants to merge 2 commits into
Conversation
…d azure/eu/ gpt-4o-2024-11-20 azure/us/gpt-4o-2024-11-20 and azure/eu/gpt-4o-2024-11-20 were missing cache_read_input_token_cost, causing cache-read tokens to be billed at $0. Every other azure data-zone gpt-4o entry applies the standard 1.1x uplift over the OpenAI rate (1.25e-06 -> 1.375e-06); these two entries now match. Fixes BerriAI#37823
Greptile SummaryThe PR corrects cached-token billing for the Azure US and EU GPT-4o 2024-11-20 entries.
Confidence Score: 5/5The PR appears safe to merge, with the corrected rates matching established regional pricing and covered by a focused regression test. The canonical and fallback price maps remain synchronized, the new rate matches both Azure US/EU sibling entries, and the test exercises the cached-token billing path for both affected models.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds the correct 1.375e-06 cache-read rate to both regional model entries, consistent with neighboring Azure data-zone pricing. |
| litellm/model_prices_and_context_window_backup.json | Keeps the fallback pricing map synchronized with the canonical map. |
| tests/test_litellm/test_cost_calculator.py | Adds a focused parameterized regression test that validates both metadata and calculated cached-token cost. |
Reviews (1): Last reviewed commit: "fix(pricing): add missing cache_read_inp..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…egression test Fixes TQ004 and TQ005 violations: raw os.environ assignment and litellm module-global mutation both outlive the test and leak into subsequent tests in the same process. monkeypatch restores both at teardown.
|
Superseded by #37902, the single rolling model-registry PR. Your change was re-verified against the official provider source and rolled in field by field there (see the 2026-08-22 audit run section of that description). Closing this to keep one open registry PR at a time. Thanks for the fix. |
TLDR
Problem this solves:
azure/us/gpt-4o-2024-11-20andazure/eu/gpt-4o-2024-11-20missingcache_read_input_token_costHow it solves it:
cache_read_input_token_cost: 1.375e-06to both entriesazure/us/andazure/eu/gpt-4o entryUser Flow
Before: a team using
azure/us/gpt-4o-2024-11-20with a large cached system prompt sees cache reads billed at zerohttps://litellm-domain/v1/chat/completionswithmodel: azure/us/gpt-4o-2024-11-20and a prompt containing a large previously-cached blockprompt_tokens_details.cached_tokens: 5000https://litellm-domain/ui/?page=logsand see the request logged at spend that excludes cache-read tokens: $0 instead of ~$0.007After: the same request is billed correctly
prompt_tokens_details.cached_tokens: 5000https://litellm-domain/ui/?page=logsshows the request at full spend including cache-read tokens at 1.375e-06/token (~$0.007)Relevant issues
Fixes #37823
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
This fix is a data correction with no provider API call involved. The proof is the price map values before and after.
Shared setup: run
python -c "import json; d=json.load(open('model_prices_and_context_window.json')); [print(k, d[k].get('cache_read_input_token_cost')) for k in ['azure/us/gpt-4o-2024-11-20','azure/eu/gpt-4o-2024-11-20','azure/us/gpt-4o-2024-08-06']]"at the repo rootBefore (ff02d5c)
azure/us/andazure/eu/returnNonefor cache_read while the same-familyazure/us/gpt-4o-2024-08-06returns the correct 1.375e-06After (d80663a)
Type
🐛 Bug Fix
Caveats (if any)
azure/gpt-4o-2024-11-20(non-regional) already hadcache_read_input_token_cost: 1.25e-06(OpenAI rate, no uplift) and is not changedFinal Attestation