Budgets
Definition
A budget is a spend ceiling that the gateway enforces before it forwards a request to an upstream provider. When the spend in the active period reaches the budget, the gateway refuses further requests with quota_exceeded until the period resets or the budget is raised.
Function
Budgets stop a tenant, a gateway, a token, a user, a team or an agent from spending more than intended. All budgets read the same spend ledger, so enforcement, analytics and alerts always agree.
The tenant wallet and the per-level caps
- Tenant wallet — a single running balance per tenant. A tenant can make requests only while its wallet holds spendable balance and is not frozen. The wallet is the single source of truth for tenant-level spend.
- Funding grant — an operator adds funds to a wallet with a one-shot, additive grant. A grant is credited exactly once and, when four-eyes approval is armed, waits for a second operator.
- Platform ceiling — bounds the size of a single grant.
- Freeze — an explicit operator brake on a wallet. Only an explicit unfreeze clears it.
- Tenant spend cap — an optional monthly self-limit that a tenant admin sets on top of the wallet.
- Gateway-level budget — caps the combined spend of every token of one gateway.
- Token-level budget — caps the spend of one authentication token.
- Per-user, per-team and per-agent budgets — cap one member, one department (team), or one agent, under the wallet.
A request is admitted only when the wallet and every applicable cap have room. The most restrictive one wins.
Rules and facts
- Each gateway- and token-level budget has a reset period (
daily,monthlyortotal). The tenant spend cap always resets monthly. - A request's exact cost is known only after the model answers. For concurrent requests under one API key, gateway, workspace, per-user or per-department cap, the gateway therefore reserves an estimate at admission and settles it to the real cost when the request ends. A request refused only because running requests hold the rest of the cap is told to retry in a moment (
quota_exceeded,Retry-After: 5); a user or department whose cap is genuinely exhausted still getsuser_budget_exceeded/team_budget_exceededand should not retry. Before each model call is sent, the gateway grows that reservation to what the call can cost at most (the input estimate plus the longest answer the call may produce, added to what the request has already spent), never beyond the cap. A call whose size does not fit beside the other running requests is refused instead of being sent. A single request can still cost slightly more than it reserved (the provider may count more input than estimated); the ledger records the true cost. A delegated sub-agent's child run takes its own hold against the same per-user and per-department cap, so a tree of children cannot spend past the cap beyond the holds granted; a child that does not fit is refused like any request (a child can be refused while its parent still holds the estimate of its last call, and the parent's agent is told not to retry that sub-agent in the same turn). - The ledger always records the true cost. The reservation governs admission only.
- Budget alerts tell administrators when a budget approaches or reaches its limit. A blocked alert uses the same comparison as enforcement, so it never shows a softer state than reality.
Entering an amount
The tenant spend cap, gateway, token and per-user budgets, agent spending limits and the workflow run budget read what you type exactly, and never change a number silently. The field keeps your text as typed; an amount that cannot be read unambiguously is refused with a message under the field as you type, and nothing is sent.
The wallet top-up field follows its own rule: it accepts 1.000 as one thousand (grouped thousands) and at most two decimal places.
- Accepted: plain digits with at most one decimal separator, a point or a comma:
50,12.5,12,5,0.000001. Surrounding spaces are ignored. An empty field means no cap where a cap is optional. This includes the workflow run budget: emptying the field removes its cap. - Refused as ambiguous:
10,000,10.000and1,234. They could mean ten thousand or ten, so the console asks you to write10000for ten thousand or10.00for ten. - Refused as grouped: thousands separators of any kind, such as
1,234.50,1.000.000or1,00,000. Write the amount without them. - Refused as too precise: more than six decimal places or more than 15 significant digits, because the amount would have to be rounded.
- Refused as not an amount: letters, currency symbols, spaces inside the number, exponents such as
1e3, and signs such as-5. - Refused as out of range: more than 1000000 anywhere; zero where the cap must be positive (agent spending limit, workflow run budget). Elsewhere a zero is accepted, with a warning that it freezes all spend.
A stored amount you do not touch is saved back unchanged when you edit another field on the same form.
See also
- Budget and quota enforcement — configuring every budget level, reset periods, concurrency, alerts and resets.
- Cost attribution — how the cost of a request is computed.
- Rate limiting — caps on request rate rather than spend.
Consumption visibility and budget alerts
The same ledger drives every consumption surface: the per-token spend on the Profile page, the dashboard budget banner, and the notifications center in the sidebar. Only administrators and tenant administrators receive alerts. A personal token's alert is shown only to the token's owner. Rate-limit throttling appears as a separate rate_limit-scope alert in the notifications center. See Soft-threshold alerts for the tiers, thresholds and dismissal rules.