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

#35525 [Bug]: Unpriced successful responses release budget reservations without recording spend

  • State: open
  • Author: @emerzon

### Summary

A request can receive a successful provider response while the cost callback has no `response_cost`. In that branch the proxy releases the request's budget reservation to zero and does not write spend or increment spend counters

### Current behavior

In `litellm/proxy/hooks/proxy_track_cost_callback.py`, the callback writes spend only when `response_cost is not None`

When `response_cost is None`, it calls `_release_budget_reservation()` and then raises an internal cost-tracking exception for model calls. The outer exception handler logs the error and suppresses it. The database spend writer and spend-counter increment path are not called from this branch

An explicit numeric `response_cost=0` follows a different branch. The issue is specifically the missing-cost case, which can occur after a successful call when pricing or usage extraction did not produce a cost

### Reproduction

Use a request that creates a budget reservation, then invoke the cost callback with a successful logging object whose cost is missing

~~~python standard_logging_object = { "response_cost": None, "model": "configured-model", "status": "success", } ~~~

With mocks around the call…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h49s ago — entered · #import:https:::github.com:berriai:litellm post #2856
The right-hand task has broader cross-cutting scope, requiring coordinated instrumentation and validation across multiple workflows; the left-hand task is comparatively localized to one accounting path.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search