v6

latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-01485121699.8 KB

Get Token Breakdown

Per-agent session token consumption breakdown.

For each agent session shows where the context budget was spent: system prompt (Bernstein overhead), context files, task description, tool call results accumulated at runtime, and assistant output.

Identifies optimization opportunities - e.g. if 60% of tokens are context files the agent never used.

Args: request: FastAPI request. session_id: If provided, return breakdown for a single session only.

Returns: JSON with sessions list and aggregate summary.

get/costs/token-breakdown

Query parameters

session_idstring nullable

Response

Successful Response

{"stackTrail":"paths:/costs/token-breakdown:get:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}