Lago has been able to follow the pace of our releases and has allowed us to focus on what we do best.

Credits & Spend Control
Sell or grant credits, track ongoing balances, and refill wallets before customers run out.
Customers see what they have left.
Finance can collect cash before usage, not after.
Know the ongoing balance.Lago waits until newly ingested usage is included before refreshing the wallet. The ongoing balance, including current usage and taxes, typically updates in under a second after an event lands.
See how ambitious teams build and scale their billing with Lago.
Lago has been able to follow the pace of our releases and has allowed us to focus on what we do best.

Give each agent its own prepaid credits. Scope a wallet to the metrics it burns, like LLM tokens.
The Agent SDK meters and prices each LLM call. Once its usage lands, the agent's ongoing balance typically updates in under a second.
Lago sends balance alerts as an agent's credits run low or reach zero. Your product can use them to pause the agent.
Create an agent's wallet from the API, the CLI or MCP, with its credits and an automatic top-up. Your agents can check their own balance too.
Create a prepaid credits wallet for an AI agent with the Lago CLI:
lago wallets create --input @agent-wallet.json --output jsonThe research agent's wallet holds 500 credits. Whenever its ongoing balance drops below 50 credits, Lago tops it back up to 500.
{
"wallet": {
"external_customer_id": "research_agent",
"name": "Agent budget",
"credits_ongoing_balance": "500.0",
"recurring_transaction_rules": [
{
"trigger": "threshold",
"method": "target",
"threshold_credits": "50.0",
"target_ongoing_balance": "500.0"
}
]
}
}




The balance is invoiced: the prepaid credits left in the wallet, updated when an invoice is finalized. The ongoing balance also accounts for current usage, taxes and draft invoices. Lago waits until a new event is included in usage before refreshing the wallet; the ongoing balance typically updates in under a second after that event lands. Real-time balances are a premium feature.
A wallet can carry recurring top-up rules. A rule triggers on an interval (weekly, monthly, quarterly, semiannual or yearly) or when the ongoing balance crosses a credit threshold. It either adds a fixed number of credits or refills to a target balance. Recurring target top-ups can grant free credits, and paid credits become available after payment succeeds. Lago limits repeated top-ups and backs off after a declined payment. Each rule can have its own expiration date.
Lago tells your product when to act, and your product enforces access. Credits consumption alerts fire an alert.triggered webhook as the balance or ongoing balance crosses up to 20 decreasing thresholds, each with a code such as soft or hard. The wallet.depleted_ongoing_balance webhook fires when the ongoing balance reaches zero or goes negative.
Credits apply to subscription and progressive billing invoices in the wallet's currency, after tax and after any credit notes. They don't apply to one-off invoices. A customer can hold up to 5 active wallets, each scoped to fee types or billable metrics and applied in priority order from 1 to 50.
Granted credits land instantly. Purchased credits land once payment succeeds, whatever the invoice's payment terms. You choose per wallet, rule or transaction whether the top-up invoice is issued right away or only after a successful payment. Credit purchases are advance payments, so they aren't taxed and coupons don't apply.
Not by default: credits roll over from period to period until the balance reaches zero. Set an expiration date and Lago voids the remaining credits when it's reached. You can also void an exact number of credits or terminate a wallet at any time.
Usage alerts fire when a subscription's current or lifetime usage crosses thresholds you set, per subscription or per billable metric. Progressive billing, a premium add-on, invoices as lifetime usage reaches each threshold, so large balances are collected before they build up.