Self-serve budget changes
By default only an admin can change a virtual key's budget. general_settings.self_serve_budget_policy lets the person who created a key, and still owns it, change that key's max_budget, budget_limits and budget_duration through /key/update without an admin. disabled is the default. lower_only lets the owner tighten the key's budget. ceiling also lets them loosen it, but only as far as they could have gone when creating the key with /key/generate.
This page also covers who else may change a key's budget: proxy admins, team admins, team admins with the member_key_budgets permission, and team members with the /key/update team permission.
How it works
LiteLLM compares the request with the key's stored budget and sorts the change into one of three kinds: it tightens the budget, it loosens it, or it touches a field that always needs an admin. lower_only lets the owner make a tightening change, ceiling also lets them make a loosening one within the ceiling, and anything else falls through to the admin rules. A team member editing a team key also needs /key/update in the team's team_member_permissions, or the request returns 401 before any of this runs. Budget fields sent to /key/regenerate follow the same owner and admin rules. Since v1.113.0
When to use it
Turn on lower_only when people manage their own keys and you want them to tighten a key without filing a ticket, for example adding a daily window to a key that runs in CI, or lowering a key's cap before sharing it with a contractor. Nothing they do this way can raise spend, so it is a safe default for most teams.
Turn on ceiling when people already create their own keys within an allowance and should be able to move budget between those keys. The owner can raise or remove a key's cap only as far as /key/generate would have let them, so the change never exceeds what they could already do by creating a new key.
The policy does not give anyone more total budget. Personal, team member and team budgets stay with admins, and each of them still caps the requests it covers. To give a person more room for a while, have an admin add a temporary budget increase. To let team leads manage their members' key budgets, enable member_key_budgets for team admins as described below.
Supported scopes
| Scope | Supported | How to set it |
|---|---|---|
| Whole proxy | No | - |
| Organization | No | - |
| Team | No | Team admins can lower the team's max_budget when team_admin_editable_team_fields lists max_budget, and raise it when it also lists raise_max_budget. See Choosing what team admins can edit |
| Team member | No | A proxy admin, team admin or org admin sets member budgets with /team/member_update |
| Project | No | - |
| Virtual key | Yes | self_serve_budget_policy under general_settings. Covers max_budget, budget_limits and budget_duration on /key/update and /key/regenerate, for the key's creator and owner |
| Internal user | No | /user/update returns 403 when a non-admin changes budget fields on their own user |
| Customer | No | - |
| Tag | No | - |
| Model access group | No | - |
| AI tool | No | - |
| Agent session | No | - |
How to use it
Turn it on
Set the policy under general_settings in config.yaml, or send it in general_settings on /config/update. The Admin UI has no toggle for it. A value other than disabled, lower_only or ceiling logs a warning and behaves as disabled.
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
self_serve_budget_policy: lower_only
The policy applies to /key/update from the API and to the Admin UI key edit form, which calls the same route. A change the policy refuses returns 403, and a ceiling change above the ceiling returns 400.
What each value allows
| Change on a key the caller created and owns | disabled | lower_only | ceiling |
|---|---|---|---|
Lower max_budget, or set one on a key that had none | Admin | Owner | Owner |
Raise max_budget, or remove it with null | Admin | Admin | Owner, within the ceiling |
Add a budget_limits window, or lower an existing window's cap | Admin | Owner | Owner |
| Raise a window's cap, or drop or rename a window | Admin | Admin | Owner, within the ceiling |
Clear budget_duration on a key with a max_budget | Admin | Owner | Owner |
Set or change budget_duration on a key with a max_budget | Admin | Admin | Owner, within the ceiling |
spend, soft_budget, budget_id, or max_budget and budget_duration on a key linked to a budget_id | Admin | Admin | Admin |
Since v1.109.0 A new budget_duration counts as loosening because it restarts the reset schedule from now, which can hand an exhausted key a fresh period. On a key without a max_budget there is no cap to reset, so budget_duration there is not treated as a budget change. Windows in budget_limits are matched by their exact budget_duration string, so renaming 7d to 1w counts as dropping a window. Re-sending the max_budget or budget_duration the key already has is not a change. Sending budget_limits always counts as one, even an identical list, which lower_only and ceiling treat as tightening, and sending spend or soft_budget at all needs an admin.
The owner is the caller whose user_id matches both the key's user_id and its created_by. A key an admin created for someone else is not self-serve for that person, and a key reassigned to another user is no longer self-serve for the person who created it.
The ceiling in ceiling mode
When the owner loosens a budget, LiteLLM checks what /key/generate would have checked for the same key.
The owner must pass the role gates in litellm_settings.key_generation_settings, which are personal_key_generation.allowed_user_roles for a personal key and team_key_generation.allowed_team_member_roles for a team key. A team member who is not a team admin also needs /key/generate in the team's team_member_permissions. Failing either one falls through to the admin rules, which return 403. See Restricting key generation.
The new max_budget, and the cap of every budget_limits window, cannot be higher than the caller's own max_budget. That is the max_budget of the key that sends the request. For a request from an Admin UI session it is the user's personal max_budget, or the session's own max_ui_session_budget cap ($1 by default) when the user has none. Going over returns 400 with cannot exceed the caller's own max_budget. A team key edited from the Admin UI has no such ceiling, just as /key/generate sets none for team keys created there.
While litellm_settings.upperbound_key_generate_params.max_budget is set, the owner cannot remove a key's max_budget. The upperbound also caps max_budget and budget_duration on every /key/update, for admins too. See Upperbound /key/generate params.
An owner who is also an admin of the key's team or its organization skips the ceiling, because the admin rules already allow the change.
Example
With ceiling on, Alice uses her own key, $ALICE_KEY, which has a max_budget of 100. She created sk-alice-ci with a max_budget of 20 and raises it to 50:
curl -X POST 'http://0.0.0.0:4000/key/update' \
-H "Authorization: Bearer $ALICE_KEY" \
-H 'Content-Type: application/json' \
-d '{"key": "sk-alice-ci", "max_budget": 50}'
Asking for 150 instead returns 400, because it is above the 100 on $ALICE_KEY. Under lower_only the raise to 50 returns 403, while adding a tighter 24h window under an existing 7d window still works:
curl -X POST 'http://0.0.0.0:4000/key/update' \
-H "Authorization: Bearer $ALICE_KEY" \
-H 'Content-Type: application/json' \
-d '{
"key": "sk-alice-ci",
"budget_limits": [
{"budget_duration": "7d", "max_budget": 20},
{"budget_duration": "24h", "max_budget": 5}
]
}'
See Multiple budget windows for how budget_limits works.
Admin rules for key budgets
These rules apply whatever the policy is set to.
| Caller | Keys | Budget fields they can change |
|---|---|---|
| Proxy admin | Any key | All of them, including spend, soft_budget and budget_id |
| Team admin | Their own keys in the team, and the team's service account keys | All of them |
Team admin with member_key_budgets | Keys owned by other members of the team | max_budget, budget_duration, soft_budget and budget_limits, in a request that changes no other field |
Team member with /key/update | Their own keys in the team, and the team's service account keys | Only what self_serve_budget_policy allows on keys they created |
On /key/update an org admin needs a role in the key's team. A team key in a team they do not belong to returns 401, and a key another user owns returns 403. Org admins change budgets for their organization's teams and members with /team/update and /team/member_update.
Team admins and member_key_budgets
Since v1.104.0 Without the permission, a team admin's /key/update on a key another member owns returns 403, whatever the request changes. With it, the request may change only max_budget, budget_duration, soft_budget and budget_limits, and a request that also changes any other field, including spend, budget_id or a temporary budget increase, returns 403 naming that field. Team admins keep full rights on their own keys and on the team's service account keys either way.
Add member_key_budgets in the Admin UI under Settings > UI > Team admin editable fields, with PATCH /update/ui_settings, or under general_settings in config.yaml. The list applies to every team admin on the proxy, for the teams they administer.
curl -X PATCH 'http://0.0.0.0:4000/update/ui_settings' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"team_admin_editable_team_fields": ["member_key_budgets"]}'
PATCH /update/ui_settings needs STORE_MODEL_IN_DB=True and replaces the whole list, so include any entries that are already enabled. See Choosing what team admins can edit for the other entries and how the config file and the database value interact.
Team members and /key/update
team_member_permissions on a team lists the routes its members may call for that team. /key/update lets a member edit their own team keys and the team's service account keys, but budget fields on those keys still need an admin, or the self-serve policy on a key the member created and owns. Under ceiling, raising a team key's budget also needs /key/generate. See Team member permissions.
Limits
The policy covers virtual keys only. Internal users cannot change their own personal budget, and team, team member, organization and project budgets stay with admins. Each of those budgets still applies to the requests it covers, so raising a key's cap never lets its owner spend past a user, team member or team budget that covers the request.
soft_budget stays admin-only because LiteLLM stores it on the key's budget row, which can be a shared tier from /budget/new. For the same reason the owner cannot change budget_id, or max_budget and budget_duration on a key linked to one.
Related
See Budgets and spend limits for every budget scope, Temporary budget increase for short-term raises an admin sets, and Role-based access controls for the roles referenced here.