Spend Cap

Stop an AI agent from spending past a daily USD budget on model calls. Spend Cap checks each call before the provider is charged, in the SDK and on the Gateway.

Real-Time(Preventive)Checked before the call runs, so it can stop it

A billing agent calls a model all day. Spend Cap gives it a daily budget. Before each model call, Traccia estimates what the call will cost. If that would put the agent over budget, the call is stopped before the provider sees it.

Runs On
The SDK and the Gateway
You Set
A daily USD cap. Optionally a per-run cap, a per-call cap, and a cheaper model to fall back to.
Your Agent Sends
Nothing extra

What Happens

This model callWith Block on
The estimate fits inside every cap you setThe call runs.
The estimate is over a cap, and you named a cheaper modelThe call continues on the cheaper model.
The estimate is over a cap, and there is no cheaper modelThe call is denied. The provider is never called.

Observe records the match and lets the call through. Warn does the same and marks what would have happened. Only Block stops the call.

Set It Up

  1. In the app, open Policies and click Create Policy.
  2. Choose Spend Cap.
  3. Enter the Daily Budget in USD. Add a Per-Run Cap or Per-Call Cap if you want one.
  4. Optionally name a Cheaper Model. The call moves to it instead of stopping.
  5. Set the mode to Block, then click Activate Policy.

In code, wrap your agent with govern(). For apps that cannot use the SDK, point your model client at the Gateway instead. The remaining budget shows on the agent's Cost and Attribution module.

Good To Know

  • Spend Cap is always in USD. Model cost is priced in USD from the model's list price, so there is no currency choice here.
  • Spend Cap limits what the model call costs. To limit money an agent moves through a tool, use Refund Guard or Purchase Guard.
  • Cost Spike Alert is different. It alerts after the spend has already happened.
  • Through the Gateway, a call that reached the provider but got no answer (a timeout or a dropped connection) counts its estimate toward the budget, because the provider may have run and billed it. A call that never reached the provider counts nothing. See Gateway: When The Provider Doesn't Answer.

If Traccia Cannot Be Reached

The call follows your setting under Settings → Policy Enforcement, which blocks by default, in the Gateway and in Python SDK 0.1.34 or TypeScript SDK 0.1.20 and later. Older SDKs let the call through. See Policies: When Traccia Can't Be Reached.

Next Steps

© 2026 Traccia.