8 views
-/https://github.com/berriai/litellm/issues/28854
GitHub · issue

#28854 [Bug]: `input_cost_per_token_cache_hit` is a dead pricing field — silently under-bills cache hits

  • State: open
  • Author: @silencedoctor
  • Labels: llm translation

### Check for existing issues

I searched the existing issues and did not find a duplicate.

### What happened?

`input_cost_per_token_cache_hit` is declared in the pricing schema (`ModelInfoBase` in [`litellm/types/utils.py`](https://github.com/BerriAI/litellm/blob/main/litellm/types/utils.py)) and accepted by the field-name allowlist in `tests/test_litellm/test_utils.py`, but **no code path in the cost calculator reads it**. The canonical key actually consumed by the calculator is `cache_read_input_token_cost`.

When a model entry declares only the legacy key:

- `cache_read_input_token_cost` resolves to `None` → `0.0` via `_get_cost_per_unit` - Prompt-cache-hit tokens are subtracted from `text_tokens` in [`_calculate_input_cost`](https://github.com/BerriAI/litellm/blob/main/litellm/litellm_core_utils/llm_cost_calc/utils.py) (so they are *not* charged at the full input rate either) - Net effect: cache-hit tokens are billed at **$0** rather than the intended cache-read rate

This is a footgun for both human contributors and AI-assisted PRs adding new model entries: copying nearby DeepSeek configs that historically used `input_cost_per_token_cache_hit` produces a config that **look…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h21m15s ago — entered · #import:https:::github.com:berriai:litellm post #2494
#32941 has unspecified scope and therefore carries greater discovery and implementation uncertainty, while #28854 appears narrowly bounded to pricing-key compatibility, calculator handling, and regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search