opsen
opsen

Budgets and caps

A cap that refuses the call, rather than an alert about money already spent.

Per run

opsen.session(task_id="x", budget_usd=2.00)

The gateway is in the request path, so the model call that would cross the cap is refused. Your code sees a BudgetExceeded; the money is not spent.

Per account

Settings carries a default budget for any run that does not name one, a ceiling over a rolling window across every session, and limits on concurrency and request rate. These are enforced the same way — refusal, not reporting.

Automatic top-up

A balance that reaches zero stops scheduled runs and live sessions, which is correct and also means a nightly job can fail at 3am. Billing can charge a saved card before that happens, with a hard monthly ceiling so a stuck agent cannot recharge repeatedly.

Seeing where it went

/costs splits spend by machine, model and tools, groups by any label, and shows what the same token volume would have cost on other models. It also shows the machine share — an agent idling on a sandbox it forgot to close reads as a high machine share and as nothing else.