Skip to content

fix(pricing): add missing cache_creation_input_token_cost to azure/gpt-5.6* entries - #37773

Closed
connectsudhindra wants to merge 3 commits into
BerriAI:litellm_internal_stagingfrom
connectsudhindra:litellm_fix_azure_gpt56_cache_pricing
Closed

connectsudhindra wants to merge 3 commits into
BerriAI:litellm_internal_stagingfrom
connectsudhindra:litellm_fix_azure_gpt56_cache_pricing

Conversation

@connectsudhindra

Copy link
Copy Markdown

TLDR

Problem this solves:

  • azure/gpt-5.6* entries have no cache_creation_input_token_cost, unlike their OpenAI counterparts
  • Azure cache-write tokens for this model family are billed at $0 instead of the correct rate

How it solves it:

  • Fills in cache_creation_input_token_cost (and the above_272k/priority variants where present) on all azure/, azure/us/, and azure/eu/ gpt-5.6 entries
  • Uses the same 1.25x-of-input ratio already present on the OpenAI entries, so azure/us and azure/eu inherit their existing regional uplift automatically
  • Regenerates model_prices_and_context_window.schema.json for the one new field-suffix combination this introduces

User Flow

Before: a platform team charging back Azure OpenAI spend per team sees almost nothing billed for requests with a large cached system prompt

  1. Their service sends POST https://litellm-domain/v1/chat/completions with "model": "azure-gpt-5.6-sol" and a large system prompt
  2. The response comes back 200 with "usage": {"prompt_tokens": 2219, "prompt_tokens_details": {"cache_write_tokens": 2217}}
  3. They open https://litellm-domain/ui/?page=logs and the request shows a spend far below the real Azure OpenAI cost for those tokens

After: the same request is billed using the cache-write rate

  1. They send the same POST https://litellm-domain/v1/chat/completions with "model": "azure-gpt-5.6-sol" and the same system prompt
  2. The response comes back 200 with the same usage object
  3. https://litellm-domain/ui/?page=logs shows that request billed at the cache-creation rate, matching the Azure invoice

Relevant issues

Fixes #37631

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/test_cost_calculator.py -v
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

I don't have a live Azure OpenAI gpt-5.6 deployment or API key in this environment to curl against, so I can't capture real before/after spend the way this template asks for. The added regression test (tests/test_litellm/test_cost_calculator.py::test_azure_gpt_5_6_cache_creation_pricing_matches_openai) reproduces the issue's own repro numbers and fails without this fix, passes with it:

uv run pytest tests/test_litellm/test_cost_calculator.py -k test_azure_gpt_5_6_cache_creation_pricing_matches_openai -v

If you have a live Azure OpenAI gpt-5.6 deployment, the issue's own repro (POST a ~2,200-token system prompt to trigger a cache write, then check /spend/logs) would be the real before/after.

Type

🐛 Bug Fix

Caveats (if any)

  • Also fixed the azure/eu/* entries, which have the same missing-key bug but weren't listed in the issue

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

…t-5.6* entries

Every azure/gpt-5.6* price map entry (base, azure/us/*, azure/eu/*) was
missing cache_creation_input_token_cost and its above_272k/priority
variants, while the non-Azure counterparts had them. Since generic_cost_per_token
resolves a missing key to no rate, Azure cache-write tokens for this
model family were billed at zero instead of the 1.25x-input rate Azure
charges, same as OpenAI.

Filled in the missing keys using the same 1.25x-of-input ratio already
present on the OpenAI entries, and regenerated the JSON schema for the
one new field-suffix combination this introduces.
@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.


= seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance and include this reference: 6a4b1b73-c5ad-4218-b038-753fb6d9c8c4.

@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

= added 2 commits August 21, 2026 00:09
…del_cost writes

The test-quality gate (TQ004/TQ005) flags raw os.environ assignments
and litellm.<attr> module-global mutation in tests, since the write
outlives the test. Switch to monkeypatch.setenv/setattr, which the
existing autouse teardown already relies on elsewhere in this file.
tests/test_litellm/test_utils.py validates the price map against a
hardcoded jsonschema that has no property for
cache_creation_input_token_cost_above_272k_tokens_priority --
that combined suffix has no precedent anywhere else in the file
(OpenAI's own gpt-5.6 entries only go up to cache_creation_input_token_cost_priority),
so CI's model-prices validation rejected it as an unknown field.

Keep the fix to the three suffixes that already have OpenAI
precedent (base, above_272k_tokens, priority) and drop the
fourth. Schema regenerates back to the committed baseline with
no changes.
@codspeed

codspeed Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing connectsudhindra-gif:litellm_fix_azure_gpt56_cache_pricing (281a8b8) with litellm_internal_staging (65b4ac0)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (e17988f) during the generation of this report, so eb6296e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@connectsudhindra

Copy link
Copy Markdown
Author

Pls review and merge

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded by rolling registry audit #37902, which reverified and absorbed the provider-documented metadata changes at field level

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.

[Bug]: azure/gpt-5.6* entries missing cache_creation_input_token_cost — cache writes billed at zero since v1.97.0

2 participants