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

FieldMeaning
balanceCurrent account balance in USD.
usedTotal account spend in USD.
totalbalance + used for the account.
balance_quota / used_quota / total_quotaThe same values in internal quota units.
token.remainingRemaining balance assigned to this API key, in USD.
token.usedTotal spend made through this API key, in USD.
token.unlimited_quotatrue 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.