Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions skills/ai-gateway/references/spend-observability.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ A budget caps AI Gateway spend at one of four scopes:
| Scope | Meters |
| --- | --- |
| Team | Every request across the team |
| Project | Requests authenticated by that project's OIDC tokens |
| Project | Requests authenticated by that project's OIDC tokens or by API keys scoped to that project |
| API key | Requests using that one key |
| User | Requests using keys attributed to that member |
| User | Requests using keys attributed to that member, their personal access tokens, and app tokens issued to them |

Budgets stack. A request must pass every budget in scope, and one exhausted budget rejects it even when the others have room. Exceeded budgets reject further requests with HTTP `402` and type `quota_for_entity_exceeded` until the budget resets or its limit is raised. A budget is a soft cap: the request that crosses the limit completes.

Expand All @@ -39,11 +39,11 @@ Each of project, API key, and user scopes can have one default that covers every

### Spend alerts

Custom budgets can email on 50%, 75%, or 100% of the limit, at most once per period per threshold. Recipients depend on scope: team and project budgets email team owners and members with the Billing role, an API key budget emails the key's creator, and a user budget emails that member. Alerts are informational; a threshold below 100% never blocks requests.
Budgets, including defaults, can email on 50%, 75%, or 100% of the limit, at most once per period per threshold. Spend alerts are off by default. Recipients depend on scope: team and project budgets email team owners, members with the Billing or Security role, and members with the Usage Viewer permission; an API key budget emails the key's creator; and a user budget emails that member. Alerts are informational; a threshold below 100% never blocks requests.

Default budgets do not send spend alerts; set a custom budget on a resource to get alerts for it.
A default budget carries a limit, a refresh period, and optional spend alerts.

BYOK spend is metered separately and does not count toward any budget.
BYOK spend is metered separately and does not count toward any budget. The exception is the BYOK-without-fallback fee: it is deducted from AI Gateway Credits, counts toward the budgets of the key or token that made the request, and can exhaust a budget on its own. An exceeded budget still rejects BYOK requests in its scope with HTTP `402`.

### CLI and API

Expand All @@ -66,11 +66,11 @@ Docs: <https://vercel.com/docs/ai-gateway/observability-and-spend/budgets> and <

## Request authentication

Team budgets count every request. Project budgets apply only to OIDC-authenticated requests from that project's deployments. API key and user budgets apply to key usage. BYOK requests are metered but never counted against a limit. Read the budgets page before changing attribution or defaults; metering is not retroactive for a re-created budget.
Team budgets count every request. Project budgets apply to OIDC-authenticated requests from that project's deployments and to API keys scoped to that project (`projectId`); an unscoped key used in a project's deployment does not count toward that project's budget. API key budgets apply to that key; user budgets apply to member-attributed keys, personal access tokens, and app tokens issued to the member. BYOK provider-key spend is metered but not counted against a limit, except the BYOK-without-fallback fee, which counts toward budgets. Read the budgets page before changing attribution or defaults; re-creating a deleted budget does not reset it, because it comes back with the spend it had already counted in the current period.

### Spend attribution and permissions

Each API key is attributed to the team or to the member who created it. Only member-attributed keys count toward a user budget; OIDC tokens, personal access tokens, and app tokens never do. Attribution is editable: <https://vercel.com/docs/ai-gateway/authentication-and-byok/api-keys#spend-attribution>
Each API key is attributed to the team or to the member who created it. Member-attributed keys, the member's personal access tokens, and app tokens issued to them count toward a user budget; OIDC tokens and app tokens that act as the app itself never do. Attribution is editable: <https://vercel.com/docs/ai-gateway/authentication-and-byok/api-keys#spend-attribution>

Every team role except Contributor can view budgets. An Owner can grant a member the AI Gateway Budget Manager permission, which covers budget writes at every scope except API key budgets, which follow key-editing permission.

Expand Down
Loading