Why
Dashboard TokenBreakdownChart (#3275, wired in #3281) still uses mock data because no backend endpoint provides per-day token aggregation. The burn rate and cost-by-model endpoints exist, but token breakdown (input/output/cache-read/cache-write per day) has no API.
What
Add a new endpoint:
GET /v1/analytics/tokens?from=X&to=Y — returns daily token breakdown
- Response: array of
{ date, inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens }
- Support time range filtering (7d/30d/90d, matching existing TimeRangePicker)
- Aggregate from session cost metadata (same source as
/v1/cost/*)
Done when
Priority: P2
Refs: #3275, #3281, #3264
Why
Dashboard TokenBreakdownChart (#3275, wired in #3281) still uses mock data because no backend endpoint provides per-day token aggregation. The burn rate and cost-by-model endpoints exist, but token breakdown (input/output/cache-read/cache-write per day) has no API.
What
Add a new endpoint:
GET /v1/analytics/tokens?from=X&to=Y— returns daily token breakdown{ date, inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens }/v1/cost/*)Done when
Priority: P2
Refs: #3275, #3281, #3264