API

AgentUsage

Operations

Every route this entity exposes. Each route links to its own reference on this page.

Method Route SDK operation Returns
GET /api/v1/organizations/{org_slug}/pages/agent_usage load The analytics page

Examples

One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.

Golang

Construct client as shown in the Golang setup, then call the operations:

agent_usage, err := client.AgentUsage(nil).Load(map[string]any{"organization_id": "example"}, nil)
if err != nil {
    panic(err)
}
fmt.Println(agent_usage)

Lua

Construct client as shown in the Lua setup, then call the operations:

local agent_usage, err = client:AgentUsage():load({ organization_id = "example" })

PHP

Construct client as shown in the PHP setup, then call the operations:

$agent_usage = $client->AgentUsage()->load(["organization_id" => "example"]);

Python

Construct client as shown in the Python setup, then call the operations:

agent_usage = client.AgentUsage().load({"organization_id": "example"})

Ruby

Construct client as shown in the Ruby setup, then call the operations:

agent_usage = client.AgentUsage.load({ "organization_id" => "example" })

TypeScript

Construct client as shown in the TypeScript setup, then call the operations:

const agent_usage = await client.AgentUsage().load({ organization_id: "example" })

Fields

Field Type Required Description
days array Yes One cell per (day, model), ascending by day then model.
ended_at string Yes Ended At
pricing_version string Yes The price table in effect now; rows carry the version they were priced at.
source string Yes Which store served the rows.
started_at string Yes Started At
user_days array Yes One cell per (day, person), ascending by day.
users array Yes One row per (person, model), descending by tokens.
window string Yes Window

load

GET /api/v1/organizations/{org_slug}/pages/agent_usage

Operation ID: api_v1_pages_agent_usage.

Authentication: bearer token (bearerAuth).

Parameters

Parameter In Type Required Description
org_slug path string Yes
window query enum: 7d, 30d No 7d (default) or 30d.

Responses

200: The analytics page

application/json

Property Type Required Description
days array of object Yes One cell per (day, model), ascending by day then model. Days with no usage are absent.
days[].api_call_count integer Yes
days[].cache_creation_input_tokens integer Yes
days[].cache_read_input_tokens integer Yes
days[].date string Yes ISO date.
days[].estimated_cost_usd string Yes Decimal USD summed from each row's capture-time price.
days[].input_tokens integer Yes
days[].model string Yes Provider model id; '' when the checkpoint reported none.
days[].output_tokens integer Yes
days[].session_count integer Yes
days[].total_tokens integer Yes
days[].unpriced_tokens integer Yes Tokens in total_tokens whose model had no list price, so the cost is a floor when non-zero.
ended_at string Yes
pricing_version string Yes The price table in effect now; rows carry the version they were priced at.
source enum: tinybird, outbox Yes Which store served the rows.
started_at string Yes
user_days array of object Yes One cell per (day, person), ascending by day. user is null for hosted agents.
user_days[].api_call_count integer Yes
user_days[].date string Yes ISO date.
user_days[].estimated_cost_usd string Yes
user_days[].output_tokens integer Yes
user_days[].session_count integer Yes
user_days[].total_tokens integer Yes
user_days[].unpriced_tokens integer Yes
user_days[].user object or null Yes
users array of object Yes One row per (person, model), descending by tokens. user is null for hosted agents.
users[].api_call_count integer Yes
users[].estimated_cost_usd string Yes
users[].last_active_at string Yes
users[].model string Yes
users[].output_tokens integer Yes
users[].session_count integer Yes
users[].total_tokens integer Yes
users[].unpriced_tokens integer Yes
users[].user object or null Yes
window enum: 7d, 30d Yes
400: Unknown window
401: Unauthorized
403: Forbidden
404: Organization not found or not accessible
422: Unprocessable entity
502: Bad gateway