feature: per-session and per-model token and cost aggregation
Open
@huang195 is already working on this.
Since Sep 10, 2026.
enhancement
high priority
- Dominant language
- Go
- Stars
- 13
- Forks
- 40
- Avg merge
- 12h 17m
- Merged PRs (30d)
- 156
Description
Feature Description
The primary deliverable of the release. Today the numbers are per-event: you can see a request,
but not what a session, a model, or a day cost.
The parser already records the full breakdown — parsercommon.TokenUsage carries input,
cache-read, cache-write and output — so what is missing is aggregation, not measurement.
Proposed Solution
- Aggregate per session: input / cache-read / cache-write / output tokens, cost, wall time
- Aggregate per model and per endpoint
- Cache-read and cache-write reported separately — they price very differently and
conflating them makes every cost number wrong - Aggregates survive a restart (depends on #901)
- One documented field-name schema, shared by the TUI metrics view, unattended workloads
and the central collector (#898)
Additional Context
Part of the Cortex v0.9.0 release. Depends on session differentiation — per-session aggregation
is meaningless while two concurrent sessions cannot be told apart. Fix #900 first: that is the
narrower "no token shown at all" bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.