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

#34309 [Bug]: cost_breakdown.cache_read_cost / cache_creation_cost always null for OpenAI Responses API (only read from Anthropic-style top-level usage keys)

  • State: open
  • Author: @sarveshb-p72
  • 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?

## What happened

On the OpenAI Responses API (/v1/responses) path, the total response_cost is computed correctly (cache-read and cache-write dollars are folded into prompt_tokens_cost), but the itemized StandardLoggingPayload.response_cost_breakdown fields cache_read_cost and cache_creation_cost are always None/null.

Any downstream consumer of the standard logging payload (S3, a data warehouse, cost dashboards) therefore cannot attribute spend to cache-read vs cache-write vs fresh input for OpenAI models — all prompt-side dollars appear only under input_cost. This is an attribution/observability gap; the grand total is unaffected.

## Root cause

In litellm/cost_calculator.py, the breakdown-itemization block (v1.89.1, around lines 1605-1631) only derives the cache token counts from Anthropic-style top-level usage attributes:

_cr = getattr(cost_per_token_usage_object, "cache_read_input_tokens", None) \ or (cost_per_token_usage_object.model_extra or {}).get("cache_read_input_tokens") _cc = getattr(cost_per_token_usage_object, "…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h16m38s ago — entered · #import:https:::github.com:berriai:litellm post #2563
The right-hand issue is harder because it involves stateful streaming translation, incremental tool-call assembly, provider-specific behavior, and compatibility testing across streaming and non-streaming paths. The left-hand issue is comparatively localized to usage-field extraction and cost-breakdown mapping with narrower regression coverage.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search