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

#28376 Spend logs silently dropped when provider returns non-unique response IDs (Ollama Cloud)

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

## Bug Description

`LiteLLM_SpendLogs` uses the provider's response `id` field as the primary key (`request_id`). Ollama Cloud returns globally sequential IDs like `chatcmpl-213`, `chatcmpl-808`, etc. — these are shared across all users and models on Ollama's infrastructure, so they collide with previously logged requests. The INSERT silently fails on the PK constraint and the spend log is never written.

This means **all Ollama Cloud requests are invisible** in the spend logs / request log UI once the sequential counter wraps around or reuses an ID that was already recorded from a different model or session.

## Steps to Reproduce

1. Configure an Ollama Cloud model (`api_base: https://ollama.com/v1`) as an `openai/` provider 2. Send a few requests — they may or may not log depending on whether the returned `chatcmpl-NNN` ID already exists in the table 3. Query `LiteLLM_SpendLogs` — the Ollama requests are missing 4. Enable `LITELLM_LOG=DEBUG` — you can see `db_spend_update_writer.py:723 - Writing spend log to db` fires, but the row never appears

## Root Cause

`get_spend_logs_id()` in `spend_tracking_utils.py` prefers `response_obj.get("id")` over `kwargs.get("litellm_call_id")…

GitHub resolver

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

Refresh page
vote history (2 events)
#0 of 0 · 31d19h1m18s ago — entered · #import:https:::github.com:berriai:litellm post #1839
31113 requires cross-layer investigation of AWS credential discovery, Bedrock Mantle authentication, provider request construction, and compatibility testing; 28376 is comparatively localized identifier-selection and persistence handling with focused regression tests.
#0 of 0 · 31d18h56m55s ago — current · #import:https:::github.com:berriai:litellm post #1914
The left issue is harder because it requires changing cross-cutting request-control flow between middleware hooks and routing while preserving prioritization, retries, and fallback semantics. The right issue is comparatively localized to identifier handling and persistence, with focused database 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