Budgets
Spend limits, pricing overrides, and credit accounting.
Budgets are opt-in on each deployment (the GATEWAY_BUDGETS kill-switch,
off by default). Ask your platform operator whether budgets are enabled
before relying on them — with the switch off, no budget check runs at all.
Budgets let you cap spend or token usage at the API key, BYOK Connection, or workspace level, independent of your overall credit balance. They're a tighter, resettable ceiling — not a replacement for topping up credits.
Scopes
Every applicable budget is checked independently on each request — a request is rejected if it would exceed any budget that applies to it, with no pooling across levels (a workspace budget doesn't share headroom with a key budget under it).
| Level | Applies to |
|---|---|
key | One API key |
connection | One BYOK Connection (an @<slug> you've configured) |
workspace | Everything in the workspace |
A budget can cap cost (USD) or tokens (input + output combined).
Reset cadence
| Value | Meaning |
|---|---|
none | No automatic reset — the cap is a lifetime ceiling |
weekly | Resets every Sunday 00:00 UTC |
monthly | Resets the 1st of each month, 00:00 UTC |
| A custom interval in days | Resets every N days from creation |
On exhaustion
A budget-exhausted request returns 402 with code
wesence.budget_exhausted — distinct from wesence.insufficient_credits
(your platform balance is empty) and from a 429 rate-limit rejection. The
response carries which level was breached and, if the budget resets, when:
| Header | Meaning |
|---|---|
X-AI-Setu-Budget-Level | key | connection | workspace |
X-AI-Setu-Budget-Reset-At | RFC 3339 timestamp of the next reset, omitted if the budget doesn't reset |
Branch on error.code, not just the HTTP status — several distinct
conditions share 402. See Errors.
Capping an autonomous agent's spend
If you're wiring up a runtime agent that mints its own short-lived
ephemeral tokens, you can set a spend
cap directly on the token at mint time, independent of whether workspace
budgets are enabled. Once the token's cap is hit, further calls on that
token return 402 with code wesence.credential_cap_exceeded — the rest of
your workspace keeps working.
Configuring budgets
Budgets are managed in the console under Settings → Limits, where you set the level, type, limit, and reset cadence for each one.