Multiple budget windows
budget_limits puts several spend caps on one object at the same time, each with its own period. A key with a 24h window of $10 and a 30d window of $100 can spend at most $10 in a day and $100 in a month, and LiteLLM rejects the next request as soon as either window is full. Each window keeps its own spend and resets on its own schedule, so the daily window opens again at midnight while the monthly window keeps counting.
Windows work on virtual keys and teams, and on internal users and Customer Management budgets Since v1.111.0. They sit next to the plain max_budget and budget_duration on the same object, which stay a separate cap that is checked as well. LiteLLM keeps each window's spend per object and window in the LiteLLM_BudgetWindowSpend table.
How it works
Before it calls the provider, LiteLLM reads the current spend of every window on the key, the key's team and, where the personal budget applies, its user, and rejects the request with a budget_exceeded error if any of them has reached its max_budget. A window's period follows the same calendar rules as budget_duration, described in Budget reset times and timezones, so 24h ends at midnight, 7d on Monday and 30d or 1mo on the 1st of the month, all in litellm_settings.timezone. When the reset job finds a window whose reset_at has passed, it zeroes that window and moves its reset_at to the next boundary, and leaves the other windows alone.
When to use it
Reach for windows when one period is too coarse. A monthly cap on its own lets a runaway agent loop or a leaked key burn the whole month in an afternoon, while a 24h window under the 30d cap stops it the same day and still leaves a normal month room. Rolling out a coding tool works the same way, with a daily guardrail on each developer's key under a monthly ceiling. A batch workload that runs in bursts can get an hourly window on its team on top of a weekly cap. For the customers of your own product, a Customer Management template can give every member a monthly allowance and an annual ceiling at once.
If one period is enough, set max_budget with budget_duration instead. To cap a single model rather than all spend, use per-model budgets, which take their own period per model. Team members cannot have windows, so cap a member with a team member budget and put windows on the member's keys if you need more than one period.
Supported scopes
| Scope | Supported | How to set it |
|---|---|---|
| Whole proxy | No | litellm_settings takes one max_budget and one budget_duration. |
| Organization | No | LiteLLM rejects budget_limits on an organization, and a budget_id whose budget row has windows. |
| Team | Yes | budget_limits on /team/new or /team/update. There is no Admin UI field. |
| Team member | No | A member budget takes one budget_duration. Put windows on the member's keys instead. |
| Project | No | A project budget takes one budget_duration. |
| Virtual key | Yes | budget_limits on /key/generate or /key/update, or Budget Windows in the key form. |
| Internal user | 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. |
| Customer | Yes | Customer Management only, through budget.budget_limits on customer organizations, teams, members and budget templates Since v1.111.0. Customers created with /customer/new cannot have windows. |
| Tag | No | A tag budget takes one budget_duration. |
| Model access group | No | A model access group's budget row cannot hold windows. |
| AI tool | No | Each tool budget has one budget_duration of 1d, 7d or 30d. |
| Agent session | No | max_budget_per_session is one cap per session with no budget_duration. |
How to use it
Add windows to a key
Pass budget_limits as a list of {budget_duration, max_budget} objects. budget_duration takes any duration LiteLLM accepts for a budget, listed in Choose a duration, and max_budget is a cap in USD of 0 or more. Each duration can appear only once in the list. LiteLLM rejects a repeated duration, a negative cap or a duration it cannot parse with a 422.
curl -X POST 'http://0.0.0.0:4000/key/generate' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{
"key_alias": "coding-assistant",
"budget_limits": [
{"budget_duration": "24h", "max_budget": 10},
{"budget_duration": "30d", "max_budget": 100}
]
}'
LiteLLM stores each window with two fields of its own, reset_at for when the current period ends and window_start for when it began. Send the same list to /key/update to add windows to an existing key. A non-admin who creates a key cannot give a window a max_budget above their own, and key owners can change their windows themselves only when self-serve budget changes allow it.
Add windows in the Admin UI
Open Virtual Keys, select Create New Key, expand Optional Settings and find Budget Windows.

Select + Add Budget Window to add a row, choose the period from the dropdown and enter the spend cap.

Add a second row with a different period, for example a monthly $100 cap on top of a daily $10 cap.

Each row shows when its window resets.

The dropdown offers Hourly (1h), Daily (24h), Weekly (7d) and Monthly (30d). Use the API for any other duration. To change the windows on an existing key, open the key and edit its settings, where the same Budget Windows section appears.
Add windows to a team or an internal user
Teams and internal users take the same budget_limits list through the API. A team's windows cap everything spent on requests scoped to the team.
curl -X POST 'http://0.0.0.0:4000/team/update' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY" \
-H 'Content-Type: application/json' \
-d '{
"team_id": "research",
"budget_limits": [
{"budget_duration": "1h", "max_budget": 20},
{"budget_duration": "7d", "max_budget": 500}
]
}'
Team admins cannot change a team's windows, because budget_limits is not one of the fields that team_admin_editable_team_fields can grant. See Choosing what team admins can edit.
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",
"budget_limits": [
{"budget_duration": "1h", "max_budget": 1},
{"budget_duration": "1mo", "max_budget": 100}
]
}'
A user's windows apply wherever the user's personal max_budget applies, which is keys with no team, and team keys too when general_settings.apply_user_budget_to_team_keys is on. See Apply user budgets to team keys.
Add windows to a customer
Customer Management budgets take budget_limits inside their budget object, on a customer organization, team or member, or on a budget template that many members share. Each member on a template gets its own spend in every window. A separate allowance for each member walks through a template with a monthly and an annual window.
Change or remove windows
budget_limits on an update replaces the whole list. A window whose budget_duration is still in the new list keeps its current reset_at and the spend it has counted, so raising a cap does not restart the period. A new duration starts in its current period, and a duration you leave out is dropped. Send an empty list, "budget_limits": [], to remove every window. The object's max_budget and budget_duration stay as they were.
Check window spend
/key/info, /team/info and /user/info return the stored budget_limits and a budget_limits_usage map with the current spend of each window, keyed by its duration. LiteLLM reads that spend from the same counter it enforces against.
curl 'http://0.0.0.0:4000/key/info?key=sk-...' \
-H "Authorization: Bearer $LITELLM_MASTER_KEY"
{
"info": {
"budget_limits": [
{"budget_duration": "24h", "max_budget": 10.0, "reset_at": "2030-01-15T00:00:00+00:00", "window_start": "2030-01-14T00:00:00+00:00"},
{"budget_duration": "30d", "max_budget": 100.0, "reset_at": "2030-02-01T00:00:00+00:00", "window_start": "2030-01-01T00:00:00+00:00"}
],
"budget_limits_usage": {
"24h": {"current_spend": 10.0},
"30d": {"current_spend": 43.0}
}
}
}
Limits
Windows and the plain max_budget are separate caps on the same object, and the first one to run out blocks it. LiteLLM does not compare windows with each other or with max_budget, so keep each shorter window's cap below the longer ones.
A full key, team or user window opens again on the first run of the reset job after its reset_at, which with default settings can be up to about 10 minutes after the boundary. Customer Management windows roll over on the first request after the boundary instead. See Tune the reset job.
A window added partway through its period can start with spend already in it, because LiteLLM counts the spend it recorded for the object since that period began, for example since midnight for a daily window.
throttle_on_budget_exceeded covers only a key's own max_budget, so a full window still rejects a throttled key. Budget alerts follow max_budget and soft_budget, so a key, team or user window that fills up sends no alert. See Throttle over-budget keys and Budget alerts.
/budget/new accepts budget_limits, but a budget row with windows can only back Customer Management. LiteLLM rejects attaching it to a key, organization, project, tag, team member, model access group or a customer created with /customer/new, or naming it in max_end_user_budget_id.
POST /key/{key}/reset_spend also clears every window on the key, and restarts each one from that moment for one full duration. For a window of whole days, weeks or months the reset after that lands on the usual calendar boundary again, while an hourly or shorter window keeps counting from the new starting point.
The reset hints in the Admin UI key form assume midnight UTC. Windows really reset in litellm_settings.timezone, weekly and monthly ones at budget_reset_time, and a 7d window resets on Monday even though the weekly hint says Sunday.
Related
Budget rollover explains how overage above a key, team or user window carries into its next period, Budget reset times and timezones lists when each duration resets, and Budgets and spend limits covers how windows combine with every other budget a request falls under.