Budgets & shared enforcement
Choose the boundary that matters: one session, one machine, or one atomic budget across a team.
On this page
A budget check happens before the call
For each supported request, Leash calculates a conservative allowance from the priced model, request size and maximum output. It checks spent plus reserved amounts before forwarding, then reconciles the reservation with reported usage.
This protects against simultaneous calls spending the same available balance. A conservative reservation can reject a request whose eventual cost would have been lower. Unpriced models fail closed until they have an explicit price.
| Local default | Limit | Period |
|---|---|---|
| Session | $20 | Whole session |
| Daily | $100 | UTC calendar day |
| Monthly | $1,000 | UTC calendar month |
Set a boundary you are comfortable with
Use Settings → Budgets for daily and default session caps. Repository and session rules can add narrower boundaries. A block rule prevents admission; an alert-only rule sends a warning and is not a hard cap. Local CLI configuration lives in ~/.leash/config.toml.
export LEASH_SESSION_CAP_USD=5
export LEASH_DAILY_CAP_USD=25
export LEASH_MONTHLY_CAP_USD=200
leash startReservations survive interruption
A local reservation interrupted by a crash stays conservatively charged. Stop the proxy, inspect provider usage, and reconcile the specific reservation rather than deleting ledger records. Shared and gateway reservations have separate central recovery rules: expired dispatched calls are charged conservatively; never-dispatched admissions can release their allowance.
leash reconcile RESERVATION_ID --cost 0.12