Setting Up Auto-Topup Without Surprise Bills
Auto-topup keeps your gateway from running dry mid-traffic — but done wrong it's an uncapped spend loop. Here is how to configure it with a ceiling so it helps without becoming a runaway.
Auto-topup solves a real problem: a balance that hits zero mid-traffic starts returning 402s, and your app degrades until someone manually buys credits. But the naive version of auto-topup — "refill whenever low, no limit" — quietly recreates the exact failure that spend limits exist to prevent: an automated loop that can spend without bound. The trick is configuring it so it keeps you running and stays capped.
What auto-topup does
Auto-topup watches your credit balance and buys more when it drops below a threshold you set:
balance < trigger ($X) → charge your payment method for $Y → balance += $YTwo numbers: the trigger (how low before refilling) and the amount (how much to add). Set well, your gateway never runs dry. Set carelessly, it's a faucet with no shutoff.
The runaway risk
Here's the failure mode to design against. Imagine auto-topup with a low trigger and no overall ceiling, plus a runaway agent burning credits fast:
agent loops → balance drops → auto-topup refills → agent keeps looping
→ balance drops → auto-topup refills → … (no ceiling = no stop)Auto-topup just turned a bounded incident (agent hits zero, stops) into an unbounded one (agent spends, refills, spends, refills). The safety property of "running out of money" — which naturally halts a runaway — has been removed.
Auto-topup removes a natural circuit breaker — replace it
Running out of credits is, perversely, a safety feature: it stops a runaway. Auto-topup defeats that, so you must add the circuit breaker back explicitly — a budget cap. Auto-topup without a budget is an uncapped spend loop wearing a convenience label.
Configure it safely: topup + budget together
The safe pattern pairs auto-topup with a hard budget cap. Topup keeps you liquid for legitimate traffic; the budget is the ceiling that stops a runaway even though topup would happily keep refilling:
auto-topup: trigger $20, amount $100 ← keeps you running
budget cap: $2,000 / month (org) ← the real ceiling
normal traffic → topup refills as needed, under the cap
runaway → spend climbs → hits the $2,000 cap → 429 → STOPS
(topup can't refill past a budget that's exhausted)The budget is the thing that makes auto-topup safe: refills happen freely under the cap, and the cap is the hard stop nothing crosses. You get "never runs dry" without "never stops."
Sensible starting values
- Trigger ≈ a few hours of your normal spend, so a refill lands before you'd hit zero.
- Amount ≈ a few days to a week of normal spend, so you're not refilling constantly (each topup is a charge + a webhook).
- Budget cap ≈ your real monthly ceiling, set higher than expected legitimate spend but low enough to bound a runaway.
- Alert at the budget's soft threshold so you hear about heavy spend before the cap, not at it.
Watch the topup frequency
A healthy auto-topup fires occasionally. If it's firing constantly, that's a signal — either your amount is too small (refilling in tiny increments) or your spend genuinely spiked (check cost-vs-usage to see which). Frequent refills aren't just noisy; they're the early warning that something is consuming credits faster than you planned. Each topup is also a real charge against your card, so a tight trigger/amount means more transactions to reconcile.
The takeaway
Auto-topup is the right tool for "never run dry," but on its own it removes the natural circuit breaker that running out of money provides. Always pair it with a hard budget cap: topup keeps legitimate traffic flowing, the budget stops a runaway, and the soft-threshold alert warns you in between. Configured that way, auto-topup is pure convenience; configured without a cap, it's a faucet you forgot to give a handle. Set both in the billing dashboard.