Skip to content

Auto-recharge

View Markdown

Auto-recharge buys credits for you when your available balance falls below a threshold you choose. Each recharge is charged to a saved card and emailed to you as a receipt, exactly like a top-up you buy yourself. It is off until you turn it on.

Terminal window
nodus billing auto-recharge --threshold 10 --amount 50

This recharges $50 whenever your available balance drops below $10. If no card is on file yet, the command first opens a Stripe page to save one, then turns auto-recharge on. You can also save a card while buying credits with nodus billing top-up 20 --save-card, and the console billing page has an auto-recharge card that does both.

The same settings live on your org’s BillingAccount:

apiVersion: nodus.dev/v1
kind: BillingAccount
metadata:
name: default
spec:
autoRecharge:
enabled: true
thresholdUSD: "10.00" # at least 5.00
amountUSD: "50.00" # 5.00 to 1000.00
Setting Default Allowed
thresholdUSD "10.00" $5.00 or more
amountUSD "20.00" $5.00 to $1,000.00

Turning it on without a saved card is refused; check PaymentMethodPresent in nodus billing, or save a card through the billing portal (nodus billing portal).

Nodus checks your balance each time it renews the hold of running work, settles inference or storage, or refuses a new hold. It recharges when all of these are true:

  • your available balance is below thresholdUSD;
  • a card is on file;
  • no other auto-recharge is still being paid;
  • the org has had fewer than 5 auto-recharges, and less than $5,000 of them, today (UTC);
  • the last 3 auto-recharges did not all fail.

A recharge usually lands in seconds. Work whose funding is running short keeps running while it is paid, so a successful recharge within that window means nothing stops.

Each recharge is a TopUp with spec.origin: AutoRecharge:

Terminal window
nodus get topups -o wide
nodus billing receipts

nodus billing shows the auto-recharge state from status.autoRecharge: consecutiveFailures, lastAttemptTime, lastResult and, when it has been switched off, disabledReason.

If the card is declined, the recharge TopUp ends Failed (PaymentFailed), nothing is credited, and the billing email and the org’s owners and admins get an email. Auto-recharge tries again the next time the balance is checked.

After 3 failures in a row, Nodus turns auto-recharge off, sets status.autoRecharge.disabledReason to ConsecutiveFailures, shows a banner in the console and emails the same people. To turn it back on:

  1. Update the card in the billing portal: nodus billing portal.
  2. Run nodus billing auto-recharge --threshold 10 --amount 50 again, or set enabled: true.

If your balance runs out while auto-recharge is off, work stops gracefully as described in When money runs out.

Terminal window
nodus billing auto-recharge --off

The saved card stays on file for later; remove it in the billing portal.