Docs / Account Management
Query Quota Usage
Use an API key to query the remaining credits, used credits, and unlimited-quota status of the current key and its owning user.
Purpose#
Query the quota of the current API key and the account quota of the user who owns that key. The endpoint returns remaining credits and cumulative used credits at both the key and user levels, making it suitable for balance displays, pre-call checks, and low-balance alerts.
The legacy /api/usage/token/ endpoint has been removed; use this endpoint instead.Request example#
curl --request GET \
--url https://api.apimax.ai/v1/usage \
--header 'Authorization: Bearer sk-xxxx'Authentication and parameters#
This endpoint uses the same API key authentication as model calls and does not require a dashboard login access token.
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
Authorization | header | string | Yes | Bearer <API Key>, i.e. the sk--prefixed string generated when the key was created in the dashboard |
The endpoint takes no query or body parameters. The API key must be enabled and not expired, and must satisfy the key's IP and group restrictions.
Success response#
{
"success": true,
"message": "",
"data": {
"token": {
"remaining_credits": 7.6,
"used_credits": 2.4,
"unlimited_credits": false
},
"user": {
"remaining_credits": 12.5,
"used_credits": 3.5
}
}
}Response fields#
| Field | Type | Description |
|---|---|---|
success | bool | Whether the request succeeded |
message | string | Empty string on success |
data.token.remaining_credits | number | Remaining credits of the current API key |
data.token.used_credits | number | Cumulative used credits of the current API key |
data.token.unlimited_credits | bool | Whether the current key is an unlimited-quota key |
data.user.remaining_credits | number | Remaining credits in the account of the user who owns the key |
data.user.used_credits | number | Cumulative used credits in the account of the user who owns the key |
Credit conversion#
Credits in the response are obtained by dividing the internal quota by the system's QuotaPerUnit. With the current default configuration, 500000 quota = 1 credit:
3800000 quotais returned as7.6 credits- Actual billing still settles by model price, input/output tokens, group multiplier, and other billing rules
unlimited_credits=true means the key is not constrained by its remaining key quota; remaining_credits is still provided as a statistical reference. The user's account quota is still managed under the system's billing rules.
Error responses#
| HTTP | Description |
|---|---|
| 401 | API key missing, invalid, disabled, expired, or its quota is exhausted |
| 403 | The user is disabled, the source IP is not in the key's IP whitelist, or the key's group is unavailable |
| 429 | Request rate limit exceeded |
| 500 | Internal query failure on the server |
{
"error": {
"code": "",
"message": "Invalid token (request id: ...)",
"type": "new_api_error"
}
}
