fix(pricing): add missing Azure gpt-5.6 cache-write rates - #38187
Closed
jlan-nl wants to merge 1 commit into
Closed
Conversation
Contributor
Greptile SummaryAdds cache-write pricing for 12 Azure GPT-5.6 model entries so cached prompt creation is included in spend calculations
Confidence Score: 5/5The PR appears safe to merge, with consistent pricing metadata and focused regression coverage All affected Azure GPT-5.6 variants receive cache-creation rates derived consistently from their corresponding input rates, both catalogs remain synchronized, and the billing path is exercised
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds internally consistent cache-creation rates to all 12 affected Azure GPT-5.6 entries |
| litellm/model_prices_and_context_window_backup.json | Mirrors the primary pricing-catalog changes without divergence |
| tests/test_litellm/test_cost_calculator.py | Verifies every added rate against its OpenAI twin and exercises cache-write billing through the generic calculator |
Reviews (1): Last reviewed commit: "fix(pricing): add missing Azure gpt-5.6 ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Azure bills the first write of a prompt into its cache at 1.25x the input rate, but none of the azure/* gpt-5.6 entries carried cache_creation_input_token_cost. Since v1.97.0 LiteLLM classifies Azure's cache_write_tokens as cache-creation tokens, so the lookup found no rate and billed them at $0, under-billing a write-heavy prompt by ~98%. Fills the field on all 12 entries (azure/, azure/eu/ and azure/us/ across gpt-5.6, -sol, -terra and -luna) for the base, above-272k and priority tiers. Each value is derived from the Azure input rate times the OpenAI twin's cache-to-input ratio, so the 10% regional uplift on azure/eu and azure/us is preserved rather than flattened to the global number. Fixes BerriAI#37631
jlan-nl
force-pushed
the
litellm-azure-gpt56-cache-write-pricing
branch
from
August 25, 2026 08:25
c08aab1 to
0400f0b
Compare
6 tasks
Contributor
Contributor
Author
|
Closing, superseded by #38370 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a platform team charging back Azure OpenAI spend sees almost nothing billed for their RAG service, whose requests carry a large cached system prompt
"model": "azure-gpt-5.6-sol"and a ~2,200-token system prompt"usage": {"prompt_tokens": 2219, "completion_tokens": 5, "prompt_tokens_details": {"cached_tokens": 0, "cache_write_tokens": 2216}}After: the same request is billed at the cache-write rate, and the gateway total lines up with the invoice
"model": "azure-gpt-5.6-sol"and the same ~2,200-token system promptRelevant issues
Fixes #37631
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Shared setup, a live Azure OpenAI
gpt-5.6-soldeployment behind the proxy:The request body, sized so the prompt is large enough for Azure to write it to cache:
Before (31a6756)
Expected to show the cache-write tokens costing nothing, around $0.000165 against a correct $0.014015
After (0400f0b)
Expected to show the same usage object now billed at the cache-write rate, around $0.014015
Both runs are pending: no Azure gpt-5.6 deployment was available to whoever prepared this branch, so the output above is stated as an expectation rather than a captured run. The commands are ready to paste and this section will be replaced with the real output before review. In the meantime the regression test in
tests/test_litellm/test_cost_calculator.pycovers the same billing path, and every one of its 37 cases fails at the merge base and passes hereType
🐛 Bug Fix
✅ Test
Caveats (if any)