1. The denial of wallet ai threat
A denial-of-wallet incident usually traces to one of three shapes:Runaway agent loop
Runaway agent loop
An agent retries the same failing tool or re-plans in a tight loop,
re-paying for tokens on every pass. No malice required — a bad stop
condition is enough.
Injected fan-out
Injected fan-out
A prompt injection steers the
agent into spamming a tool or issuing oversized requests, multiplying
spend per turn.
Leaked or over-scoped key
Leaked or over-scoped key
A key ends up somewhere it shouldn’t — a committed
.env, a shared
notebook — and an attacker runs inference on your account until the
spend is noticed.2. Per-run cost ceiling with cap_cost
The Firewall’s cap_cost verdict is a circuit-breaker for runaway loops.
You author it as a rule with a per-run cents cap; the engine sums the
agent run’s accumulated spend and, once the run crosses the cap, resolves
the verdict to deny — every later tool call in that run is blocked.
cap_cost is a pre-dispatch ceiling: it evaluates before the call
reaches the tool, so it stops the next expensive call rather than
refunding one already made. A typical catch-all cap on every tool:
firewall_blocked — marked skip-retry, so the loop can’t
hammer around the denial. The ceiling is per agent run and summed
across your whole workspace policy, so one runaway conversation can’t
bleed into another’s budget.
See the Firewall rules reference for the full
matching language and where cap_cost sits among the other verdicts.
3. Hard budget per key with credit_limit_usd
cap_cost bounds a single run. To bound a key — every run it ever
issues — set credit_limit_usd on the API key. It’s a hard USD ceiling on
that key’s lifetime spend: the gateway converts it into the key’s remaining
quota, and once the key has spent its allowance, further relay calls are
rejected for insufficient credit. 0 means unlimited.
Pair it with the key’s other scopes so a leaked key is bounded on every
axis at once:
credit_limit_usd
Hard USD spend ceiling for the key (
0 = unlimited).expired_time
Auto-expiry timestamp (
-1 = never). A short-lived key bounds the
blast-radius window.allow_ips
Pin the key to known source IPs — a leaked key is useless off-network.
model_limits
Restrict the key to specific models, so it can’t reach the priciest
ones at all.
credit_limit_usd it
should never legitimately exceed. The limit is the budget, not a guess at
attacker behavior — even a fully-compromised key stops at the ceiling.
Configure all of this from the console key editor (or the token API) under
your session — these are key settings, not relay calls. Only the
/v1/*
inference requests use the sk-orca-... key itself. Editing the limit
takes effect on the key’s next request; no redeploy.4. Catch the spike you didn’t predict: cost anomalies
A static cap stops spend you anticipated. The Firewall’s anomaly detection catches the spend you didn’t. It learns each workspace’s normal tool-use shape against an hour-of-week baseline (a 14-day rolling average) and surfaces deviations on a Member-readable feed:| Anomaly | What it flags |
|---|---|
burn_spike | Cost for a tool far above its learned baseline cost — the denial-of-wallet signal. |
rate_spike | Call volume far above baseline — fan-out and floods. |
retry_loop | The same tool with the same arguments repeating in a tight window — the classic runaway loop. |
5. Putting it together
Layer the three so a runaway never reaches the bill:| Control | Scope | When it fires |
|---|---|---|
cap_cost rule | One agent run | Run’s accumulated spend crosses the cents cap |
credit_limit_usd | One key, lifetime | Key’s total spend hits its USD ceiling |
burn_spike / retry_loop | Workspace, learned | Spend or repeat pattern deviates from baseline |
cap_cost on *, a credit_limit_usd on
every agent key, and a habit of checking the anomaly feed. Roll a new
cap_cost policy out in shadow mode
first — it logs [shadow] would deny without blocking — so you can size
the cap against real traffic before it bites.
6. Related threats
Denial of wallet rarely arrives alone — the loop that burns your budget is often driven by something upstream:- Prompt injection — injected instructions are a common trigger for fan-out and tool spam.
- Excessive agency — an agent with too much latitude has more ways to spend.
- Dangerous tool calls — the same firewall rule plane bounds what a tool may do, not just how much it costs.
- The threat model — where runaway cost fits in the full agentic attack surface.
Firewall overview
Verdicts, anomaly detection, autonomy levels, and observability.
Scoped keys & policies
How key limits, guardrails, and firewall policies compose per key.
