Levain LabsLevain Labs
API ReferenceAnalytics

Agents Rollup

Per-agent cost rollup, with each agent's name and slug.

Cost, tokens, and run counts are summed from the workspace's own agent runs, so an agent's totals here match its run list. Activity Levain ran on your behalf (such as building an agent) is reported separately and is not folded into the agent it operated on.

GET
/api/v1/analytics/agents

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Query Parameters

start?|null
end?|null

Header Parameters

X-API-Key?string|null

Response Body

application/json

application/json

curl -X GET "https://api.levainlabs.com/api/v1/analytics/agents"
[
  {
    "agent_id": "string",
    "agent_name": "string",
    "agent_slug": "string",
    "cost_usd": 0,
    "billed_usd": 0,
    "tokens_in": 0,
    "tokens_out": 0,
    "request_count": 0,
    "run_count": 0,
    "total_duration_ms": 0,
    "last_run_at": "2019-08-24T14:15:22Z"
  }
]
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}