Issue evidence · AI API · BerriAI/litellm

SpendLogs rows silently dropped when the provider reuses response ids (Ollama: chatcmpl-<0..999>)

GitHub issue: https://github.com/BerriAI/litellm/issues/46403

Reproduced

LiteLLM keys spend-log rows on the provider's response id, so a provider that reuses ids silently loses the colliding rows.

What Badgr ran

Ran LiteLLM 1.104.2 with Postgres and two local mock OpenAI-style upstreams, one returning ids chatcmpl-<0..999> at random and one returning uuid ids, sending 300 requests to each, then counted LiteLLM_SpendLogs rows.

What came back

  • Small-id upstream: 250 rows for 300 successful requests (50 lost, none logged).
  • Unique-id upstream: 300 rows for 300 requests.

The mock reproduces Ollama's id behavior; a real Ollama was not routed through the proxy in this run. A unique id from the provider is the mitigation that held here; the fix in LiteLLM would be to key rows on litellm_call_id.

Checked 2026-10-14 in Badgr’s local development environment.

← All issue evidence