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, internal user, team, team member or customer 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. A row made with /budget/new can back many objects at once, such as a pricing tier that many customers share, while each object counts its own spend. See Shared budgets.
Budgets need a database
Proxy, organization, team, team member, key and user budgets are enforced against spend read from the database, so none of them caps anything on a deployment without a database. See Whole proxy budget for how the proxy-wide cap behaves there.
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
Settings under litellm_settings give new internal users, teams, keys and customers a budget when the request that creates them sets none, such as max_internal_user_budget, default_team_params, default_key_generate_params and max_end_user_budget_id, and a team's own team_member_budget does the same for its members. Which one applies depends on how the object is created, for example /user/new, SSO sign-in or JWT user_id_upsert. Organizations, projects, tags and model access groups have no default. See Default budgets.
Budget management features
These features change how a budget is set, counted, reset or enforced. Each has its own page with a table of the scopes it supports.
| Feature | Use it to |
|---|---|
| Shared budgets | Back many customers, keys, tags or organizations with one budget row, such as a pricing tier. |
| Default budgets | Give new users, teams, keys and customers a budget automatically. |
| Per-model budgets | Cap spend on individual models under a scope's overall budget. |
| Multiple budget windows | Enforce several caps at once, such as $10 a day and $100 a month. |
| Budget reset times and timezones | Align resets to calendar days, weeks and months in your timezone. |
| Budget rollover | Carry overspend, or unused budget, into the next period. |
| Soft budgets and budget alerts | Warn owners by Slack, webhook or email before or when a budget runs out. |
| Team soft budget alerts | Email chosen recipients when a team crosses a fixed-dollar soft budget. |
| Budget exceeded errors | Understand and change what callers get when a budget runs out. |
| Throttle over-budget keys | Slow an over-budget key down instead of stopping it. |
| Budget fallbacks | Reroute to another model when a key's per-model budget runs out. |
| Temporary budget increase | Raise a key's or team member's budget until an expiry time. |
| Budget reservation | Hold each request's estimated cost against its budgets so a burst of concurrent requests cannot overshoot. |
| Fail-closed budget enforcement | Reject requests whose spend cannot be verified during a Redis or database outage. |
| Free models and budgets | Keep zero-cost models usable after a budget runs out. |
| Self-serve budget changes | Let key owners change their own key budgets within limits. |
When a budget is exceeded
A request that runs into an exhausted budget fails before LiteLLM calls the provider. The settings below change the response, 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
Over-budget requests fail with error type budget_exceeded and status 422 by default, and litellm_settings.budget_exceeded_status_code changes the status. Agent session budgets and tag budgets in config fail differently. See Budget exceeded errors.
Throttle instead of block
A key with throttle_on_budget_exceeded: true keeps serving past its own max_budget at litellm_settings.budget_exceeded_throttle_percentage of its TPM and RPM limits. See Throttle over-budget keys.
Fail-closed vs fail-open
general_settings.fail_closed_budget_enforcement: true rejects budgeted requests with a 503 when their spend cannot be verified, instead of admitting them. See Fail-closed budget enforcement.
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. See Budget fallbacks.
Rollover at reset
litellm_settings.budget_rollover: true carries overspend into the next period, and rollover_max_budget carries a user's or team member's unused budget forward as credit. See Budget rollover.
Spend alerts
A soft_budget never blocks a request and sends an alert when spend crosses it. Max budget alerts go out by Slack, webhook or email as spend nears and crosses max_budget, with email thresholds set as percentages per key, team or team member, and each alert repeats at most once a day by default. Which scopes alert, and through which channel, differs by scope. See Soft budgets and budget alerts and Team soft budget alerts. Customer Management sends its own budget webhooks.
Roles and permissions
Admins
Proxy admins can set and change every budget. Team admins can change the budgets of keys in their team, and need member_key_budgets in general_settings.team_admin_editable_team_fields to change a key another member owns. They 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 Self-serve budget changes and 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, lower or within limits raise its budget without an admin. See Self-serve budget changes.
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. A soft_budget alerts only for teams and projects; see Soft budgets and budget alerts. Organizations and projects also accept a budget_id that links a shared budget. 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. See Default budgets.
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 Multiple budget windows. 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 budgets.
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 Budget rollover 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 Default budgets, Customer budget resolution and Default budget for all customers.
Tag budgets
Tags in the database
Create a tag with /tag/new, passing max_budget and 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
model_max_budget caps spend on individual models underneath the overall budget of a key, internal user, team, team member or legacy customer, each model with its own limit and reset window. A request to a capped model is rejected once that model's spend reaches its limit, while the scope's other models keep working, and budget fallbacks can reroute the key to another model instead. See Per-model budgets.
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 resets budgets whose budget_reset_at has passed, about every ten minutes by default, so a budget can stay blocked for a few minutes after its window ends. Daily, weekly and monthly windows align to calendar boundaries in the configured timezone. See Budget reset times and timezones.
Window storage
Spend for each budget_limits window is kept per entity and window in the LiteLLM_BudgetWindowSpend table, so each window resets on its own schedule.