Usage
Get token usage
Sums persisted token usage over the half-open [from, to) window. Organization owners receive complete agent, model, and time-series attribution; other members receive access-scoped attribution and an unattributed residual. Totals and metering-source totals stay organization-wide. Optionally scoped to one metering source.
Authorization
bearerAuth AuthorizationBearer <token>
In: header
Path Parameters
orgId*string
Query Parameters
from*string
Match
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$Format
date-timeto*string
Match
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$Format
date-timesource?string
Value in
- "daemon"
- "gateway"
tz?integer
Range
-900 <= value <= 900Default
0Response Body
application/json
curl -X GET "https://example.com/v1/orgs/string/usage?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z"{ "from": "string", "to": "string", "accessSyncDegraded": true, "accessIssues": [ { "provider": "string", "region": "string", "reason": "authorization" } ], "totals": { "sessions": 0, "totalTokens": 0, "costAmount": "string", "costCurrency": "string" }, "agents": [ { "agentId": "string", "sessions": 0, "totalTokens": 0, "inputTokens": 0, "outputTokens": 0, "thoughtTokens": 0, "cachedReadTokens": 0, "cachedWriteTokens": 0, "costAmount": "string" } ], "models": [ { "sessions": 0, "totalTokens": 0, "inputTokens": 0, "outputTokens": 0, "thoughtTokens": 0, "cachedReadTokens": 0, "cachedWriteTokens": 0, "costAmount": "string", "model": "string" } ], "sources": [ { "sessions": 0, "totalTokens": 0, "inputTokens": 0, "outputTokens": 0, "thoughtTokens": 0, "cachedReadTokens": 0, "cachedWriteTokens": 0, "costAmount": "string", "source": "daemon" } ], "unattributed": { "sessions": 0, "totalTokens": 0, "inputTokens": 0, "outputTokens": 0, "thoughtTokens": 0, "cachedReadTokens": 0, "cachedWriteTokens": 0, "costAmount": "string" }, "series": { "bucket": "hour", "points": [ { "start": "string", "costAmount": "string", "byAgent": { "property1": "string", "property2": "string" }, "byModel": { "property1": "string", "property2": "string" } } ] }}