diff --git a/skills/ai-gateway/references/spend-observability.md b/skills/ai-gateway/references/spend-observability.md index 1a19feeb..73218826 100644 --- a/skills/ai-gateway/references/spend-observability.md +++ b/skills/ai-gateway/references/spend-observability.md @@ -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. @@ -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 @@ -66,11 +66,11 @@ Docs: 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: +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: 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.