AI Setu Docs
Concepts

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).

LevelApplies to
keyOne API key
connectionOne BYOK Connection (an @<slug> you've configured)
workspaceEverything in the workspace

A budget can cap cost (USD) or tokens (input + output combined).

Reset cadence

ValueMeaning
noneNo automatic reset — the cap is a lifetime ceiling
weeklyResets every Sunday 00:00 UTC
monthlyResets the 1st of each month, 00:00 UTC
A custom interval in daysResets 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:

HeaderMeaning
X-AI-Setu-Budget-Levelkey | connection | workspace
X-AI-Setu-Budget-Reset-AtRFC 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.

On this page