7 views
-/https://github.com/berriai/litellm/issues/34492
GitHub · issue

#34492 [Bug]: Applying budget_duration on an existing key/user/team doesn't reset carried spend — instant 429 on a fresh window

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

Applying a budget window (`budget_duration`) to an EXISTING key, user, or team via an update endpoint (/key/update, /user/update, /team/update) sets `budget_reset_at` but does NOT reset the carried lifetime `spend`. An entity that already accumulated spend is therefore instantly over the new cap and gets 429'd on a brand-new budget window.

A key/user/team CREATED with a budget starts at spend=0, so the update path is inconsistent with both the create path and the scheduled ResetBudgetJob (which zeroes spend at window rollover).

Two layers are affected: 1. The DB `spend` field is left unchanged on the update path. 2. The cross-pod spend counter (spend:key:<token> / spend:user:<id> / spend:team:<id>), which get_current_spend reads first, is only invalidated when `spend` is passed explicitly — not when the reset is driven by applying `budget_duration`. So even zeroing the DB spend alone would leave a warm counter at the stale value.

Expected: applying a budget window on update should re-baseline spend (both the DB field and the counter) — but O…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h30m58s ago — entered · #import:https:::github.com:berriai:litellm post #2349
34492 is harder because it spans several update paths, persistent state, distributed cache consistency, concurrency semantics, and regression coverage; 34236 is comparatively localized to packaging, filesystem permissions, and migration-image validation.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search