Account Balance
GET https://api.aimlapi.com/v2/billing
GET https://api.aimlapi.com/v2/billing/detail
GET https://api.aimlapi.com/v2/billing/transactions
Get account balance info (legacy)
GET https://api.aimlapi.com/v1/billing/balance
To make a request, you only need your AIMLAPI key obtained from your account dashboard.
Get balance info
Returns a user's balance.
current user balance in USD.
123.45balance currency (always USD)
USDcurl -L \
--request GET \
--url 'https://api.aimlapi.com/v2/billing' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'{
"current_balance": 123.45,
"currency": "USD"
}Get detailed billing info
Returns detailed billing information, balance and auto top-up settings.
User ID.
111User email.
user@example.comCurrent balance in USD.
100.5Currency (always USD).
USDcurl -L \
--request GET \
--url 'https://api.aimlapi.com/v2/billing/detail' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'{
"user_id": 111,
"email": "user@example.com",
"current_balance": 100.5,
"currency": "USD",
"autotopup_settings": {
"is_enabled": true,
"threshold": 50,
"amount": 100,
"currency": "USD"
}
}Get account transactions
The account money feed: one entry per balance movement, either a successful top-up or a charge carrying the model that produced it. Authenticate with a regular AIML API key — there is no key_prefix, because a wallet belongs to the account, not to a key.
For a MODEL_USAGE charge, reference_id is the inference id — the same value returned in the x-inference-id response header and reported as inference_id in Usage Logs.
Page with the cursor, never with an offset. The ledger grows at the head, so a numeric offset silently skips or repeats entries between pages. Pass pagination.next_cursor back as cursor — it is opaque and accepted only in the exact form we issued, so re-encoding it is rejected with 400.
Returns the account's balance movements, newest first.
Only return entries created at or after this moment, ISO-8601 with an offset.
2026-08-01T00:00:00ZOnly return entries created before this moment, ISO-8601 with an offset. Must be later than from.
2026-08-18T00:00:00ZKeep only money coming in (TOPUP) or money going out (CHARGE).
CHARGEPossible values: Keep only entries of this kind.
MODEL_USAGEPossible values: Entries per page, 1-100.
50Example: 50Position to continue from, taken verbatim from the previous response's pagination.next_cursor. The value is opaque and is accepted only in the exact form we issued.
eyJ2IjoxLCJjIjoiMjAyNi0wOC0xN1QxMDowMDowMC4wMDBaIn0One entry per balance movement, newest first.
curl -L \
--request GET \
--url 'https://api.aimlapi.com/v2/billing/transactions?direction=CHARGE&limit=50' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'One entry per balance movement, newest first.
{
"data": [
{
"created_at": "2026-08-17T10:00:00.000Z",
"direction": "CHARGE",
"type": "MODEL_USAGE",
"amount": {
"usd": 1.56,
"credits": 3120000
},
"model": "openai/gpt-5",
"reference_id": "V1StGXR8Z5jdHi6BmyT8k"
}
],
"pagination": {
"next_cursor": "eyJ2IjoxLCJjIjoiMjAyNi0wOC0xN1QxMDowMDowMC4wMDBaIn0",
"has_more": true
}
}Errors
400
to not later than from; an unknown query parameter; limit outside 1–100; an unknown direction or type; a malformed or re-encoded cursor
401
Missing or invalid key
403
A management key — this route is for regular keys
Get account balance info
This endpoint is considered legacy and is scheduled for future deprecation.
Please plan to migrate to the /v2/billing and /v2/billing/detail endpoints documented above.
The total credits associated with the provided API key.
10000000True if the balance is below the threshold.
falseThreshold for switching to low balance status.
10000The date of the request — i.e., the current date.
2025-11-25T17:45:00ZIndicates whether auto top-up is enabled for the plan.
disabledThe status of the plan associated with the provided API key.
currentA more detailed explanation of the plan status.
Balance is current and up to datecurl -L \
--request GET \
--url 'https://api.aimlapi.com/v1/billing/balance' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'{
"balance": 10000000,
"lowBalance": false,
"lowBalanceThreshold": 10000,
"lastUpdated": "2025-11-25T17:45:00Z",
"autoDebitStatus": "disabled",
"status": "current",
"statusExplanation": "Balance is current and up to date"
}Last updated
Was this helpful?