AI Consumption
Totals and breakdowns of AI consumption
Aggregate totals plus breakdowns by type, model, user and name, and a time series for charting. Uses the same filters as the row list so a chart and the table beneath it cannot disagree.
Authorization
bearerAuth In: header
Query Parameters
Start of the range (inclusive), ISO-8601. Defaults to 30 days ago.
date-timeEnd of the range (exclusive), ISO-8601. Defaults to now.
date-timeValue in
- "ai_agent"
- "ai_generation"
- "ai_classification"
- "ai_summarization"
- "ai_extraction"
- "ai_sentiment"
- "tovi"
- "voice_agent"
Traffic class. Omitted means production only - playground, simulation, preview and node-test spend is recorded but excluded from totals by default.
Value in
- "production"
- "playground"
- "simulation"
- "preview"
- "node_test"
Acting user. System-initiated work is recorded under an explicit system actor.
Case-insensitive substring match against the display-name snapshot.
Free text matched case-insensitively against the source name, model, provider, acting user and type. Narrows the other filters rather than replacing them. Spaces and underscores are interchangeable, so the displayed 'AI Agent' matches the stored ai_agent.
Restrict to successful or failed calls. A failed call still spent input tokens and is recorded, so this is how those are reached in a large result set.
Value in
- "success"
- "error"
SUPERADMIN only. all returns a cross-organization view, which is distinct from omitting the parameter (the caller’s own organization). Ignored for every other role.
Bucket width for the time series.
"day"Value in
- "hour"
- "day"
- "week"
Response Body
application/json
curl -X GET "https://example.com/api/ai-consumption/summary"{ "success": true, "data": { "from": "2019-08-24T14:15:22Z", "to": "2019-08-24T14:15:22Z", "mcpToolCalls": 0, "totals": { "calls": 0, "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "inputCost": 0, "outputCost": 0, "reasoningCost": 0, "totalCost": 0, "durationMs": 0 }, "byType": [ { "calls": 0, "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "inputCost": 0, "outputCost": 0, "reasoningCost": 0, "totalCost": 0, "durationMs": 0, "key": "string", "label": "string" } ], "byModel": [ { "calls": 0, "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "inputCost": 0, "outputCost": 0, "reasoningCost": 0, "totalCost": 0, "durationMs": 0, "key": "string", "label": "string" } ], "byUser": [ { "calls": 0, "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "inputCost": 0, "outputCost": 0, "reasoningCost": 0, "totalCost": 0, "durationMs": 0, "key": "string", "label": "string" } ], "byName": [ { "calls": 0, "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "inputCost": 0, "outputCost": 0, "reasoningCost": 0, "totalCost": 0, "durationMs": 0, "key": "string", "label": "string" } ], "timeseries": [ { "calls": 0, "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "inputCost": 0, "outputCost": 0, "reasoningCost": 0, "totalCost": 0, "durationMs": 0, "at": "2019-08-24T14:15:22Z", "sourceType": "string" } ] }}