Key balance

GET/v1/balance

How much money the key's account has: granted, spent, left.

Responses

Response

{
  "object": "balance",
  "granted": 100.0,
  "spend": 37.42,
  "balance": 62.58,
  "currency": "USD"
}

no key in the request, or the key is not ours

the key-and-remainder check is unreachable — there is no number, retry later

Details

Needs a key in Authorization: Bearer or x-api-key.

The balance comes from one formula: granted − text spend − effective media spend. Hence three numbers plus a currency:

granted — everything ever credited to the account; spend — total spend, text and media as one number; balance — what is left, granted minus spend; currency — always USD.

What matters about spend: its media part counts not only what was charged but also what is held for generations still running. A hold is released when the job finishes (turning into a charge) or fails (returning the money). That is why balance drops the moment you queue a generation rather than at the end — otherwise ten generations could be queued on money that covers one.

Degradation worth knowing in advance. If our storage is unreachable the response shape does not change, but granted is taken from the account budget, which already has media subtracted; while that budget is in sync, balance comes out the same. If the key-and-remainder check itself is unreachable, the endpoint answers 502 and returns no number at all: no answer is more honest than an invented one.

Code examples
curl https://api.teamtoken.store/v1/balance \
  -H "Authorization: Bearer sk-…"
Request
https://api.teamtoken.store/v1

The panel calls this domain; in your own code use the address above.

The key is never stored: it lives in this tab until you reload the page.

This endpoint takes no parameters.

This request really goes out, but the call itself costs nothing: reading a balance, a catalog or a job's status is not billed.

Response

Press “Send request” above and the answer shows up here.