Budgets and spend limits
A budget caps LiteLLM spend at one of these scopes:
- Whole proxy: all spend through the proxy.
- Organization: everything its teams and keys spend. A team's keys count toward the team's organization even when the key sets none.
- Team: everything spent on requests scoped to the team, across its keys, projects and members.
- Team member: what one person spends inside one team.
- Project: what the keys in one project spend. A project belongs to a team, so this spend also counts toward the team.
- Virtual key: what one LiteLLM API key spends.
- Internal user: what one person spends on requests outside a team, and on team requests too when
apply_user_budget_to_team_keysis on. - Customer: what one customer of your application spends, identified by the
userfield or a customer header, across every key that sends their ID. - Tag: what every request carrying the tag spends, across all keys and teams.
- Model access group: what requests to the models in the group spend, across all callers.
- AI tool: what one coding tool, such as Claude Code or Cursor, spends inside a team or for one of its members.
- Agent session: what one session of an agent spends, capped by the agent's
max_budget_per_session.
Per-model budgets can narrow a key, user or team budget to a single model. Budgets are in USD, and an optional budget_duration such as 1d, 30d or 1mo resets spend on a schedule.
LiteLLM checks every budget a request falls under before it calls the provider, and rejects the request once any of them has run out, until that budget resets or you raise it. Budgets are optional, and a scope without one has no spend limit. Budget precedence lists which budgets apply to each kind of request, and Identities explains how these scopes relate.
Everything on this page limits callers. Budget routing is a separate feature: it routes traffic away from providers, deployments or tags that have used up their own budget. Rate limits cap tokens and requests per minute and are set separately from budgets.
To create, view or delete the keys themselves, see Virtual keys. The API examples on this page use a proxy at http://0.0.0.0:4000 and an admin key in LITELLM_MASTER_KEY.
How budgets work
Where each budget is set
| Scope | Where the budget is set |
|---|---|
| Whole proxy | max_budget and budget_duration under litellm_settings |
| Organization | /organization/new or /organization/update |
| Team | /team/new or /team/update |
| Team member | team_member_budget on the team, or max_budget_in_team for one member |
| Project | /project/new or /project/update |
| Virtual key | /key/generate or /key/update |
| Internal user | /user/new or /user/update |
| Customer | Customer Management, or /customer/new for legacy end users |
| Tag | /tag/new or /tag/update |
| Model access group | PUT /access_group/{access_group}/budget |
| AI tool | PUT /team/{team_id}/ai_tool_budgets |
| Agent session | max_budget_per_session in the agent's litellm_params |
Shared budgets and inline fields
Teams, internal users and keys keep max_budget, budget_duration and related fields on their own record. Organizations, projects, customers, tags, model access groups and team memberships store their limits in a budget row referenced by budget_id, which LiteLLM creates for you when you pass budget fields such as max_budget. Keys can also reference a budget row through budget_id.
Create a reusable budget row with /budget/new and attach it by ID. One row can back many objects, such as a pricing tier that many customers share, and each object still counts its own spend against the row's limits. /budget/info, /budget/update, /budget/list and /budget/delete read and manage rows.
How stacked budgets combine
LiteLLM checks every budget a request falls under, and any scope that is over its cap rejects the request, so the strictest active cap wins. Raising one cap never lifts another: a member whose allowance goes from $120 to $240 is still blocked once the team's shared budget runs out. Access inheritance lists which caps apply to each kind of request, in the budget scope matrix.
Default budgets
These settings give objects a budget when nobody set one explicitly. All of them live under litellm_settings.
| Setting | What it covers |
|---|---|
max_budget, budget_duration | One cap on all spend through the proxy, checked on every inference request. |
max_internal_user_budget, internal_user_budget_duration | Internal users created through /user/new with the internal_user role, Admin UI SSO or lite login sign-in, and role updates to internal_user, when no budget is set. |
default_max_internal_user_budget | Older name for max_internal_user_budget, read only when that setting is unset. |
default_internal_user_params | Its max_budget and budget_duration win over the two settings above for users created through /user/new or at SSO sign-in, and are the only source for users created by JWT user_id_upsert. JWT auth is an Enterprise feature. See Provisioning without SCIM. |
default_team_params | max_budget and budget_duration for new teams that leave them out. An explicit budget_duration: null keeps a team from resetting. |
default_key_generate_params | max_budget and budget_duration for new keys that leave them out. |
upperbound_key_generate_params | The highest max_budget and other limits /key/generate accepts. |
max_end_user_budget_id | Budget row for customers that have no budget of their own, unless the calling key's end_user_budget_id names another. A plain max_end_user_budget number is not enforced, so use a budget row. |
tag_budget_config | Tag budgets declared in config. See Tags in config. |
max_ui_session_budget | USD cap for each Admin UI login session, covering playground and test-connection calls. Defaults to $1. |
default_key_max_budget_alert_emails | Alert recipients merged into every key's thresholds. See Spend alerts. |
litellm_settings:
max_internal_user_budget: 120
internal_user_budget_duration: "1mo"
default_team_params:
max_budget: 1000
budget_duration: "1mo"
max_end_user_budget_id: "free-tier"
Organizations and projects have no proxy-wide default; set their budgets when you create them.
When a budget is exceeded
A request that runs into an exhausted budget fails before LiteLLM calls the provider, with error type budget_exceeded. The settings below change the status code, let an over-budget key slow down instead of stopping, decide what happens when spend cannot be read, and control what carries over at reset.
Response code
The default status is 422. Set litellm_settings.budget_exceeded_status_code to 429 to restore the status that older releases returned. Agent session budgets return a 429 rate limit error instead, and tag budgets in config fail as a routing error. See HTTP status codes for how clients can tell a budget error from a provider error.
Throttle instead of block
A key that is over its own max_budget can keep serving at reduced throughput. Set throttle_on_budget_exceeded: true on the key with /key/generate or /key/update, which only a proxy admin can do, and set litellm_settings.budget_exceeded_throttle_percentage to a fraction between 0 and 1. The over-budget key then runs at that fraction of its TPM and RPM limits, never below 1. Keys without a TPM or RPM limit stay blocked, and the setting does not change how team, user or other scope budgets are enforced.
Fail-closed vs fail-open
Budget checks read current spend from a counter in Redis by default. Set general_settings.fail_closed_budget_enforcement: true to validate spend against the database on every budgeted request, and to reject a request with a 503 when its spend cannot be verified against either store instead of admitting it. LiteLLM also reserves each request's estimated cost before the call, so a burst of concurrent requests cannot all pass a budget that only some of them fit; general_settings.disable_budget_reservation: true turns that off. See Hard budget enforcement and Budget reservation.
Reroute on model breach
When a key's per-model cap is reached, budget_fallbacks on the key reroutes the request down a chain of other models instead of rejecting it, for example from gpt-6.1-sol to gpt-6-luna. See Budget fallbacks and Per-model budgets.
Rollover at reset
By default a reset starts the next window at zero spend. Two settings change what carries over.
litellm_settings.budget_rollover: true carries overage forward. Spend above the cap at reset counts against the next window, so a $100 budget that ended a window at $110 starts the next one at $10. It applies to key, user, team, team member, organization, project, tag, model access group and customer budgets.
rollover_max_budget carries unused budget forward as credit, up to a ceiling. Set it on an internal user with /user/new or /user/update, or set team_member_rollover_max_budget on a team as the default for its members. The ceiling covers the base budget plus carried credit, must be higher than max_budget, and needs a budget_duration. A user with max_budget: 100 and rollover_max_budget: 200 who spent $40 starts the next window with $160 available.
curl -X POST 'http://0.0.0.0:4000/user/update' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"user_id": "alice", "max_budget": 100, "budget_duration": "1mo", "rollover_max_budget": 200}'
Spend alerts
Soft budgets
A soft_budget never blocks a request. Keys, teams and projects send an alert when their spend crosses it. Key soft budget alerts go to your configured alerting destinations; see Soft budget alerts for virtual keys. Team soft budget alerts are emailed only to the addresses in the team's metadata.soft_budget_alerting_emails; see Team soft budget alerts. Customer Management sends its own budget webhooks.
Alert recipients
Budget alerts go to the destinations listed in general_settings.alerting, such as Slack, webhooks or email. Email alerts on max budget thresholds need an Enterprise license and take a map from a percentage of max_budget to recipients: metadata.max_budget_alert_emails on a key or a team, metadata.team_member_max_budget_alert_emails on a team for each member, and litellm_settings.default_key_max_budget_alert_emails as a baseline merged into every key. A key without a map alerts its owner at 80 percent of its max_budget. See Configure budget alerts.
Alert de-duplication
Each email threshold sends at most once per EMAIL_BUDGET_ALERT_TTL seconds, 24 hours by default, for the same key, team or member. Slack and webhook budget alerts repeat at most once per general_settings.alerting_args.budget_alert_ttl, also 24 hours by default.
Roles and permissions
Admins
Proxy admins can set and change every budget. A budget change on /key/update also passes for the team admin or org admin of the key's team, though a team admin needs member_key_budgets in general_settings.team_admin_editable_team_fields to change a key another member owns; anyone else gets a 403 unless self-serve is enabled. Team admins change team settings only where a proxy admin lists the field in general_settings.team_admin_editable_team_fields. With max_budget listed they can keep or lower the team's budget, adding raise_max_budget lets them raise it up to the organization's cap, and they can never remove it. See Choosing what team admins can edit.
Self-serve by key owners
general_settings.self_serve_budget_policy lets the person who created a key, and still owns it, change its budget through /key/update without an admin. disabled is the default. lower_only lets the owner add or lower limits. ceiling also lets them raise or remove limits, but only to values they could have set when creating the key with /key/generate. See Let key owners edit their own key budgets.
Personal budgets on team keys
A team-scoped key is governed by the team and team member budgets, and the owner's personal max_budget does not apply by default. Set general_settings.apply_user_budget_to_team_keys: true to enforce it as well. See Apply user budgets to team keys.
Team member permissions
team_member_permissions on a team lists the routes its members may call for that team, for example /key/update to edit the team's keys, or /team/daily/activity and /spend/logs to see the whole team's usage. Budget edits through /key/update still follow the rules above. See Team member permissions.
Audit budget changes
With audit logging on, LiteLLM records each create, update and delete of a key, team or internal user, including budget edits, with the values before and after the change, who made it and the API key used. Changes made through /budget/* or the organization, project, tag and customer endpoints are not recorded. Audit logging is on by default with an Enterprise license, and litellm_settings.store_audit_logs turns it on or off explicitly.
To record the person behind a change that an automation key makes, send a litellm-changed-by header. LiteLLM uses it as changed_by only when the calling key or its team has metadata.allow_litellm_changed_by_header: true; otherwise it records the caller's user ID. See Audit logs and Attribute management changes to users.
Organization, team, and project budgets
Organizations contain teams, teams contain projects, and keys can belong to any of them. Spend from every key under a container counts toward its budget. A team's max_budget cannot exceed its organization's when you set it, but LiteLLM does not add up team budgets; the organization's cap is checked separately on each request. See Organization for the full walkthrough, including the Admin UI steps.
An organization or project budget requires a LiteLLM Enterprise license. Start a free 30-day trial or book a demo. See what Enterprise includes.
Set a container budget
Pass max_budget, budget_duration and optionally soft_budget to /team/new, /organization/new or /project/new. Organizations and projects also accept a budget_id. A team can set team_member_budget as each member's default allowance at the same time. With Terraform, use the litellm_team, litellm_organization, litellm_project and litellm_budget resources; see Terraform.
curl -X POST 'http://0.0.0.0:4000/team/new' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{
"team_alias": "research",
"max_budget": 1000,
"soft_budget": 800,
"budget_duration": "1mo",
"team_member_budget": 120,
"team_member_budget_duration": "1mo"
}'
Check a container budget
/team/info, /organization/info and /project/info return the container's current spend alongside its budget fields.
Change or remove a container budget
Send new values to /team/update, /organization/update or /project/update. Only a proxy admin, or an org admin for a team in their organization, can remove a team's cap with max_budget: null.
Default team budgets
New teams that leave out max_budget or budget_duration take them from litellm_settings.default_team_params. Organizations and projects have no proxy-wide default.
API key budgets
Set a key budget at creation
/key/generate takes max_budget, budget_duration and soft_budget, or a budget_id that links a budget row; a key without its own budget_duration then follows that row's reset schedule. budget_limits sets several windows at once, such as a daily and a monthly cap; see Set multiple budget windows on a key. Per-model budgets cap individual models.
curl -X POST 'http://0.0.0.0:4000/key/generate' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{"max_budget": 100, "budget_duration": "30d", "soft_budget": 80}'
Check a key budget and spend
/key/info returns the key's spend for the current window, total_spend across all windows, model_spend by model, and budget_reset_at.
Add or change a key budget
Send the new values to /key/update. Who may change them is covered in Roles and permissions.
Temporary budget increases
temp_budget_increase and temp_budget_expiry on /key/update add to the key's max_budget until the expiry time, and both must be set together. See Temporary budget increase.
Remove a key budget
Send max_budget: null to /key/update, and budget_duration: null to stop resets.
API key default budgets
litellm_settings.default_key_generate_params fills in max_budget and budget_duration for new keys that leave them out, and litellm_settings.upperbound_key_generate_params caps the values /key/generate accepts. See Default /key/generate params and Upperbound /key/generate params.
User budgets
A person can hold a budget in three places at once: their own account, each team they belong to, and each organization they belong to.
Personal budget
max_budget and budget_duration on /user/new or /user/update cap the user's personal spend. It applies to keys with no team; team-scoped keys skip it unless general_settings.apply_user_budget_to_team_keys is true. rollover_max_budget lets unused budget carry forward; see Rollover at reset and Internal user.
Budget inside a team
A team's team_member_budget and team_member_budget_duration give every member the same default allowance, and max_budget_in_team on /team/member_add or /team/member_update overrides it for one member. The team's own cap still applies to all members together. See Team members and Team member budget precedence.
Budget inside an organization
/organization/member_update accepts max_budget_in_organization, and LiteLLM tracks the member's spend in that organization. Requests are not rejected when that spend reaches it, so use a team member budget to enforce a per-person cap.
Check and change a user budget
/user/info returns the user's spend and budget. Change a personal budget with /user/update or /user/bulk_update, and a team member's budget with /team/member_update.
User default budgets
max_internal_user_budget and internal_user_budget_duration cover users created through the API, Admin UI or lite login, default_internal_user_params overrides them on those paths, and only default_internal_user_params covers JWT-provisioned users; see Default budgets. A team's team_member_budget is the default inside that team. For tiered allowances without SCIM, see Tiered SSO budgets.
Customer budgets
Customers are the people or accounts your application serves, separate from LiteLLM's internal users; see Customers and end users.
Customer Management
Since v1.111.0Customer Management tracks customers as organizations, teams and members, identified by request headers. Each level takes its own budget, and member budget templates give every member a default allowance. Set them in the Admin UI or through /management/v1/customer_organizations, /management/v1/customer_teams and /management/v1/customer_members. See Customer Management and Set customer budgets and read usage.
Legacy end users
Older integrations send the customer's ID in the user request field or in the x-litellm-customer-id or x-litellm-end-user-id header. Give that customer a budget with /customer/new or /customer/update, passing max_budget or a budget_id but not both. /customer/info returns its spend and /customer/delete removes the record. See Setting customer budgets.
Default customer budget
A customer with no budget of its own uses the budget row named by the calling key's end_user_budget_id, otherwise litellm_settings.max_end_user_budget_id. A numeric max_end_user_budget is not enforced. See Customer budget resolution and Default budget for all customers.
Tag budgets
Tags in the database
Create a tag with /tag/new, passing max_budget, soft_budget or budget_duration, or a budget_id. Spend from requests that carry the tag, through the key's tags or the request's own tags, counts toward it, and requests are rejected once the tag is over its cap. /tag/info, /tag/update and /tag/delete read, change and remove it. See Tag budgets.
Tags in config
Defining tag budgets in config requires a LiteLLM Enterprise license. Start a free 30-day trial or book a demo. See what Enterprise includes.
litellm_settings.tag_budget_config declares tag budgets in config.yaml, each with a max_budget and a budget_duration. The router's budget limiter enforces them, as described in Budget routing. These config tags are separate from tags created with /tag/new.
Model access group budgets
A model access group can share one budget across every key that reaches a model in the group. Set it with PUT /access_group/{access_group}/budget, read it with GET and remove it with DELETE on the same path. See Model access group budgets.
Per-model budgets
Per-model budgeting on keys and teams requires a LiteLLM Enterprise license. Start a free 30-day trial or book a demo. See what Enterprise includes.
model_max_budget caps spend on individual models underneath a scope's overall budget. Keys, internal users, teams and budget rows accept it, and team_member_model_max_budget applies it to each member of a team. Each entry takes budget_limit and time_period, or their aliases max_budget and budget_duration. On keys and users an entry can name a model, a * pattern such as claude-opus*, or a model access group. Team entries need a budget_duration and do not accept TPM or RPM limits.
A request to a capped model is rejected once that model's spend reaches its limit, while the scope's other models keep working until the overall budget runs out. With budget fallbacks the key reroutes to another model instead. See Virtual key (model specific) and Internal user (model specific).
{
"max_budget": 100,
"budget_duration": "30d",
"model_max_budget": {
"gpt-6.1-sol": {"budget_limit": 40, "time_period": "30d"}
},
"budget_fallbacks": {
"gpt-6.1-sol": ["gpt-6-luna"]
}
}
Budgets and spend tracking
No prepaid balance
Budgets cap spend; they do not hold a prepaid balance. Spend is LiteLLM's own cost calculation for each request, so a budget is only as accurate as the model prices behind it. See Spend tracking and Custom pricing.
Spend fields
| Field | Where | Meaning |
|---|---|---|
spend | Every scope that carries a budget | Spend in the current window, reset at budget_reset_at |
total_spend | Keys and team memberships | Lifetime spend, never reset |
model_spend | Keys, internal users, teams, projects and organizations | Spend broken down by model |
budget_reset_at | Scopes with a budget_duration | When the current window ends |
Reset job
A background job finds budgets whose budget_reset_at has passed and resets them. It runs every 597 to 605 seconds by default; general_settings.proxy_budget_rescheduler_min_time and proxy_budget_rescheduler_max_time, or the PROXY_BUDGET_RESCHEDULER_MIN_TIME and PROXY_BUDGET_RESCHEDULER_MAX_TIME environment variables, change the interval. Daily, weekly and monthly windows align to calendar boundaries in the configured timezone. See Budget reset times and timezones and Reset budgets.
Window storage
Spend for each budget_limits window, on keys, teams, internal users and in Customer Management, is kept per entity and window in the LiteLLM_BudgetWindowSpend table, so each window resets on its own schedule.