Internal user budgets
An internal user budget is one person's personal cap, set with max_budget on the user. It covers the requests the user makes outside a team: every key they own that has no team, and Claude Code SSO sessions and JWT requests that act for no team. A team-scoped request skips it unless general_settings.apply_user_budget_to_team_keys is true, and inside a team the team member budget caps the person instead.
The personal cap is checked together with the key's own budget, the organization's if the key names one, and the whole proxy budget. LiteLLM checks every budget a request falls under and rejects the request when any one of them is over its cap.
How it works
A person can hold a budget in more than one place, and the three that are easy to mix up cap different things.
| Budget | Caps | Applies to | Set with |
|---|---|---|---|
| Internal user | One internal user | Their keys and sessions with no team, and team keys only with apply_user_budget_to_team_keys | max_budget on /user/new or /user/update |
| Team member | One internal user inside one team | Requests made with that team's keys | team_member_budget on the team, or max_budget_in_team for one member |
| Customer | One end user of your application, never an internal user | Requests that name the customer in the user field or a customer header, across every key | Customer Management, or /customer/new for legacy end users |
The user's spend counts every key they own, team keys included, even when the personal cap is not checked for them. A user with a $100 personal budget who spends $150 through team keys is therefore blocked on their personal keys until the budget resets or you raise it.
Personal budgets on team keys
By default a team-scoped key is governed by the key, team and team member budgets, and the owner's personal cap is skipped. Set apply_user_budget_to_team_keys to enforce the personal max_budget on team keys and team sessions as well.
general_settings:
apply_user_budget_to_team_keys: true
A service account key has no user owner, so no personal cap applies to it either way. See Personal budgets on team requests.
When to use it
Use a personal budget to give each person an allowance for their own keys, such as experiments outside any team, or to cap people who sign in through SSO and use the proxy without joining a team. With apply_user_budget_to_team_keys on, it becomes one cap across everything a person does, in every team. To cap a person's share of one team's budget, use a team member budget. To cap the people or accounts your application serves, use a customer budget, which never limits the employee who authenticates to the proxy.
Set a budget
API
Set max_budget on /user/new or /user/update. Without it, and without a default budget, the user has no personal cap. Add budget_duration to reset the user's spend on a schedule; without it the budget never resets.
curl -X POST 'http://0.0.0.0:4000/user/new' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"user_id": "alice", "models": ["gpt-6-luna"], "max_budget": 10, "budget_duration": "30d"}'
The response includes a key for the user:
{
"key": "sk-YF2OxDbrgd1y2KgwxmEA2w",
"expires": null,
"user_id": "alice",
"max_budget": 10.0
}
Once the user's spend reaches max_budget, requests fail with a budget_exceeded error, ExceededBudget: User=alice over budget., followed by the spend and the budget. See Budget exceeded errors.
Create new keys for an existing user
Call /key/generate with the user's user_id. As long as the key has no team, the user's budget is checked for it, and spend on it also updates the user's spend.
curl -X POST 'http://0.0.0.0:4000/key/generate' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"user_id": "alice", "models": ["gpt-6-luna"]}'
Admin UI
Open Internal Users, select the user, and on the Details tab select Edit Settings. Set Max Budget (USD), pick a Reset Budget period, and select Save Changes.
Cap individual models
model_max_budget on /user/new or /user/update caps what the user spends on each model. It applies across every key the user owns, team keys included. See Per-model budgets.
Check spend
GET /user/info returns the user's current spend, max_budget, budget_duration and budget_reset_at under user_info. A user can read their own record, and proxy admins and proxy admin viewers can read anyone's.
curl 'http://0.0.0.0:4000/user/info?user_id=alice' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY"
In the Admin UI, the Internal Users table shows each user's Spend (USD) and Budget (USD), and the user's Overview tab shows spend against the budget.
Change or remove a budget
Only a proxy admin can change an existing user's budget, and a user who sends budget fields for their own record gets a 403 error. Send a new max_budget or budget_duration to /user/update, or to /user/bulk_update for many users at once. Send "max_budget": null to remove the cap, and "budget_duration": null to stop resets. The spend already counted stays and is checked against the new value. In the Admin UI, edit the user as above and tick Unlimited Budget to remove the cap.
A /user/update or /user/bulk_update that sets user_role: internal_user without max_budget or budget_duration resets them to max_internal_user_budget and internal_user_budget_duration, even when the user already had that role. Include the budget fields in such a request to keep the user's current budget.
Default budget
litellm_settings.max_internal_user_budget and internal_user_budget_duration give new internal users a personal budget when the request that creates them sets none, and default_internal_user_params can set the same fields. Which one applies depends on how the user is created, through /user/new, SSO sign-in, SCIM or JWT user_id_upsert, so see Default budgets for each path. Defaults are copied onto the user at creation, so changing one later leaves existing users alone. For different allowances per group without SCIM, see Tiered SSO budgets.
Example: a default budget for every new user
This gives a personal budget to every account created with user_role="internal_user" that does not set its own max_budget. A $0 default makes the effect easy to see.
- Define the default budget in
config.yaml.
model_list:
- model_name: "gpt-6-luna"
litellm_params:
model: "gpt-6-luna"
api_key: os.environ/OPENAI_API_KEY
litellm_settings:
max_internal_user_budget: 0 # amount in USD
internal_user_budget_duration: "1mo" # reset every month
- Create an internal user without a
max_budget. The response includes a key for that user.
curl -X POST 'http://0.0.0.0:4000/user/new' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"user_role": "internal_user"}'
- Send a request with the returned key.
curl -X POST 'http://0.0.0.0:4000/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <key-from-step-2>' \
-d '{
"model": "gpt-6-luna",
"messages": [{"role": "user", "content": "Hey, how'"'"'s it going?"}]
}'
Expected response:
{
"error": {
"message": "ExceededBudget: User=<user_id> over budget. Spend=0.0, Budget=0.0",
"type": "budget_exceeded",
"param": null,
"code": "422"
}
}
Budget features
Which budget features work on internal user budgets. Each feature page lists every scope it supports.
| Feature | Supported | Details |
|---|---|---|
| Shared budgets | No | Users keep max_budget and budget_duration on the user record. |
| Default budgets | Yes | max_internal_user_budget, internal_user_budget_duration and default_internal_user_params, depending on how the user is created. |
| Per-model budgets | Yes | model_max_budget on /user/new or /user/update. Applies across every key the user owns, team keys included. |
| Multiple budget windows | Yes | budget_limits on /user/new, /user/update or /user/bulk_update Since v1.111.0. Checked only where the user's personal budget applies. |
| Budget reset times and timezones | Yes | budget_duration on /user/new or /user/update, litellm_settings.internal_user_budget_duration, and each window in its budget_limits. |
| Budget rollover, overage carry-over | Yes | Carries over for the personal budget, measured against the base budget plus any credit, and for each budget_limits window. |
| Budget rollover, unused budget carry-over | Yes | rollover_max_budget on /user/new, /user/update or /user/bulk_update, or Rollover Cap (USD) in the user's edit form. |
| Soft budgets and budget alerts | Yes | Set max_budget on /user/new or /user/update. Slack and webhook alerts at 15% and 5% left and when crossed, on requests that the personal budget applies to. No soft budget or email. |
| Team soft budget alerts | No | Users have no soft budget. |
| Budget exceeded errors | Yes | ExceededBudget: User=<user_id> over budget., or over 1d budget. for a budget_limits window |
| Throttle over-budget keys | No | A user over their personal budget is rejected. |
| Budget fallbacks | No | A user's per-model caps always reject. /user/new copies budget_fallbacks onto the key it creates, where it acts on that key's caps. |
| Temporary budget increase | No | Change the user's max_budget with /user/update |
| Budget reservation | Yes | Holds against the personal max_budget and each budget_limits window, on requests the personal budget covers. |
| Fail-closed budget enforcement | Yes | general_settings.fail_closed_budget_enforcement: true. Covers max_budget and budget_limits windows. |
| Free models and budgets | Yes | The personal max_budget, budget_limits windows and model_max_budget are not checked. |
| Self-serve budget changes | No | /user/update returns 403 when a non-admin changes budget fields on their own user |
Limits
A personal budget never applies to a service account key or to a customer ID sent with a request, since neither is an internal user. It does not cap team-scoped requests unless apply_user_budget_to_team_keys is on, even though their spend counts toward it.
Related
Team member budgets cap a person inside one team, Default budgets covers every default, and Budget precedence lists which caps apply to each kind of request.