7 views
-/https://github.com/berriai/litellm/issues/34801
GitHub · issue

#34801 [Bug]: OpenAI gpt-5.6 prompt caching: litellm under-counts cache-read tokens vs OpenAI billed usage, overstating cost ~8.5%

  • State: open
  • Author: @sarveshb-p72
  • Labels: proxy, llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

We ran a clean cost reconciliation of litellm against OpenAI for `openai/gpt-5.6-sol`, comparing the `StandardLoggingPayload` litellm emits (captured via the `s3_v2` callback into a mock S3) against what OpenAI actually billed for the same requests on platform.openai.com/usage

litellm under-counts cache-read tokens, and because those tokens fall back to the fresh-input / cache-write rates, spend is overstated by roughly 8.5%

| | litellm (StandardLoggingPayload) | OpenAI (billed) | Δ | | --- | --- | --- | --- | | requests | 40 | 40 | 0 | | input tokens | 73,550 | 73,550 | 0 | | output tokens | 20,480 | 20,480 | 0 | | cached tokens | 49,563 | 65,304 | -15,741 | | cost | $0.939487 | $0.865846 | +$0.073641 (+8.5%) |

Request count, input tokens, and output tokens reconcile exactly, so litellm is receiving usage from OpenAI on every call. The only field that diverges is the cache-read count: OpenAI billed 65,304 tokens at the cached-input rate, litellm recognized 49,563, about 24% fewer

Those 15,741 tokens are the entire cost gap. OpenAI priced t…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h25m56s ago — entered · #import:https:::github.com:berriai:litellm post #2433
The left issue is harder because it requires tracing provider usage normalization, cache-token accounting, pricing calculations, and reconciliation tests across logging and billing paths. The right issue appears more localized to request-header handling and encoding behavior, with a narrower compatibility-focused fix.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search