Auto-topup (NWC)
Auto-refill AI credits from your Nostr-connected wallet when your balance runs low — with thresholds and daily caps.
Auto-topup keeps you from ever hitting a 402 mid-task. Connect an NWC (Nostr Wallet Connect) wallet once, set a threshold and limits, and the platform refills your AI credits automatically when the balance drops below it.
How it works
- You connect an NWC-compatible wallet (Alby Hub, LNBits NWC, Primal,
Umbrel…) in Payments → Wallet, producing a connection with a scoped,
revocable
pay_invoicecapability. - You enable auto-topup with a threshold, a topup amount, and a daily cap.
- A sweep runs every ~15 minutes. If your AI balance is below the threshold, it creates a normal topup invoice and pays it from your NWC wallet — crediting your balance through the standard path (with the +5% Lightning bonus).
Configure it
Dashboard: AI → Billing → Auto-topup (NWC). Or the API:
curl -X POST https://api.zapapi.com/api/v1/ai/auto-topup \
-H "Authorization: Bearer zap_live_your_key" \
-H "Content-Type: application/json" \
-d '{
"nwcConnectionId": "your-nwc-connection-uuid",
"thresholdSats": 500,
"topupSats": 5000,
"dailyCapSats": 20000
}'| Setting | Meaning |
|---|---|
nwcConnectionId | Which of your NWC connections pays |
thresholdSats | Trigger when balance falls below this (min 100) |
topupSats | Amount to refill per trigger (min 100) |
dailyCapSats | Max auto-spend per UTC day (must be ≥ topup amount) |
curl https://api.zapapi.com/api/v1/ai/auto-topup \
-H "Authorization: Bearer zap_live_your_key"
curl -X POST https://api.zapapi.com/api/v1/ai/auto-topup/toggle \
-H "Authorization: Bearer zap_live_your_key" \
-H "Content-Type: application/json" \
-d '{ "enabled": false }'
curl -X DELETE https://api.zapapi.com/api/v1/ai/auto-topup \
-H "Authorization: Bearer zap_live_your_key"Safety rails
- Daily cap — hard ceiling on auto-spend per UTC day.
- Cool-down — minimum interval between consecutive auto-topups per user, so a hovering balance can't fire invoices repeatedly.
- Scoped secret — the NWC connection string is stored AES-encrypted and
can only
pay_invoice; revoke it in your wallet anytime to stop all auto-topups instantly. - Last error surfaced — if a payment fails (wallet offline, insufficient funds), the error is visible on the settings card.
Your wallet stays in control
The NWC standard means your wallet enforces its own budget too — most NWC wallets let you set a max per-payment or daily limit. Auto-topup can never exceed what your wallet allows.
Billing & Sats Pricing
Exactly how per-query pricing works — sats ledger, live FX conversion, the FX buffer, per-component charges, and audit trails.
Project Subscriptions
Recurring billing for your project — plans, hosted checkout, subscriber portal, dunning, and renewals that settle to your settlement wallet.