6 views
-/https://github.com/berriai/litellm/issues/31441
GitHub · issue

#31441 [Bug]: `end_user` in SpendLogs is pinned to the first request's `user` for all subsequent requests on a shared virtual key (regression in v1.87.0)

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

When multiple requests are sent through a **single shared virtual key**, each carrying a different OpenAI-style `user` field, the `end_user` column in `LiteLLM_SpendLogs` (and the per-end-user spend in `LiteLLM_EndUserTable`) is **pinned to the `user` value of the first request seen on that key**. Every later request on the same key is mis-attributed to that first end-user.

**Expected:** each spend-log row records the `user` value supplied on *that* request, so spend is attributable per end-user even when many users share one virtual key.

**Actual:** all rows show the first end-user (`alice` below), and `LiteLLM_EndUserTable` bills the entire shared key's spend to that one end-user.

This breaks per-user cost attribution / chargeback when a key is shared across users (e.g. one key per team or per session, with `user` distinguishing individuals). Per-request end-user rate limits (`end_user_tpm_limit` / `end_user_rpm_limit`) and `allowed_model_region` are pinned the same way, since they travel together on the cached token.

Note: `request_tags`…

GitHub resolver

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

Refresh page
vote history (3 events)
#0 of 0 · 31d18h58m13s ago — entered · #import:https:::github.com:berriai:litellm post #1996
The left requires tracing shared-key caching and request-scoped metadata through proxy execution, persistence, accounting, and related limits, with substantial regression-testing risk. The right is comparatively localized navigation-state handling in the authentication/UI flow.
The right issue is harder because it likely requires tracing shared-key caching, request-scoped metadata lifecycles, persistence, concurrency, and regression coverage across proxy and spend-limit paths. The left issue is comparatively localized to Anthropic request transformation and focused validation.
#0 of 0 · 31d18h43m20s ago — current · #import:https:::github.com:berriai:litellm post #2243
#31441 is harder because it requires diagnosing and safely changing cross-request cached state across accounting, limits, and regional routing, with concurrency, backward-compatibility, and regression-test risks. #32451 is primarily an additive UI/API configuration change following existing visibility-setting patterns.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search