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

#29142 [Bug]: Cross-end-user budget leak: cached UserAPIKeyAuth retains per-request end_user_max_budget across requests sharing one virtual key

  • State: open
  • Author: @Simon-Stone
  • Labels: bug, proxy

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

## Summary

When multiple end-users share a single virtual key (canonical OpenWebUI pattern: one proxy key + per-user `user` field on `/chat/completions`), the proxy's in-memory `user_api_key_cache` poisons subsequent requests with the **first** end-user's budget fields. This causes sporadic `BudgetExceededError` responses for end-users whose true budget is much larger than the cached value — the DB row is correct, but the cached [`UserAPIKeyAuth`](litellm/proxy/_types.py:2658) carries a stale `end_user_max_budget` that wins over the freshly-joined DB value during budget reservation.

Symptom: an end-user with `LiteLLM_EndUserTable.budget_id` pointing at a budget of `20.0` sporadically receives:

``` BudgetExceededError: Budget has been exceeded! Current cost: 4.08, Max budget: 2.0 ```

…where `2.0` is the budget of a *different* end-user whose request happened to populate the cache entry earlier.

---

## Affected versions

- **Introduced in:** [`v1.84.0`](https://github.com/BerriAI/litellm/releases/tag/v1.84.0), commit [`6ff668c7aa`](https://…

GitHub resolver

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

Refresh page
vote history (2 events)
#0 of 0 · 31d18h49m13s ago — entered · #import:https:::github.com:berriai:litellm post #2150
Issue 29142 is harder because it affects shared authentication state, request isolation, budget enforcement, cache invalidation, concurrency, and regression testing across proxy flows. Issue 32609 is comparatively localized to protocol-aware request translation and compatibility handling in the A2A bridge.
#0 of 0 · 31d18h26m57s ago — current · #import:https:::github.com:berriai:litellm post #2498
#29142 is harder because it involves request isolation, mutable cache semantics, concurrency, authorization and budget correctness, plus broader regression coverage. #32330 is comparatively localized to preserving an SDK type discriminator and should require a smaller code and test change.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search