API documentation
Balance
Check account balance and total spend with an API key.
Use /v1/balance to read the current account balance and accumulated spend. The endpoint uses the same API key as generation requests.
Request
bash
curl https://api.aigate.shop/v1/balance \ -H "Authorization: Bearer sk-your-api-key"Response
json
{ "object": "balance", "currency": "USD", "balance": 12.5, "used": 3.42, "total": 15.92, "balance_quota": 6250000, "used_quota": 1710000, "total_quota": 7960000, "token": { "id": 17, "name": "production", "remaining": 10.0, "used": 1.8, "total": 11.8, "remaining_quota": 5000000, "used_quota": 900000, "total_quota": 5900000, "unlimited_quota": false, "model_limits_enabled": false, "model_limits": {}, "expires_at": 0 }}Fields
| Field | Meaning |
|---|---|
| balance | Current account balance in USD. |
| used | Total account spend in USD. |
| total | balance + used for the account. |
| balance_quota / used_quota / total_quota | The same values in internal quota units. |
| token.remaining | Remaining balance assigned to this API key, in USD. |
| token.used | Total spend made through this API key, in USD. |
| token.unlimited_quota | true means the key spends from the account balance instead of its own fixed limit. |
Request cost
To measure the cost of one request through API only, read /v1/balance before and after the generation call and subtract token.used or account used. For most integrations, token.used is the cleanest value because it belongs to the key that made the request.