11Money
Balance
The API wallet is shared by all of an account’s keys. Check the available amount before a batch of requests and handle an insufficient balance in your code.
Check your balance
/balanceAn API key is all you need. The method has no body or parameters, and the request charges nothing.
curl --fail-with-body --max-time 20 \ https://api.rendergrid.io/ api/ public/ v1/ balance \ -H "Authorization: Bearer $RENDERGRID_API_KEY"
import os from decimal import Decimal import requests key = os.environ["RENDERGRID_API_KEY"] response = requests.get( "https://api.rendergrid.io/ api/ public/ v1/ balance", headers={"Authorization": f"Bearer {key}"}, timeout=(5, 20), ) response.raise_for_status() # a string -> Decimal, not float available = Decimal(response.json()["available"]) print(available)
// Node.js 22+, .mjs file const url = "https://api.rendergrid.io/ api/ public/ v1/ balance"; const key = process.env.RENDERGRID_API_KEY; const response = await fetch(url, { headers: { Authorization: `Bearer ${key}` }, signal: AbortSignal.timeout(20_000), }); if (!response.ok) { const body = await response.text(); throw new Error(`HTTP ${response.status}: ${body}`); } // a string: do not convert it to Number const { available } = await response.json(); console.log(available);
{
"currency": "USD",
"balance": "42.5000",
"overdraft_limit": "0.0000",
"available": "42.5000"
}| Field | Type | Meaning |
|---|---|---|
currency | string | The currency code: USD |
balance | string | The current wallet balance. It can be negative within the approved credit line |
overdraft_limit | string | The wallet’s credit line. "0.0000" means prepaid use only |
available | string | How much you can spend: balance + overdraft_limit |
Money amounts are strings
All three amounts are decimal strings in dollars with four digits after the decimal point. Keep that precision: in Python use Decimal, and in other languages use whole units of $0.0001. Binary floating-point numbers are not suitable for money.
| Example | balance | overdraft_limit | available |
|---|---|---|---|
| Regular account | "42.5000" | "0.0000" | "42.5000" |
| Credit line | "-3.0000" | "10.0000" | "7.0000" |
| Empty | "0.0000" | "0.0000" | "0.0000" |
When money is charged
The amount is charged when the request is accepted, before work starts. If the image fails, the charge is refunded automatically.
A failed request is free: the amount goes straight back to your balance.
Reading the balance reserves nothing: while you read it, another request can spend the money. So always handle 402, even if the check passed.
required is the price of this image, and available is how much you have right now. Both amounts are strings in dollars with four decimal places. top_up_url leads to the “Balance and top-ups” section of the portal.
HTTP/1.1 402 Payment Required { "error": { "code": "ERR_INSUFFICIENT_BALANCE", "message": "monthly budget exceeded", "details": { "reason": "monthly_budget_exceeded", "cap": 50.0 } } }
The monthly limit of an account or a key is counted by the UTC calendar month; the refund for a failed image frees that amount again. It is a hard cap: while the limit is used up, generations are not accepted, and nothing is charged to the balance. For more, see “Limits.”
How to read the balance
- Check the balance before a batch of requests and from time to time while you work.
- Reading the balance counts toward the account’s rate limit, but it does not take a generation slot and does not share the task polling interval.
- Do not treat the check as a guarantee: the generation request itself gives the deciding answer.
Top-up
The public API has no top-up method. You top up the balance in USDT in the “Balance and top-ups” section of the portal, or through a manager. The balance and the transaction history are shown there too.
Frequently asked questions
Can I find out the balance of a single key?
When is the money returned for a failed image?
What does “credit line” mean?
overdraft_limit field equals "0.0000", and the account works on prepayment only.