litellm/ui
Justin Israel 40e4ade6a6
feat(proxy): opt-in self-serve budget edits for key owners on /key/update (#44763)
* feat(proxy): opt-in self-serve budget edits for key owners on /key/update

Adds general_settings.self_serve_budget_policy (disabled by default) so a
non-admin can change max_budget or budget_limits on a key they created and
still own. lower_only allows adding or lowering limits. ceiling also allows
raising or removing them when the owner could create that key with the new
budget via /key/generate (same member permissions and delegation ceiling).
soft_budget and spend stay admin-only

* fix(proxy): sync dashboard API types and cover the UI session cap on update

* test(proxy): cover team role restriction for owner budget raises

Drop two unreachable branches from the non-raising key generation check.

* fix(proxy): close self-serve budget bypasses for linked budgets, null caps and retained limits

Keys with a linked budget_id need an admin to change max_budget, owners cannot
leave a key uncapped when an upperbound max_budget is configured, and the
ceiling check now runs on the budget the key would carry after the update.

* fix(proxy): keep open key budget windows and the admin path on self-serve budget edits

A resubmitted budget_limits window now keeps its stored reset_at while that period is still
running, so adding or editing one window no longer restarts the others. Team and org admins
answer False on a ceiling loosen so they fall through to _check_key_admin_access as before.
The self-serve tests feed the team through the cache and prisma mocks instead of patching
get_team_object, and every helper is typed

* perf(proxy): group key budget windows by duration in one pass

The per-duration minimum used to rescan the whole window list once per distinct
duration, so a request with thousands of windows pinned the event loop before any
permission check ran. Sort once and take each group's minimum instead

* refactor(proxy): take budget windows as a Sequence in the delegation ceiling checks

* test(proxy): assert allowed self-serve budget edits return no denial

Also drop the unreachable assert_never arm from the exhaustive budget change match.

---------

Co-authored-by: ryan-crabbe-berri <ryan@berri.ai>
2026-10-19 11:40:38 -07:00
..
docker-entrypoint.d feat(helm): support a separate hostname per component in the componentized deploy (#46360) 2026-10-14 14:56:36 -07:00
litellm-dashboard feat(proxy): opt-in self-serve budget edits for key owners on /key/update (#44763) 2026-10-19 11:40:38 -07:00
Dockerfile feat(helm): support a separate hostname per component in the componentized deploy (#46360) 2026-10-14 14:56:36 -07:00
nginx.conf feat(helm): support a separate hostname per component in the componentized deploy (#46360) 2026-10-14 14:56:36 -07:00