How do I build my own low-balance alert for the Agent API?
The API doesn't send balance alerts itself, but a tiny job can:
- Create a key with only
account:read. - Every hour (or before big batches), call
GET /v1/account. - If
balance_usdis below your threshold, send yourself an alert and pause new runs.
acct = requests.get(f"{BASE}/v1/account", headers=headers).json()
if acct["balance_usd"] < 5:
notify(f"Clatter credits low: ${acct['balance_usd']:.2f}")
Your app should also handle 402 out_of_credits by stopping new runs, since retrying won't help.
Learn more#
Related articles
Still need help?
Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.
Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyzFor deleting your whole account or the data of one service.