litellm/ui/litellm-dashboard/src
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
..
app feat(router): discover kubernetes pods behind a headless service api_base (#44342) 2026-10-19 09:58:19 -07:00
components feat(ui): show kubernetes pods on the model page (#44666) 2026-10-19 09:58:20 -07:00
contexts feat(telemetry): add the Admin UI telemetry settings page and gated page navigation events (#45494) 2026-10-13 20:12:11 -07:00
data
hooks feat(telemetry): add the Admin UI telemetry settings page and gated page navigation events (#45494) 2026-10-13 20:12:11 -07:00
lib feat(proxy): opt-in self-serve budget edits for key owners on /key/update (#44763) 2026-10-19 11:40:38 -07:00
utils fix(proxy)!: end a chat completions stream with an error event when a guardrail blocks mid-stream (#46953) 2026-10-17 18:00:12 -07:00
next-types.d.ts feat(traces): tracing development seed (#44363) 2026-10-03 09:59:51 +00:00
types.ts