MngGetAIUsageByFilter¶
GET ai/usage
The spend report. Figures come from a daily aggregate, so the method is cheap enough for a dashboard that refreshes often.
Access Control¶
Allowed: admin. An administrator sees their brand; a super administrator sees all.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
from, to |
string | YYYY-MM-DD. Default: the last 30 days |
groupBy |
enum | day (default), agent, model, brand, day-agent, day-model |
agentId |
int | Optional filter |
model |
string | Optional filter |
limit, offset |
int | Paging, up to 1000 rows |
Response Data¶
{
"from": "2026-08-18",
"to": "2026-09-17",
"groupBy": "day",
"rows": [
{
"day": "2026-09-17",
"requests": 128,
"inputTokens": 214300,
"outputTokens": 18400,
"tokens": 232700,
"cost": 0.482100,
"errors": 2,
"toolCalls": 74,
"avgLatencyMs": 4120,
"errorRate": 0.0156
}
],
"count": 30,
"totals": { "requests": 3140, "tokens": 5910000, "cost": 12.47, "errors": 19 }
}
Grouping by agent adds agentName to each row, so no second request is needed for the
column.
avgLatencyMs is restored from a stored sum rather than kept as an average: averages
cannot be added across rows of an aggregate, and a dashboard adds rows all the time.
Errors¶
| Code | Error | Description |
|---|---|---|
403 |
AI_ACCESS_DENIED |
The session is not an administrator |