litellm/litellm/models
quietjules 007d1c1b5e
feat(proxy): support budget_limits windows on internal users (#51763)
* feat(proxy): support internal user budget windows

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): make user budget migration repeatable and sync API types

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): bound lock wait for user budget migration

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): omit unset JSON windows when creating users

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(auth): retain personal budget windows for proxy admins

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): give user budget windows their own counters and keep them on the user

User window counters move to spend:user_window:<id>:<duration> in Python and Rust, so a user whose id ends in 🪟<duration> can no longer fill another user's window. /user/new stores the windows on the user only, clearing them stores null like keys, edits keep each window's stored reset, and the all-users bulk update goes through the per-user path

* fix(proxy): keep windows on team auto keys and write all users' windows in one transaction

* fix(proxy): clear spend counters on bulk spend reset and read bulk windows under the lock

An all-users bulk update that resets spend now clears each user's spend counters, so users are not left blocked by the old counter. The bulk path reads each user's stored windows after it takes the users lock, so a concurrent edit cannot be overwritten with stale resets.

JWT users created from default_internal_user_params get a reset_at on each default window, and the user window error names the spend and the limit like key and team errors do

* fix(proxy): give member-add users the default budget windows and bulk-update the users read under the lock

Team and org member add now copy default_internal_user_params.budget_limits onto the users they create, each window with its own reset_at, through the same helper the JWT upsert uses

The all-users bulk update now writes, evicts and reports the users it read after taking the users lock, so a user created before the lock gets the new limits

* test(proxy): check default window resets against the reset helper instead of the wall clock

* fix(proxy): return parsed windows from the all-users bulk update and chunk its window writes

* fix(proxy): fail an all-users bulk update whole when its transaction fails

The per-user fallback after a failed all-users transaction wrote the newest
user and then crashed on a missing user_email attribute, so the call answered
500 with one user changed. Racing window bulk updates past the 5s transaction
limit reached it. Answer 500 with no user changed instead

---------

Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-14 07:44:35 -05:00
..
__init__.py feat(budgets): add per-model tpm and rpm limit maps to budgets and customers (#50797) 2026-11-09 22:15:18 -08:00
access_group.py feat(access-groups): grant vector stores through access groups (#50290) 2026-11-12 14:59:17 -08:00
alert.py feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
autorouter_session.py fix(autorouter): compare historical and new savings consistently (#43348) 2026-09-29 12:40:19 -07:00
base.py refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
budget.py feat(proxy): customer budget rollup, reset on the budget row's window, named templates, team overrides, multi-window limits and pause_allow_increase (#51582) 2026-11-13 16:05:35 +00:00
config.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
credentials.py feat(github_copilot): support a GHE.com host on per-user Copilot credentials (#47610) 2026-10-20 14:16:35 -07:00
deployment_warning.py refactor(proxy): inject deployment warning ignores through repositories (#48592) 2026-10-30 22:57:55 +00:00
end_user.py fix(proxy): allow model instances in LiteLLM_EndUserTable validation (#41677) 2026-10-15 10:57:26 -07:00
fallback.py fix(fallback): preserve concurrent writes and serve saved configuration (#51245) 2026-11-11 15:26:23 -08:00
gateway_activity.py refactor(proxy): inject gateway activity through a typed repository (#49116) 2026-10-30 16:25:11 -07:00
managed_files.py refactor(types): replace Any with proven types in 50 files (#47818) 2026-10-21 11:58:31 +00:00
mcp_server.py feat(mcp): rate limit all MCP operations and add server-level rpm (#44600) 2026-10-07 16:30:52 -07:00
model.py fix(proxy): serialize model block responses 2026-08-29 21:22:17 -07:00
object_permission.py feat(proxy): granular key/team access control for Claude Code marketplace plugins (#40518) 2026-09-10 14:26:09 -07:00
organization.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
organization_membership.py refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
performance_alert.py feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
plugin_upload.py feat(skills): add sortable Skills Hub catalog and publication audit (#50195) 2026-11-06 00:57:33 +00:00
project.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
skill_submission.py feat(skills): let authors edit and withdraw pending submissions (#51312) 2026-11-12 08:30:10 -08:00
skills.py refactor(skills): move NewSkillRequest to litellm.models.skills (#45768) 2026-10-10 20:33:16 +00:00
spend_logs.py feat(spend-logs): add lifecycle timestamps 2026-08-18 14:16:08 -07:00
subscription_account.py feat(usage): show subscription-covered providers and account fees separately (#44772) 2026-10-30 03:58:36 -07:00
tag.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
team.py feat(access-groups): grant vector stores through access groups (#50290) 2026-11-12 14:59:17 -08:00
team_membership.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
user.py feat(proxy): support budget_limits windows on internal users (#51763) 2026-11-14 07:44:35 -05:00
user_banner.py refactor(proxy): inject database repositories through per-repository dependencies (#48507) 2026-10-30 22:57:54 +00:00
verification_token.py fix(proxy): keep a request's cache opt-in when its key has cache metadata (#50999) 2026-11-10 20:21:39 -08:00