레퍼런스HTTP APILimits & receipts

Cost, tokens and run time of the sessions created in a period

GET
/v1/usage/summary

Adds up the sessions created in [since, until): how many, their estimated provider cost, their tokens, and how long their turns ran. since and until take a date (2026-10-01, that day's 00:00 UTC) or a timestamp with an offset, which is moved to UTC; without until the period ends when the figures are read, so since must then be in the past.

  • scope=me: the sessions the caller started. A personal API key counts as the person who created it; a key nobody created counts the sessions it started itself. Sessions shared with the caller are not added. A key bound to an agent gets 403, as it does from GET /v1/sessions.
  • scope=installation: every session of every owner. Only the workspace owner, signed in, reads it: any other member and every API key get 403.
  • scope=agent with agent_id: the sessions started from any release of that agent, whoever started them. The workspace's owner and admins and the agent's admins read it; anyone else, and every API key, gets 403, and an agent of another workspace, or none, is 404 for everyone. agent_id is required with it and refused with any other scope, and group_by is refused with it.

cost_usd is the sum of cost.amount_usd from GET /v1/sessions/{id}/usage over the same sessions: an estimate, not a bill. cost_complete: false means one of them has a turn still open or one that ended without reporting its cost, so the true total is unknown. run_seconds is wall-clock turn time, waiting for an answer included; an open turn counts up to refreshed_at. Sessions from before tokens were metered count 0 tokens.

group_by=agent, group_by=user or group_by=profile adds groups: the same sessions, each once, under its agent, the user holding it or the session's current profile (sessions.profile_id; a session that changed profile counts whole under the one it has now), largest cost first, read in the same statement as the totals. The groups' session_count, cost_usd and run_seconds add up to the totals (run_seconds is the floor of the running total minus the floor of the one before it, so two groups of 1.5 seconds read 1 and 2), and cost_complete is false when any group's is. id is the agent id, user id or profile id; it is null for sessions without an agent or a profile, or started by a key no person created. name is the agent's name, the user's display name (never an email) or, as profiles have no display name, the profile id; under scope=me a user other than the caller is null. Without group_by there is no groups. It changes nothing.

Scope: sessions:read (API key or cookie session).

Authorization

headerAuthorizationBearer <token>

For servers and scripts: an API key sent as an HTTP bearer token, Bearer <key>. It holds exactly the scopes it was issued with; a key issued before scopes existed holds none. It never needs the CSRF header, and it cannot manage agents, members, teams or API keys. Issue one in the web console under Settings → API keys; each operation names the scope it needs.

Scope: sessions:read

Query Parameters

scope*string

Whose sessions to count. The description says who may read each scope.

Value in"installation""me""agent"
since*|

Start of the period, inclusive: a date (2026-10-01, that day's 00:00 UTC) or a timestamp with an offset, moved to UTC.

until?|

End of the period, exclusive, in the same forms as since. Without it the period ends when the figures are read.

agent_id?string

With scope=agent, the agent whose sessions to count; refused with any other scope.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid
group_by?string

Adds groups: the same sessions under their agent, the user holding them or their current profile.

Value in"agent""user""profile"

Response Body

The figures as of refreshed_at.

application/json
  1. response
scope*string
Value in"installation""me""agent"
period*
refreshed_at*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))$
Formatdate-time
session_count*integer
Range0 <= value <= 9007199254740991
cost_usd*string
Match^\d+(\.\d+)?$
cost_complete*boolean
token_count*integer
Range0 <= value <= 9007199254740991
run_seconds*integer
Range0 <= value <= 9007199254740991
basis*
groups?array<>
Example Request
curl -X GET 'https://example.com/v1/usage/summary?scope=installation&since=2019-08-24'
Example Response
{  "scope": "me",  "period": {    "since": "2026-10-01T00:00:00.000Z",    "until": "2026-10-11T08:15:43.000Z"  },  "refreshed_at": "2026-10-11T08:15:43.000Z",  "session_count": 12,  "cost_usd": "3.218400",  "cost_complete": false,  "token_count": 1824500,  "run_seconds": 5410,  "basis": {    "sessions": "created_in_period",    "cost": "provider_usage_estimate",    "run_time": "turn_wall_clock"  }}