---
title: AI Gateway Budgets and Spend Limits
product: vercel
url: /docs/ai-gateway/observability-and-spend/budgets
canonical_url: "https://vercel.com/docs/ai-gateway/observability-and-spend/budgets"
last_updated: 2026-09-10
type: how-to
prerequisites:
  - /docs/ai-gateway/observability-and-spend
  - /docs/ai-gateway
related:
  - /docs/ai-gateway/authentication-and-byok/api-keys
  - /docs/rest-api
  - /docs/ai-gateway/authentication-and-byok/oidc
  - /docs/sign-in-with-vercel/tokens
  - /docs/cli/tokens
summary: Cap AI Gateway spend for your team, a project, an individual API key, or a team member with budgets, refresh periods, spend alerts, and defaults.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest docs search "<query>"
---

# AI Gateway Budgets and Spend Limits

A budget caps AI Gateway spend at one of four scopes:


<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [AI Gateway now supports team and project spend budgets](https://vercel.com/changelog/ai-gateway-spend-budgets-and-alerts)
- [Baseten's Mammoth-1 and Elephant-1 now available on AI Gateway for free](https://vercel.com/changelog/basetens-mammoth-1-and-elephant-1-now-available-on-ai-gateway-for-free)
- [Decision-1.1 now available on AI Gateway](https://vercel.com/changelog/decision-1-1-now-available-on-ai-gateway)
- [Gemini Decision 1 now available on AI Gateway](https://vercel.com/changelog/gemini-decision-1-now-available-on-ai-gateway)
- [Liquid AI's d1 is available on AI Gateway](https://vercel.com/changelog/liquid-ai-d1-is-available-on-ai-gateway)
- [How to prepare your storefront for Black Friday traffic](https://vercel.com/kb/guide/black-friday-preparation) — Set baselines and cut backend load. Make your catalog readable to agents and keep orders and AI features reliable. Then
- [How to keep your storefront running through Black Friday](https://vercel.com/kb/guide/black-friday-reliability) — Learn how to tune alerts, bot rules, and spend limits. Rehearse rollback so your team can recover quickly from checkout
- [Cost-aware model routing with Vercel AI Gateway](https://vercel.com/kb/guide/cost-aware-model-routing-with-ai-gateway) — Send easy requests to a lower-cost model and escalate only the complex ones to a frontier model through AI Gateway, with
- [Run recurring security reviews with deepsec on Vercel](https://vercel.com/kb/guide/deepsec-reviews-on-vercel) — Learn how to run periodic security scans on your code with deepsec. Set up deepsec to review GitHub repositories and del
- [Deploy a Shopify storefront with an AI assistant](https://vercel.com/kb/guide/deploy-shopify-ai-storefront) — Deploy an eve shopping agent with Vercel Shop to find Shopify products, manage carts, and answer store questions.
- [Vercel for Enterprise](https://vercel.com/blog/vercel-for-enterprise)
- [vercel billing budgets](https://vercel.com/docs/cli/budgets) — View and manage Spend Management budgets for your team, projects, products, and organization from the Vercel CLI.

Full cross-link map for this page: [/docs/ai-gateway/observability-and-spend/budgets.graph.md](/docs/ai-gateway/observability-and-spend/budgets.graph.md)
<!-- /docsgraph:related -->

- **[Team](#team-and-project-budgets)**: everything your team spends, across every project and key.
- **[Project](#team-and-project-budgets)**: what one project's deployments spend through their OIDC tokens, plus what API keys scoped to that project spend.
- **[API key](#api-key-budgets)**: what one API key spends.
- **[User](#user-budgets)**: what one team member spends, across their attributed API keys, personal access tokens, and Sign in with Vercel tokens.

AI Gateway checks every budget in scope before each request and rejects further requests once a limit is exceeded, until the budget resets or you raise it. Budgets are optional, and a team, project, key, or member without one has unlimited spend.

To create, view, or delete the API keys themselves, see [API Keys](/docs/ai-gateway/authentication-and-byok/api-keys).

The API examples on this page use a [Vercel access token](/docs/rest-api#creating-an-access-token), your team ID in `VERCEL_TEAM_ID`, and resource IDs where required.

## How budgets work

Budgets stack, and which ones apply depends on how a request authenticates. A request has to pass every budget in scope, so if any one is exceeded, AI Gateway rejects the request even when the others have room.

Take a team with all four budget scopes in use:

| Budget in scope                          | Limit | Spent this period |
| ---------------------------------------- | ----- | ----------------- |
| Team `acme`                              | $500  | $110              |
| Project `storefront` in team `acme`      | $100  | $100              |
| API key, attributed to member `teammate` | $50   | $10               |
| Member `teammate` (user budget)          | $40   | $10               |

A single request adds its cost to every budget in scope at once. A $1 request from a `storefront` deployment adds $1 to the project budget and $1 to the team budget, exactly as the diagram shows.

The totals above are cumulative, so they overlap rather than add up. The team's $110 is the project's $100 plus the key's $10, because each of those requests also counted toward the team. The key's $10 and `teammate`'s $10 are the same $10, counted once against the key and once against the member it is attributed to.

Two requests against that team get different outcomes:

| Request                                            | Budgets in scope    | Outcome                                                      |
| -------------------------------------------------- | ------------------- | ------------------------------------------------------------ |
| A deployment in `storefront`, using its OIDC token | Team, project       | Rejected. The project budget is exhausted.                   |
| Any request using the API key                      | Team, API key, user | Succeeds. The key isn't scoped to a project, so no project budget applies, and the rest have room. |

Each budget counts a specific set of authentication types:

- **Team budget**: [API keys](/docs/ai-gateway/authentication-and-byok/api-keys), [OIDC tokens](/docs/ai-gateway/authentication-and-byok/oidc), [app tokens](/docs/sign-in-with-vercel/tokens), and [personal access tokens](/docs/cli/tokens)
- **Project budget**: [OIDC tokens](/docs/ai-gateway/authentication-and-byok/oidc) from that project's deployments, and [API keys](/docs/ai-gateway/authentication-and-byok/api-keys) scoped to that project
- **API key budget**: that one [API key](/docs/ai-gateway/authentication-and-byok/api-keys)
- **User budget**: [API keys](/docs/ai-gateway/authentication-and-byok/api-keys) attributed to that team member, their [personal access tokens](/docs/cli/tokens), and [app tokens](/docs/sign-in-with-vercel/tokens) issued to them through Sign in with Vercel
- **No budget**: [BYOK](/docs/ai-gateway/authentication-and-byok/byok) provider keys. The [BYOK without fallback fee](/docs/ai-gateway/pricing#byok-without-fallback) still counts toward the budgets of the API key or token that made the request.

An API key's spend counts toward a project budget only when you scope the key to that project. To scope a key, set the `projectId` field when you [create the key](/docs/ai-gateway/authentication-and-byok/api-keys#create-a-key). Using an unscoped key in a project's deployment doesn't count toward that project's budget. Without a scoped key, spending down a project budget requires an OIDC token from that project's deployments.

Each API key is also attributed to either your team or the member who created it. A key attributed to a member counts its spend toward both the team budget and that member's user budget; a key attributed to the team counts toward the team budget only. See [Spend attribution](/docs/ai-gateway/authentication-and-byok/api-keys#spend-attribution) to set it.

Personal access tokens and app tokens issued to a signed-in user always act as that user, so their spend counts toward the team budget and that user's budget. OIDC tokens and app tokens that act as the app itself have no user, so they never count toward a user budget.

### Default budgets

A default budget is a catch-all cap for one scope, with one default for projects, one for API keys, and one for team members:

- It applies to every project, key, or member without a custom budget, including ones that already exist and ones added later.
- Each covered resource gets its own allowance. A $50 API key default caps every covered key at $50 per period; it isn't $50 split across them.
- It never overrides a custom budget. The custom budget wins whether you set it before or after the default.
- Metering starts when the default takes effect. Spend from before that point doesn't count against it, so a key that has already spent $10,000 starts at $0 against a new $40 default.

A default takes effect as soon as you save it. AI Gateway caps every covered resource and lists it with the default's limit and a **Default** label. Spend shows as $0 until the resource's first request arrives, then starts filling in.

A default carries a limit, a refresh period, and optional [spend alerts](#spend-alerts).

Removing a default lifts that cap from every resource it covered. After that, only the team budget still applies to them, if you've set one.

> **💡 Note:** The CLI examples below use the `--default` flag, available in Vercel CLI
> v59.13.0 and later. On older versions, use the nested `budgets defaults`
> command group for the same result.

> **💡 Note:** A budget is a soft cap, not a hard limit. The check runs at the start of each
> request, so the request that crosses the limit still completes and total spend
> can end up slightly over the budget.

Each refresh period resets at the start of its window in UTC:

| Period    | Resets at                              |
| --------- | -------------------------------------- |
| `daily`   | Midnight UTC each day                  |
| `weekly`  | Monday at midnight UTC                 |
| `monthly` | The first of the month at midnight UTC |
| `none`    | Never resets; the limit is cumulative  |

Editing a budget keeps the spend already accumulated in the current period. Deleting a budget removes that cap immediately. A project, key, or member covered by a [default budget](#default-budgets) falls back to the default rather than becoming unlimited. Re-creating a budget later doesn't reset it: the budget comes back with the spend it had already counted in the current period, which for `none` is everything since it was first set.

## When a budget is exceeded

Once spend reaches the limit, AI Gateway rejects further requests for that scope with an HTTP `402` response until the budget resets or you raise it. The `type` is always `quota_for_entity_exceeded`, and the `message` names the scope that was exceeded along with its current spend and limit.

A team or project budget:

```json filename="Response"
{
  "error": {
    "message": "Project budget exceeded. Current spend: $200.00, limit: $200.00. Team owners can edit this budget in AI Gateway Budgets & Spend (https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dproject&title=AI+Gateway+Budgets+%26+Spend).",
    "type": "quota_for_entity_exceeded"
  }
}
```

An API key budget:

```json filename="Response"
{
  "error": {
    "message": "API key budget exceeded. Current spend: $10.00, limit: $10.00. Team owners can edit this budget in AI Gateway Budgets & Spend (https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dapi-key&title=AI+Gateway+Budgets+%26+Spend).",
    "type": "quota_for_entity_exceeded"
  }
}
```

A user budget rejects the same way once the member's spend exceeds it, with the `message` naming the user scope.

Handle a `402` in your client by backing off until the budget resets, or raise the limit.

> **💡 Note:** The [BYOK without fallback fee](/docs/ai-gateway/pricing#byok-without-fallback)
> counts toward budgets even when a budget excludes BYOK spend. If your team
> turned off [Fallback to Vercel
> Keys](/docs/ai-gateway/authentication-and-byok/byok#turn-off-fallback-to-vercel-keys),
> accumulated fees alone can exceed a budget, and AI Gateway then rejects your
> BYOK requests with a `402`.

SDK error classes can differ from the HTTP status. A budget rejection can surface as `GatewayInternalServerError` in AI SDK 7 or `ProviderInternalServerError` in the Python beta. Check the quota details before retrying. See [AI SDK error handling](https://ai-sdk.dev/docs/ai-sdk-core/error-handling) for handling SDK exceptions and streaming errors.

## Spend alerts

Spend alerts email someone as spend crosses a chosen percentage of the limit within a refresh period. They are off by default. When you add or edit a team, project, API key, or user budget, pick any combination of **50%**, **75%**, and **100%** under **Email ... when usage reaches**. Each threshold you select fires at most once per period.

Who receives the email depends on the budget's scope:

| Budget scope    | Alerts go to                                      |
| --------------- | ------------------------------------------------- |
| Team or project | Team owners, members with the **Billing** or **Security** role, and members with the [**Usage Viewer**](/docs/rbac/access-roles/extended-permissions#usage-viewer) permission |
| API key         | The key's creator                                 |
| User            | The team member whose budget it is                |

Alerts are informational. Crossing a threshold below 100% never blocks requests.

## Roles and permissions

Every [team role](/docs/rbac/access-roles/team-level-roles) except **Contributor** can see budgets. Owner, Member, Developer, Security, Viewer, and Billing all have read access to the **Budgets** page.

Writing is more restricted. Besides the Owner role, an Owner can grant a member the **AI Gateway Budget Manager** permission from the team's [member settings](/docs/rbac/managing-team-members); it covers every budget action below without the rest of the Owner role.

| Action                                                                                                  | Who can do it                                      |
| ------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| View every budget, default, and spend                                                                   | Every team role except Contributor                 |
| Create, edit, or remove the team budget                                                                 | Owners and Budget Managers                         |
| Create, edit, or remove a project budget                                                                | Owners, Budget Managers, and that project's admins |
| Create, edit, or remove a user budget                                                                   | Owners and Budget Managers                         |
| Add, change, or remove an API key budget                                                                | Owners and Members (anyone who can edit the key)   |
| Set or remove a default budget (project, API key, or user)                                              | Owners and Budget Managers                         |
| Change a key's [spend attribution](/docs/ai-gateway/authentication-and-byok/api-keys#spend-attribution) | Owners and Budget Managers                         |

API key budgets are the one exception to the Budget Manager grant. They follow key-editing permission, so a Budget Manager changes them through their base role rather than the grant.

These rules apply the same way whether you use the dashboard, the [CLI](/docs/cli/ai-gateway#budgets), or the Vercel API.

## Reasons for budget changes

The dashboard asks for a **Reason for Change** whenever you set, change, or remove a team, project, user, or API key budget, or a default budget. The reason is recorded in your team's [activity log](/docs/activity-log) and [audit log drains](/docs/drains/reference/audit-logs) with the change, alongside who made it and the previous and new limits.

In the Vercel API the reason is the optional `justification` field: in the request body for `PUT` and `PATCH` requests, and as a query parameter for `DELETE` requests. It can be up to 500 characters and is stored as a single line.

In the Vercel CLI, pass the optional `--message <TEXT>` option to [`budgets set`](/docs/cli/ai-gateway#set) or [`budgets remove`](/docs/cli/ai-gateway#remove). It takes up to 500 characters, works for every scope and with `--default`, and appears as `Reason` in the command's output:

```bash filename="terminal"
vercel ai-gateway budgets set user teammate@example.com --amount 100 --message "Eval run for the launch"
```

## Team and project budgets

The two scopes are independent, and you can use either or both:

- A **team budget** caps all AI Gateway spend across your team for the refresh period. When it is exceeded, every gateway request from your team is rejected until the budget resets.
- A **project budget** caps the spend attributed to one project. When it is exceeded, only that project's requests are rejected; the rest of your team is unaffected.

### Set a team or project budget

#### Dashboard

1. **Choose the scope.** Open the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets\&title=AI+Gateway+Budgets). The team budget is at the top of the page. For a project budget, select [**Projects**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dproject\&title=AI+Gateway+Project+Budgets) to pick a project.
2. **Add the budget.** Click **Add budget**, enter a spending limit in dollars, and choose a refresh period.
3. **Save.** Enter a reason for the change, then save. The budget takes effect within a few minutes.

#### CLI

Set the team budget, or scope a budget to a single project by name or ID (every budget subcommand and flag is in the [CLI reference](/docs/cli/ai-gateway#budgets)):

```bash filename="terminal"
vercel ai-gateway budgets set team --amount 500 --refresh-period monthly
vercel ai-gateway budgets set project my-project --amount 200 --refresh-period monthly
```

```text filename="Output"
✓ Set budget      team
  Limit           $500
  Refresh         monthly
```

| Flag                        | Description                                        |
| --------------------------- | -------------------------------------------------- |
| `--amount <USD>`            | Spending limit in dollars (minimum `$1`).          |
| `--refresh-period <PERIOD>` | `daily`, `weekly`, `monthly` (default), or `none`. |

#### API

Set a team budget with `scopeType: "team"`:

```bash filename="terminal"
curl -X PUT "https://api.vercel.com/ai-gateway/budgets?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scopeType": "team",
    "limitAmount": 500,
    "refreshPeriod": "monthly"
  }'
```

For a project budget, pass the project ID:

```bash filename="terminal"
curl -X PUT "https://api.vercel.com/ai-gateway/budgets?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{
    \"scopeType\": \"project\",
    \"projectId\": \"$VERCEL_PROJECT_ID\",
    \"limitAmount\": 200,
    \"refreshPeriod\": \"monthly\"
  }"
```

### Check a team or project budget

#### Dashboard

The [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets\&title=AI+Gateway+Budgets) shows the team budget's spend against its limit at the top, with a spend history chart. Select [**Projects**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dproject\&title=AI+Gateway+Project+Budgets) to see each project's spend against its limit.

A budget inherited from the project default is labeled **Default** until you set a custom one.

#### CLI

```bash filename="terminal"
vercel ai-gateway budgets list
```

```text filename="Output"
> Custom budgets
  scope      name          limit      spent    refresh
  team       acme           $500    $110.00    monthly
  project    storefront     $100    $100.00    monthly
```

#### API

List every budget for the team, or add `scopeType=team` or `scopeType=project` to filter the response:

```bash filename="terminal"
curl "https://api.vercel.com/ai-gateway/budgets/list?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

### Change or remove a team or project budget

#### Dashboard

1. **Find the budget.** Open the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets\&title=AI+Gateway+Budgets). The team budget is at the top of the page. For a project budget, select [**Projects**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dproject\&title=AI+Gateway+Project+Budgets).
2. **Open the budget's menu.** Find the budget and open its **···** menu.
3. **Edit or remove.** Select **Edit budget** to change the limit, refresh period, or spend alerts. Select **Remove budget** to lift the cap.

#### CLI

Re-run `budgets set` with new values to change a budget. Removing one lifts that cap; a project covered by the [project default](#project-default-budgets) falls back to it:

```bash filename="terminal"
vercel ai-gateway budgets remove team
vercel ai-gateway budgets remove project my-project
```

```text filename="Output"
✓ Removed         team budget
```

#### API

To change a budget, send another `PUT` request with the scope and its new values. To remove one, send `DELETE` with the scope in the query string.

Remove the team budget:

```bash filename="terminal"
curl -X DELETE "https://api.vercel.com/ai-gateway/budgets?teamId=$VERCEL_TEAM_ID&scopeType=team" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

Remove a project budget:

```bash filename="terminal"
curl -X DELETE "https://api.vercel.com/ai-gateway/budgets?teamId=$VERCEL_TEAM_ID&scopeType=project&projectId=$VERCEL_PROJECT_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

### Project default budgets

A default budget applies to every project without a custom budget, including projects that already exist. Setting a custom budget on a project overrides the default; see [Default budgets](#default-budgets) for the full semantics. API keys have a separate default, covered in [API key default budgets](#api-key-default-budgets).

#### Dashboard

1. **Open the projects view.** On the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dproject\&title=AI+Gateway+Project+Budgets), select **Projects**.
2. **Set the project default.** Click **Set Default** (or the current default value, if one is set) and enter a spending limit in dollars and a refresh period in the **Project Default** dialog.
3. **Save.** Enter a reason for the change, then save. Every project without its own budget now inherits this limit, shown as **Default** in the projects list.

#### CLI

```bash filename="terminal"
vercel ai-gateway budgets set project --default --amount 200 --refresh-period monthly
```

```text filename="Output"
✓ Set default     project
  Limit           $200
  Refresh         monthly
  Applies to      every project without its own budget, including existing ones
```

List defaults with `vercel ai-gateway budgets list --defaults`, and remove the project default with `vercel ai-gateway budgets remove project --default`.

#### API

Set the project default:

```bash filename="terminal"
curl -X PUT "https://api.vercel.com/ai-gateway/budgets/defaults?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scopeType": "project",
    "limitAmount": 200,
    "refreshPeriod": "monthly"
  }'
```

List all defaults:

```bash filename="terminal"
curl "https://api.vercel.com/ai-gateway/budgets/defaults/list?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

Remove the project default:

```bash filename="terminal"
curl -X DELETE "https://api.vercel.com/ai-gateway/budgets/defaults?teamId=$VERCEL_TEAM_ID&scopeType=project" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

## API key budgets

An API key budget caps how much a single key can spend, independently of any team or project budget. You manage it from the API Keys page, the CLI, or the REST API.

### Set an API key budget at creation

Add a budget at the time you create the key:

#### Dashboard

1. **Open the create-key dialog.** On the [AI Gateway API Keys page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys\&title=AI+Gateway+API+Keys), click **Create API Key**.
2. **Enable a budget.** Turn on the budget option and enter a spending limit in dollars.
3. **Choose a refresh period.** Select how often the budget resets (see [refresh periods](#how-budgets-work)).
4. **Save the key.** Save the key, and copy its value immediately. You cannot retrieve it again.

#### CLI

```bash filename="terminal"
vercel ai-gateway api-keys create --name my-api-key --amount 10 --refresh-period monthly
```

```text filename="Output"
your_new_api_key_here
> Success! API key my-api-key (key_123) created [212ms]
```

| Flag                        | Description                                                            |
| --------------------------- | ---------------------------------------------------------------------- |
| `--amount <USD>`            | Spending limit in dollars (minimum `$1`).                              |
| `--refresh-period <PERIOD>` | `daily`, `weekly`, `monthly`, or `none` (default).                     |
| `--expiration <PERIOD>`     | `7d`, `30d`, `60d`, `90d`, `1y`, or `none` (default).                  |
| `--alert-thresholds <LIST>` | Comma-separated subset of `50`, `75`, and `100`, for example `75,100`. |

To bound spend in time as well as amount, pair the budget with an expiration. Budgets never end on their own, so this is how you cap a contractor or experiment key in both dimensions. The key below allows at most $50 total, and stops working entirely after 30 days.

```bash filename="terminal"
vercel ai-gateway api-keys create --name contractor --amount 50 --refresh-period none --expiration 30d
```

#### API

Create the key with an `aiGatewayQuota` object. Only `limitAmount` is required, and `refreshPeriod` defaults to `none`:

```bash filename="terminal"
curl -X POST "https://api.vercel.com/v1/api-keys?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "purpose": "ai-gateway",
    "name": "my-api-key",
    "aiGatewayQuota": {
      "limitAmount": 10,
      "refreshPeriod": "monthly"
    }
  }'
```

The response returns the key's value in `apiKeyString`, which you can't retrieve again, and its ID in `apiKey.id`. Store the ID: you need it to change or remove the budget later. Every field is in the [Create an API key reference](/docs/rest-api/sdk/untagged/createapikeys).

> **💡 Note:** A new budget is not enforced instantly. For up to a minute or two after the
> key is created, requests may not be counted against the budget. Once active,
> spend appears within about 20 seconds.

### Check an API key budget and spend

#### Dashboard

On the [API Keys page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys\&title=AI+Gateway+API+Keys), a budgeted key shows its spend against the limit (for example, **$1.04 / $10 spent**) with the refresh period. A key without a budget shows **Unlimited budget**.

To compare every key's budget in one place, select [**API Keys**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dapi-key\&title=AI+Gateway+API+Key+Budgets) on the Budgets page.

#### CLI

List every key with its budget, spend, and refresh period:

```bash filename="terminal"
vercel ai-gateway api-keys list
```

```text filename="Output"
> API keys [387ms]
  id         name          key      budget    spend    refresh    created
  key_123    my-api-key    …1fAj    $10       $1.04    monthly    8/24/2026
```

Inspect one key's budget by key ID or name:

```bash filename="terminal"
vercel ai-gateway budgets inspect api-key key_123
```

```text filename="Output"
  Scope           api-key
  Name            my-api-key
  Limit           $10
  Spent           $1.04
  Refresh         monthly
```

Both commands accept `--format json` for scripting. In the `api-keys list` JSON output, a key without a budget has no `quota` field.

> **💡 Note:** A key shows no budget both when it never had one and after you remove its
> budget. The value can lag right after a change.

#### API

List API key budgets and their current spend:

```bash filename="terminal"
curl "https://api.vercel.com/ai-gateway/budgets/list?teamId=$VERCEL_TEAM_ID&scopeType=api-key" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

### Add or change an API key budget

Give an existing key a budget, or change the one it has, from the dashboard, the CLI, or the REST API.

#### Dashboard

1. **Open the API Keys page.** Go to the [AI Gateway API Keys page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys\&title=AI+Gateway+API+Keys).
2. **Edit the key.** Find the key, open its **···** menu, and select **Edit**.
3. **Add or change the budget.** Enable or update the budget, set the limit and refresh period, and save.

#### CLI

Identify the key by name or ID (a name shared by several keys errors and asks for the ID; find IDs with `api-keys list`):

```bash filename="terminal"
vercel ai-gateway budgets set api-key my-key --amount 50 --refresh-period weekly
```

```text filename="Output"
✓ Set budget      api key my-key
  Limit           $50
  Refresh         weekly
```

| Flag                        | Description                                        |
| --------------------------- | -------------------------------------------------- |
| `--amount <USD>`            | Spending limit in dollars (minimum `$1`).          |
| `--refresh-period <PERIOD>` | `daily`, `weekly`, `monthly` (default), or `none`. |

#### API

Send a `PATCH` to the key's quota with the fields you want to change. If the key has no budget yet, this creates one, and `limitAmount` is required:

```bash filename="terminal"
curl -X PATCH "https://api.vercel.com/v1/api-keys/$API_KEY_ID/quota?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "limitAmount": 50,
    "refreshPeriod": "weekly"
  }'
```

The response returns the key and its updated budget, including current spend in `quota.currentSpend`. Every field is in the [Update an AI Gateway API key budget reference](/docs/rest-api/sdk/ai-gateway/update-an-ai-gateway-api-key-budget).

A few things to know when you call this endpoint:

- **Key ID**: use the `apiKey.id` returned when you created the key, or find it with `vercel ai-gateway api-keys list`.
- **Token**: use a [Vercel access token](/docs/rest-api#creating-an-access-token) that belongs to a user. The endpoint rejects tokens that don't.
- **Rate limits**: you can make up to 1,000 budget changes per hour per user and 2,000 per hour per team. Past that, requests return `429` until the window resets.

### Remove an API key budget

Removing a budget lifts that key's own cap. A key covered by the [API key default](#api-key-default-budgets) falls back to it; otherwise the key reverts to unlimited.

#### Dashboard

1. **Open the API Keys page.** Go to the [AI Gateway API Keys page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys\&title=AI+Gateway+API+Keys).
2. **Edit the key.** Find the key, open its **···** menu, and select **Edit**.
3. **Remove the budget.** Turn off the budget and save. The key falls back to the API key default if your team has one, and is otherwise unlimited.

#### CLI

```bash filename="terminal"
vercel ai-gateway budgets remove api-key my-key
```

```text filename="Output"
✓ Removed         budget for my-key
```

Removing the budget doesn't touch the key itself. To give the key a budget again later, re-run `budgets set api-key`.

#### API

Send the same `PATCH` as [Add or change an API key budget](#add-or-change-an-api-key-budget) with `archived` set to `true`:

```bash filename="terminal"
curl -X PATCH "https://api.vercel.com/v1/api-keys/$API_KEY_ID/quota?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "archived": true }'
```

To give the key a budget again later, send a `PATCH` with a `limitAmount`.

> **💡 Note:** Re-adding a budget doesn't reset its spend (see [refresh
> periods](#how-budgets-work)). To give a key a fresh allowance, raise
> `limitAmount` by the amount you want to allow instead.

### API key default budgets

A default budget applies to every API key without a custom budget, including keys that already exist. Setting a custom budget on a key overrides the default; see [Default budgets](#default-budgets) for the full semantics.

#### Dashboard

1. **Open the API Keys view.** On the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Dapi-key\&title=AI+Gateway+API+Key+Budgets), select **API Keys**.
2. **Set the API key default.** Click **Set Default** (or the current default value, if one is set) and enter a spending limit in dollars and a refresh period in the **API Key Default** dialog.
3. **Save.** Enter a reason for the change, then save. Every key without its own budget now inherits this limit.

#### CLI

```bash filename="terminal"
vercel ai-gateway budgets set api-key --default --amount 50 --refresh-period monthly
```

```text filename="Output"
✓ Set default     api-key
  Limit           $50
  Refresh         monthly
  Applies to      every API key without its own budget, including existing ones
```

List defaults with `vercel ai-gateway budgets list --defaults`, and remove the API key default with `vercel ai-gateway budgets remove api-key --default`.

#### API

Set the API key default:

```bash filename="terminal"
curl -X PUT "https://api.vercel.com/ai-gateway/budgets/defaults?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scopeType": "api-key",
    "limitAmount": 50,
    "refreshPeriod": "monthly"
  }'
```

List all defaults:

```bash filename="terminal"
curl "https://api.vercel.com/ai-gateway/budgets/defaults/list?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

Remove the API key default:

```bash filename="terminal"
curl -X DELETE "https://api.vercel.com/ai-gateway/budgets/defaults?teamId=$VERCEL_TEAM_ID&scopeType=api-key" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

> **💡 Note:** Budget changes take effect after a short delay, typically tens of seconds and
> up to about 5 minutes for a key in active use. If a change doesn't appear
> right away, wait and retry rather than re-applying it.

## User budgets

A user budget caps how much a single team member can spend, across every API key attributed to that member, their personal access tokens, and app tokens issued to them. It stacks with the team budget, so a member's request has to pass both their user budget and the team budget.

These credentials count toward a member's user budget:

- [API keys](/docs/ai-gateway/authentication-and-byok/api-keys) attributed to the member. See [Spend attribution](/docs/ai-gateway/authentication-and-byok/api-keys#spend-attribution) for how a key is attributed to a member or the team.
- The member's [personal access tokens](/docs/cli/tokens).
- [App tokens](/docs/sign-in-with-vercel/tokens) issued to the member when they sign in to an app with Sign in with Vercel.

[OIDC tokens](/docs/ai-gateway/authentication-and-byok/oidc) and app tokens that act as the app itself have no user, so their spend never counts toward a user budget.

### Set a user budget

#### Dashboard

1. **Open the Users view.** On the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Duser\&title=AI+Gateway+User+Budgets), select **Users**.
2. **Add the budget.** Click **Add budget**, pick a team member, enter a spending limit in dollars, and choose a refresh period.
3. **Save.** Enter a reason for the change, then save. The budget takes effect within a few minutes.

#### CLI

Identify the member by email, username, or user ID:

```bash filename="terminal"
vercel ai-gateway budgets set user teammate@example.com --amount 100 --refresh-period monthly
```

```text filename="Output"
✓ Set budget      user teammate
  Limit           $100
  Refresh         monthly
```

| Flag                        | Description                                        |
| --------------------------- | -------------------------------------------------- |
| `--amount <USD>`            | Spending limit in dollars (minimum `$1`).          |
| `--refresh-period <PERIOD>` | `daily`, `weekly`, `monthly` (default), or `none`. |

#### API

Set a budget for a team member by user ID:

```bash filename="terminal"
curl -X PUT "https://api.vercel.com/ai-gateway/budgets?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{
    \"scopeType\": \"user\",
    \"userId\": \"$VERCEL_USER_ID\",
    \"limitAmount\": 100,
    \"refreshPeriod\": \"monthly\"
  }"
```

### Check a user budget

#### Dashboard

On the AI Gateway Budgets page, the [**Users**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Duser\&title=AI+Gateway+User+Budgets) view shows each member's spend against their limit with a usage bar. A member's spend includes their attributed API keys, personal access tokens, and app tokens.

A member's detail page includes their personal access token and app token spend in **Total spend** and the charts. Its **Keys** list shows API keys only, with a line above it stating how much came from OAuth apps and personal access tokens. For some date ranges, such as ranges that start before October 30, 2026, token spend can't be credited to members, and the page shows a note instead.

#### CLI

```bash filename="terminal"
vercel ai-gateway budgets list
```

```text filename="Output"
> Custom budgets
  scope    name        limit     spent    refresh
  user     teammate     $100    $12.40    monthly
```

User-scoped budgets are listed by member handle.

#### API

List user budgets and their current spend:

```bash filename="terminal"
curl "https://api.vercel.com/ai-gateway/budgets/list?teamId=$VERCEL_TEAM_ID&scopeType=user" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

### Change or remove a user budget

#### Dashboard

1. **Open the Users view.** On the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Duser\&title=AI+Gateway+User+Budgets), select **Users**.
2. **Open the budget's menu.** Find the member and open the **···** menu.
3. **Edit or remove.** Select **Edit budget** to change the limit, refresh period, or spend alerts. Select **Remove budget** to lift the cap.

#### CLI

Re-run `budgets set user` with new values to change a budget. Removing one lifts that cap; a member covered by the [user default](#user-default-budgets) falls back to it:

```bash filename="terminal"
vercel ai-gateway budgets remove user teammate@example.com
```

```text filename="Output"
✓ Removed         budget for teammate
```

#### API

To change a user budget, send another `PUT` request with the same `userId` and new values. To remove it:

```bash filename="terminal"
curl -X DELETE "https://api.vercel.com/ai-gateway/budgets?teamId=$VERCEL_TEAM_ID&scopeType=user&userId=$VERCEL_USER_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

### User default budgets

A default budget applies to every team member without a custom budget, including members who join later. Setting a custom budget on a member overrides the default; see [Default budgets](#default-budgets) for the full semantics.

#### Dashboard

1. **Open the Users view.** On the [AI Gateway Budgets page](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fbudgets%3Fdimension%3Duser\&title=AI+Gateway+User+Budgets), select **Users**.
2. **Set the user default.** Click **Set Default** (or the current default value, if one is set) and enter a spending limit in dollars and a refresh period in the **User Default** dialog.
3. **Save.** Enter a reason for the change, then save. Every member without their own budget now inherits this limit.

#### CLI

```bash filename="terminal"
vercel ai-gateway budgets set user --default --amount 50 --refresh-period monthly
```

```text filename="Output"
✓ Set default     user
  Limit           $50
  Refresh         monthly
  Applies to      every team member without their own budget, including existing ones
```

List defaults with `vercel ai-gateway budgets list --defaults`, and remove the user default with `vercel ai-gateway budgets remove user --default`.

#### API

Set the user default:

```bash filename="terminal"
curl -X PUT "https://api.vercel.com/ai-gateway/budgets/defaults?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "scopeType": "user",
    "limitAmount": 50,
    "refreshPeriod": "monthly"
  }'
```

List all defaults:

```bash filename="terminal"
curl "https://api.vercel.com/ai-gateway/budgets/defaults/list?teamId=$VERCEL_TEAM_ID" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

Remove the user default:

```bash filename="terminal"
curl -X DELETE "https://api.vercel.com/ai-gateway/budgets/defaults?teamId=$VERCEL_TEAM_ID&scopeType=user" \
  -H "Authorization: Bearer $VERCEL_TOKEN"
```

## Budgets and credits

Budgets limit usage; they do not reserve or purchase capacity. Your team still needs [credits or a payment method](/docs/ai-gateway/pricing) to make requests.

> **💡 Note:** [BYOK](/docs/ai-gateway/authentication-and-byok/byok) spend isn't counted in
> budgets. Spend that draws on your own provider keys is metered separately and
> doesn't count toward any limit. The [BYOK without fallback
> fee](/docs/ai-gateway/pricing#byok-without-fallback) is the exception: AI
> Gateway deducts it from your AI Gateway Credits, and it counts toward
> budgets. An exceeded budget still rejects BYOK
> requests in its scope with an HTTP `402` response.

## Search the docs from your terminal

Search the Vercel docs and read pages as Markdown with the Vercel CLI. No login required.

```bash
# Find docs pages by keyword
npx vercel@latest docs search "environment variables"
npx vercel@latest docs search "function timeout"

# Print a docs page as Markdown, by path or URL
npx vercel@latest docs inspect <page>
```

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
