---
title: "Per-model budgets"
url: "/docs/proxy/per_model_budgets"
canonical_url: "https://docs.litellm.ai/docs/proxy/per_model_budgets"
type: "docs"
last_updated: "2026-12-02"
summary: "Cap what a key, internal user, team, team member or customer spends on individual models, each model with its own limit and reset window."
related:
  - "/docs/proxy/default_budgets"
  - "/docs/proxy/budget_windows"
---
# Per-model budgets

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


Available in LiteLLM v1.55.8 and later.

> **LiteLLM Enterprise feature: Per-model budgets.** Requires an Enterprise license (`LITELLM_LICENSE`). Talk to sales: https://www.litellm.ai/enterprise#talk-to-sales

`model_max_budget` caps what one scope spends on individual models, underneath that scope's overall budget. Each entry names a model, a `*` pattern or a model access group, and gives it a dollar limit with its own reset window. Once a model's spend reaches its limit, LiteLLM rejects further requests for that model with `budget_exceeded`, and the scope's other models keep working.

Keys, internal users, teams and legacy customers take `model_max_budget`. `team_member_model_max_budget` on a team gives every member of that team the same per-model caps, and `/team/member_update` overrides them for one member. On a key, [budget fallbacks](./budget_fallbacks.md) can send a capped request to another model instead of rejecting it.

## How it works

```mermaid
flowchart LR
  accTitle: Per-model caps inside a key's overall budget
  accDescr: A key has a 100 dollar budget every 30 days. Its model_max_budget caps one model at 40 dollars every 30 days and another at 10 dollars a day, and leaves a third model uncapped. The first model has spent its 40 dollars, so requests for it are rejected with budget_exceeded. Requests for the other two models are still served until their own cap or the key's 100 dollars runs out.
  KEY["Key<br/>max_budget $100 per 30d"]
  KEY --> A["gpt-6.1-sol<br/>cap $40 per 30d<br/>spent $40"]
  KEY --> B["claude-sonnet-5<br/>cap $10 per 1d<br/>spent $3"]
  KEY --> C["gpt-6-luna<br/>no per-model cap"]
  A --> AX["Rejected<br/>budget_exceeded"]
  B --> BOK["Served"]
  C --> COK["Served until the<br/>key's $100 runs out"]
  classDef default fill:#ffffff,stroke:#9ca3af,color:#111827;
```

Each scope keeps one spend counter per entry, and each counter resets on its own window. A request has to fit under every per-model cap that applies to it, from its key, the key's owner, its team, the team member and the customer, as well as under every overall budget, so the strictest one wins. Spend on a capped model still counts toward the scope's overall budget.

## When to use it

Reach for per-model budgets when one model costs far more than the rest and you want to ration it without cutting off the others. Typical cases are a $200 monthly allowance on `claude-opus-5` for each engineer while cheaper models stay open, a trial key that gets a few dollars a day on a premium model, a team that may spend at most a fixed share of its budget on one model family through a pattern such as `claude-opus*`, or one shared cap over every model in an access group.

They are the wrong tool for a few neighboring problems. To cap total spend across all models, set an overall budget as described in [Budgets and spend limits](./budgets.md). To cap what every caller together spends on a group of models, use [Model access group budgets](./model_access_group_budgets.md), and to cap a deployment or provider, use [Budget routing](./provider_budget_routing.md). To limit throughput rather than dollars, use per-model [rate limits](./rate_limits.md), and to keep a model away from a caller entirely, use [model access](./model_access.md).

## Supported scopes

| Scope | Supported | How to set it |
| --- | --- | --- |
| Whole proxy | No | There is no proxy-wide per-model cap. [Budget routing](./provider_budget_routing.md#model-budgets) caps a deployment for every caller. |
| Organization | No | Organization endpoints accept `model_max_budget` but do not enforce it. Set it on the organization's teams or keys. |
| Team | Yes | `model_max_budget` on `/team/new` or `/team/update`. One counter per entry, shared by every key on the team. |
| Team member | Yes | `team_member_model_max_budget` on `/team/new` or `/team/update` for every member, or `model_max_budget` on `/team/member_update` for one member. |
| Project | No | Not enforced on projects. Set it on the project's keys or team. |
| Virtual key | Yes | `model_max_budget` on `/key/generate` or `/key/update`, or on a `/budget/new` row the key references with `budget_id` when the key sets none of its own. |
| Internal user | Yes | `model_max_budget` on `/user/new` or `/user/update`. Applies across every key the user owns, team keys included. |
| Customer | Yes | Legacy end users only, through `model_max_budget` on the customer's budget row or the default customer budget. Customer Management does not support it. |
| Tag | No | Tag endpoints accept `model_max_budget` but do not enforce it. |
| Model access group | No | The group has no per-model cap of its own. An entry on another scope can name an access group to cap every model in it. |
| AI tool | No | - |
| Agent session | No | - |

## How to use it

### Entry format {#genericbudgetinfo}

Each key in a `model_max_budget` map names what the entry caps, and each value sets the limit.

| Field | Type | Meaning |
| --- | --- | --- |
| `budget_limit` | float | The most the scope can spend on the entry's models in one window, in USD. `max_budget` is accepted as the same field. |
| `time_period` | string | How long each window lasts: seconds (`30s`), minutes (`30m`), hours (`30h`), days (`30d`), weeks (`1w`) or months (`1mo`). `budget_duration` is accepted as the same field. |

```json
{
  "gpt-6.1-sol": {"budget_limit": 40, "time_period": "30d"},
  "claude-opus*": {"budget_limit": 10, "time_period": "1d"}
}
```

Always set both fields. Keys, internal users and budget rows store an entry that has no `time_period`, but LiteLLM never enforces it, and team endpoints reject one.

An entry's name can be a model name from `model_list`, a pattern in which `*` matches any run of characters, or the name of a [model access group](./model_access_groups.md). (since LiteLLM v1.109.0) Pattern and access group entries are available on every supported scope, and every model a pattern or group covers draws from that entry's single counter.

### How LiteLLM matches model names {#how-litellm-matches-model-names}

For each scope, LiteLLM uses the first entry that matches the requested model, in this order:

1. An entry named after the model. Besides the name as sent, this matches the name without its provider prefix, so an entry for `claude-opus-5` also covers `anthropic/claude-opus-5`. For a Bedrock model priced in the cost map it also matches the Bedrock base model and the bare family name, so one entry covers the cross-region `us.` and `eu.` ids. A `router_settings.model_group_alias` name also matches entries for the model group it points to.
2. An entry named after a model access group that serves the model.
3. The most specific matching pattern, which is the one with the most literal characters.

A model with an entry of its own is not charged to a pattern or group that also covers it. Name entries after the `model_name` values in `model_list`. When you route one model under several names, an entry on the bare family name or a pattern covers all of them with one counter.

### Virtual key

Pass `model_max_budget` to `/key/generate`, or to `/key/update` for an existing key:

```bash
curl 'http://0.0.0.0:4000/key/generate' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "max_budget": 100,
    "budget_duration": "30d",
    "model_max_budget": {
      "gpt-6.1-sol": {"budget_limit": 40, "time_period": "30d"},
      "claude-sonnet-5": {"budget_limit": 10, "time_period": "1d"}
    }
  }'
```

A key that sets no `model_max_budget` of its own uses the one on the budget row it references through `budget_id`. One row from `/budget/new` can then give many keys the same per-model caps, and each key still counts its own spend against them.

In the Admin UI, go to **Virtual Keys**, click **Create New Key**, and open **Optional Settings**, then **Per-Model Budgets**. To change an existing key, open the key's edit page and use the same section. Select **Add Model Budget**, choose a model, pattern or access group, set the spending limit and pick the budget period. Limits can be less than $0.01. Without an Enterprise license the section is read-only.

![Per-Model Budgets on the key form](https://raw.githubusercontent.com/yassin-berriai/litellm-pr-media/main/lit-5894/key-per-model-budget-empty.png)

![A per-model budget filled in](https://raw.githubusercontent.com/yassin-berriai/litellm-pr-media/main/lit-5894/key-per-model-budget-filled.png)

### Internal user {#internal-user-model-specific}

Available in LiteLLM v1.99.0 and later.

A per-model budget on an internal user applies across every key that user owns, including team keys, so the user cannot get around it by creating another key. For example, give each engineer a $200 monthly budget on `claude-opus-5` however many keys they hold. Set it with `/user/new` or `/user/update`:

```bash
curl 'http://0.0.0.0:4000/user/new' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "user_id": "engineer-1",
    "model_max_budget": {"claude-opus-5": {"budget_limit": 200, "time_period": "1mo"}}
  }'
```

Once the user reaches the limit, LiteLLM rejects that model on every one of their keys:

```json
{
  "error": {
    "message": "LiteLLM User: engineer-1, exceeded budget for model=claude-opus-5",
    "type": "budget_exceeded",
    "param": null,
    "code": "422"
  }
}
```

User and key caps are counted separately. A request on a key that has its own per-model budget counts toward both, and LiteLLM rejects it when either is spent. Users who are not proxy admins cannot change their own per-model budget.

In the Admin UI, go to **Internal Users**, select the user, and open **Details**, then **Edit**, then **Per-Model Budgets**. The form shows what the user has spent on each model in the current window.

![Per-Model Budgets on an internal user](https://raw.githubusercontent.com/yassin-berriai/litellm-pr-media/main/lit-5894/user-per-model-budget.png)

### Team

Available in LiteLLM v1.103.0 and later.

`model_max_budget` on `/team/new` or `/team/update` caps what the whole team spends on a model. The team keeps one counter per entry, shared by every key on the team. Team entries need both `budget_limit` and `time_period`, and cannot carry `tpm_limit` or `rpm_limit`, so set per-model rate limits on the key instead.

```bash
curl 'http://0.0.0.0:4000/team/update' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "team_id": "team-research",
    "model_max_budget": {
      "claude-opus*": {"budget_limit": 500, "time_period": "1mo"}
    }
  }'
```

A key with its own entry named after the requested model is checked and charged on that entry instead of the team's entry of the same name. The team's pattern and access group entries still apply to that key. A team admin can lower a team's per-model caps, while raising one, changing its window, removing an entry, or adding an entry that takes precedence over a capped one takes a proxy admin.

In the Admin UI, open the team, go to **Settings**, click **Edit Settings**, and use **Per-Model Budgets**. The team's settings show what it has spent on each model in the current window.

### Team member

Available in LiteLLM v1.107.0 and later.

`team_member_model_max_budget` on `/team/new` or `/team/update` gives every member of the team the same per-model caps. Each member counts their own spend, so a $50 monthly cap on a model lets every member spend up to $50 on it, while the team's own caps and budget still apply to the total.

```bash
curl 'http://0.0.0.0:4000/team/update' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "team_id": "team-research",
    "team_member_model_max_budget": {
      "claude-opus-5": {"budget_limit": 50, "time_period": "1mo"}
    }
  }'
```

To give one member different caps, send `model_max_budget` on `/team/member_update`. That member's caps then replace the team default, and sending an empty object puts the member back on the default.

```bash
curl 'http://0.0.0.0:4000/team/member_update' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "team_id": "team-research",
    "user_id": "engineer-1",
    "model_max_budget": {
      "claude-opus-5": {"budget_limit": 150, "time_period": "1mo"}
    }
  }'
```

In the Admin UI, set the default under the team's **Member Defaults** tab with **Edit Defaults** and **Default Per-Model Budget**. For one member, open the **Members** tab, click **Edit member**, and use **Per-Model Budgets**. Members need a key that carries both their `user_id` and the team's `team_id`. See [Team members](./users.md#team-members).

### Customer

Available in LiteLLM v1.82.0 and later.

Customers that the legacy `user` field or customer header identifies take per-model caps from their budget row. Create the row with `/budget/new`, then attach it with `budget_id` on `/customer/new` or `/customer/update`:

```bash
curl 'http://0.0.0.0:4000/budget/new' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "budget_id": "free-tier",
    "model_max_budget": {"gpt-6.1-sol": {"budget_limit": 1, "time_period": "1d"}}
  }'

curl 'http://0.0.0.0:4000/customer/new' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"user_id": "customer-123", "budget_id": "free-tier"}'
```

A customer without a row of its own uses the [default customer budget](./default_budgets.md#customers), so a `model_max_budget` on that row caps every such customer. [Customer Management](./customers.md) does not support per-model budgets.

### View current usage {#view-current-usage}

`/key/info`, `/user/info` and `/team/info` return `model_max_budget_usage` next to `model_max_budget`. For each entry it reports what the scope has spent in the current window, read from the same counter that enforcement uses. Entries are keyed by their configured name, so a pattern or access group entry reports the total for every model it covers.

```bash
curl 'http://0.0.0.0:4000/key/info?key=sk-...' \
  --header "Authorization: Bearer $LITELLM_MASTER_KEY"
```

```json
{
  "info": {
    "model_max_budget": {"gpt-6.1-sol": {"budget_limit": 0.0001, "time_period": "30d"}},
    "model_max_budget_usage": {
      "gpt-6.1-sol": {
        "current_spend": 0.0002,
        "budget_limit": 0.0001,
        "time_period": "30d",
        "budget_reset_at": "2030-11-14T09:30:12.418093+00:00"
      }
    }
  }
}
```

(since LiteLLM v1.107.0) `budget_reset_at` is when the entry's current window ends and `current_spend` goes back to 0, as an ISO 8601 timestamp in UTC. A model that is over its limit accepts requests again at that time, unless another budget still blocks it. This is separate from the top-level `budget_reset_at` in the same response, which belongs to the overall budget set with `budget_duration`.

A window opens when the first successful request on the entry finishes, even one that costs $0 such as a cache hit, and lasts for `time_period` from that moment rather than from a calendar boundary. Later requests in the same window do not move `budget_reset_at`. A `1d` window ends 24 hours after it opens, and a `1mo` window ends at the same time on the same day of the next month in UTC, or on the last day of that month when it is shorter. `budget_reset_at` is `null` before the first request and after a window ends, until the next request opens a new one. An entry with a missing or invalid `time_period` is left out of `model_max_budget_usage`.

Team member and customer caps are enforced the same way but have no usage readout on an info endpoint.

### Test the budget {#test-the-budget}

Give a key a very small cap, such as `{"gpt-6.1-sol": {"budget_limit": 0.0000001, "time_period": "1d"}}`. The first request succeeds, and the next one is rejected once the first one's cost is recorded.

**Successful call**

```bash
curl 'http://0.0.0.0:4000/chat/completions' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <sk-generated-key>' \
  --data '{
    "model": "gpt-6.1-sol",
    "messages": [{"role": "user", "content": "testing request"}]
  }'
```

**Rejected call**

Send the same request again. LiteLLM rejects it because the key is over its `gpt-6.1-sol` cap:

```json
{
  "error": {
    "message": "LiteLLM Virtual Key: 9769f3f6768a199f76cc29xxxx, key_alias: None, exceeded budget for model=gpt-6.1-sol",
    "type": "budget_exceeded",
    "param": null,
    "code": "422"
  }
}
```

The status code follows `litellm_settings.budget_exceeded_status_code`, as described in [Change the status code](./budget_exceeded_errors.md#change-the-status-code).

### Reroute instead of rejecting {#reroute}

By default an exhausted per-model cap rejects the request. Two scopes can send it to another model instead. On a key, `budget_fallbacks` lists a chain of models to try when the key's own cap on the requested model is spent. See [Budget fallbacks](./budget_fallbacks.md). When a team member's cap is spent, LiteLLM walks the router `fallbacks` for that model, from the key's or team's `router_settings` before the proxy's, and rewrites the request to the first fallback the member can still afford and is allowed to call. A request that sets `disable_fallbacks`, a multipart upload, or a request that refers to a provider's file or batch is rejected instead. Caps on internal users, teams and customers always reject.

## Limits

Each entry's window is its own and does not follow the scope's `budget_duration` or the budget reset job, so resetting a scope's overall spend leaves its per-model counters as they are. Changing an entry's `time_period` starts that entry on a fresh counter.

LiteLLM compares the spend already recorded with the cap before it calls the provider and records the cost after the response, without reserving it first. The request that crosses a cap completes, and concurrent requests can overshoot it.

Counters live in Redis when the proxy has one. (since LiteLLM v1.109.0) Without Redis, instances share key, internal user, team and team member windows through the database, so an instance that did not serve the request that opened a window reads `null` for `budget_reset_at` until the window's spend reaches the database, usually within about 20 seconds with the default `proxy_batch_write_at` of 10 seconds, and longer with a larger `proxy_batch_write_at` or a lagging [read replica](./db_read_replica.md). Customer windows are never shared that way, so without Redis each instance enforces its own copy of a customer's cap.

Requests to a model priced at $0 skip budget checks. When the router falls back to another model after a provider error, it re-checks only team member per-model caps against the fallback, not key, user or team caps, and charges the spend to the model group that served the request. See [Enforce budget on fallbacks](./reliability.md#enforce-budget-on-fallbacks).

`/user/new` also copies `model_max_budget` onto the key it creates, unless `auto_create_key` is `false`. That key keeps its copy when you later change the user's caps with `/user/update`, so update or clear it on the key too.

An entry on a key can also carry `tpm_limit` and `rpm_limit`. LiteLLM uses them as that model's rate limits when the key's metadata sets no `model_tpm_limit` or `model_rpm_limit`. See [Rate limits](./rate_limits.md).

## Related

Per-model budgets sit alongside the other limits in [Budgets and spend limits](./budgets.md), can reroute through [Budget fallbacks](./budget_fallbacks.md), and differ from [Model access group budgets](./model_access_group_budgets.md) and [Budget routing](./provider_budget_routing.md), which cap a model for every caller.

## Related pages

- [Default budgets](https://docs.litellm.ai/docs/proxy/default_budgets.md)
- [Multiple budget windows](https://docs.litellm.ai/docs/proxy/budget_windows.md)
