# Auto-recharge

> Top up automatically from a saved card when your balance falls below a threshold, so running work never stops for money.

Source: https://nodus-platform-site.pages.dev/docs/guides/billing/auto-recharge/
Build revision: 211ad9f836655b1c3a2668c4693e442471f28614

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.

## Turn it on

Terminal window

```bash
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`:

```yaml
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`).

## When it recharges

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.

## See what it did

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

Terminal window

```bash
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`.

## When a recharge fails

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](https://nodus-platform-site.pages.dev/docs/guides/billing/when-money-runs-out/).

## Turn it off

Terminal window

```bash
nodus billing auto-recharge --off
```

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