6 views
-/https://github.com/berriai/litellm/issues/26807
GitHub · issue

#26807 [Bug]: Cached prompt tokens billed as regular input in custom pricing cost path

  • State: open
  • Author: @GabrielZirondi
  • Labels: bug, 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?

When `completion_cost` receives custom token pricing that includes `cache_read_input_token_cost`, cached prompt tokens are still billed at `input_cost_per_token`.

On current main, the normal model-cost-map path works. The failing path is the custom pricing shortcut, which returns before the generic cache-aware calculator runs.

Older LiteLLM versions may also show this through dashboard/DB-created models if custom pricing registration drops cache pricing fields.

### Steps to Reproduce

1. Run this minimal Python reproduction:

```python import litellm from litellm.types.utils import ModelResponse, PromptTokensDetailsWrapper, Usage

usage = Usage( prompt_tokens=6074, completion_tokens=285, total_tokens=6359, prompt_tokens_details=PromptTokensDetailsWrapper( cached_tokens=3456, audio_tokens=0, ), )

response = ModelResponse( id="test-id", created=1234567890, model="openai/gpt-5.4", object="chat.completion", choices=[], usage=usage, )

cost = litellm.completion_cost( completion_resp…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h34m30s ago — entered · #import:https:::github.com:berriai:litellm post #2308
The right issue is harder because it involves asynchronous streaming architecture, thread scheduling, provider-specific behavior, and regression-sensitive timing tests. The left issue is comparatively localized to cost calculation and pricing-field propagation.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search