Usage Logs
GET https://api.aimlapi.com/v2/logs
GET /v2/logs returns one row per request — what it cost, how many tokens it used, whether it succeeded, and the ids you need to tie it back to your own systems.
The time window and key-selection rules are identical to API Key Usage; use that endpoint when you want totals rather than individual requests.
The model and status filters do not split on commas — repeat the parameter instead (?status=succeeded&status=failed). ?model=a,b is read as one model literally named a,b, so it matches nothing and you get an empty page rather than an error.
Get request logs
Returns the requests made in the window, with cost, tokens and correlation ids.
Relative window: a positive integer followed by h or d, for example 24h or 7d. Provide either period or both start and end, never both.
7dWindow start, ISO-8601. A value without a UTC offset is read as UTC. Must be used together with end.
2026-07-01T00:00:00ZWindow end, ISO-8601. Must not be earlier than start, and the window must not exceed 92 days.
2026-07-28T00:00:00ZPrefix of the key to report on. Omit it to list the requests made with the key you are authenticating with. Listing the requests of a different key requires a management key.
abcd1234Keep only requests made to this model. Accepts source/alias (openai/gpt-5) or a bare alias (gpt-5), matched exactly. Repeat the parameter once per model to pass several, up to 50 values; a comma-separated list is read as one long name and matches nothing.
openai/gpt-5Keep only requests with this outcome. Repeat the parameter to accept both (?status=succeeded&status=failed); a comma-separated value is not a valid status and returns 400.
succeededPossible values: Rows per page, 1-100.
50Example: 50Rows to skip before the page starts.
0Example: 0One row per request made in the window, newest first.
curl -L \
--request GET \
--url 'https://api.aimlapi.com/v2/logs?period=7d&model=openai/gpt-5&status=failed&limit=50' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>'One row per request made in the window, newest first.
{
"data": [
{
"created": "2026-07-02T03:04:05.000Z",
"status": "succeeded",
"origin": "api",
"model": "openai/gpt-5",
"cost": {
"usd": 0.25,
"credits": 500000
},
"tokens": {
"input": 10,
"output": 20,
"total": 30
},
"request_id": "req-1",
"inference_id": "inf-1",
"client_request_id": "customer-42"
}
],
"pagination": {
"limit": 50,
"offset": 0,
"total": 1,
"has_more": false
}
}Errors
400
Neither period nor start+end, or both; a malformed date or period; end earlier than start; window over 92 days
401
Missing or invalid key
403
A regular key naming another key's prefix
404
The prefix is not yours, or is outside your key's scopes
429
Over 200 requests per 60 seconds
Last updated
Was this helpful?