Skip to main content
Unprice Budgets puts a hard cap in front of an AI agent. A budget sits on a key you choose: a customer, a run, an agent, or an API key. Each paid call asks the budget first, and a call the cap cannot cover never reaches the provider. Budgets need no plans, subscriptions, or payment provider. Your billing stays where it is.

Why a budget

  • Billing is too late. A usage alert or an invoice reports spend after it happened. A budget decides before the call.
  • A provider cap is not a customer cap. A gateway or provider limit caps the bill of the key it sits on. When every customer shares that key, one runaway agent trips the cap for all of them. A budget caps each key you pick.
  • The cap is hard. Each authorization reserves its maximum against every hard limit in one serialized step, so parallel calls cannot overshoot the cap together.

Two calls

Define the budget once, then wrap the paid call.
spend reserves estimate, runs your function, and settles actual. When the cap cannot cover the estimate, it throws BudgetExceededError and your function never runs.

Local or remote checks

Both modes enforce the same cap. Unprice debits a lease from the budget before the process spends it, so local spending never exceeds what the budget granted.

What a budget does not do

  • It does not stop the provider by itself. Your integration must keep the call within the amount it authorized, for example with maxOutputTokens.
  • It does not price usage. estimate and actual come from your code, in the budget’s unit.
  • It does not bill your customers. Keep your billing system, or use Unprice billing when you want plans, credits, and invoices.

Where budget state lives

Cloudflare creates each budget near its first request, so checks stay fast wherever your backend runs. A budget’s state may therefore live outside the EU, unlike the rest of the hosted Unprice runtime.

Quickstart

Cap one customer’s model calls in five minutes.

Keys and limits

Choose keys, units, windows, and who may raise a cap.

Spend against a budget

spend, authorize, charge, and record, and when to use each.

Local mode

Answer checks from memory in long-lived processes.