AI Consumption
List AI consumption records
One row per billable AI model invocation, across agents, workflow AI nodes, automations, background extraction, Tovi and voice. Each row carries the token counts, the cost, and the per-million rates the cost was computed from, so a total is reproducible after model prices change. Admin and superadmin only.
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.
Column to order by. Defaults to most recent first.
"startedAt"Value in
- "startedAt"
- "cost"
- "tokens"
- "duration"
"desc"Value in
- "asc"
- "desc"
1 <= value11 <= value <= 10020Response Body
application/json
curl -X GET "https://example.com/api/ai-consumption"{ "success": true, "data": [ { "_id": "string", "organizationId": "string", "environment": "string", "invocationId": "string", "attempt": 0, "parentInvocationId": "string", "sourceType": "ai_agent", "sourceId": "string", "sourceName": "string", "agentId": "string", "workflowId": "string", "workflowNodeId": "string", "conversationId": "string", "callId": "string", "actor": { "kind": "user", "userId": "string", "userName": "string" }, "surface": "in_app", "mode": "production", "provider": "string", "model": "string", "tokens": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0, "reasoning": 0, "total": 0 }, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0, "reasoning": 0, "total": 0, "currency": "string", "credits": 0 }, "pricing": { "source": "catalog", "pricedAt": "2019-08-24T14:15:22Z", "inputPerM": 0, "outputPerM": 0, "cacheReadPerM": 0, "cacheWritePerM": 0, "usdPerCredit": 0 }, "startedAt": "2019-08-24T14:15:22Z", "completedAt": "2019-08-24T14:15:22Z", "durationMs": 0, "status": "success", "errorCode": "string", "backfill": { "source": "string", "runId": "string", "action": "insert", "at": "2019-08-24T14:15:22Z", "insertRunId": "string" } } ], "pagination": { "page": 0, "limit": 0, "total": 0, "totalPages": 0 }}