Skip to content

feat(dashboard): every token meter shows the total of all four parts - #108

Merged
nambok merged 1 commit into
mainfrom
feat/token-usage-four-parts
Oct 19, 2026
Merged

nambok merged 1 commit into
mainfrom
feat/token-usage-four-parts

Conversation

@nambok

@nambok nambok commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Every token meter now shows the total of all four parts: new input, read from cache, written to cache and output. Before, the meters showed new input plus output only, which left out most of the tokens actually used (cache reads and writes). No money appears on any of these views.

  • Sidebar meter: shows the total against the limit. Hovering it shows the four parts and the cache hit rate.
  • Settings hub row: shows the same total, with the same breakdown on hover.
  • Token limit page: shows the total and a bar, the four parts under it, the cache hit rate, and how the month split across features (ticket runs, PR reviews, plan chat, and so on). Until the limit counts cache tokens, a note explains what the limit compares today.
  • Run detail: shows a total plus the four parts. The per-pass rows and the per-turn counts include cache tokens.
  • Analytics: counts all four parts (the gateway now sums them per run).
  • Limit banner: appears when the number the limit actually compares reaches the limit, and states the total.

Works with the gateway from CoderHelm/coderhelm-platform#166. Against an older gateway with no cache fields, the meters fall back to its own total.

Changes

  • lib/usage.ts: usageParts, usageTotal, cacheHitRate, usageBreakdown, feature labels.
  • lib/api.ts: UsageInfo adds the cache parts, hit rate, the counted number, the flag, and features.
  • client-shell.tsx, settings/use-settings-status.ts, settings/page.tsx, settings/budget/page.tsx, runs/detail/page.tsx, analytics/page.tsx.

Verification

  • eslint . (0 errors), tsc --noEmit, next build for the dashboard.
  • Playwright e2e/settings.spec.ts + e2e/audit-shell.spec.ts: 44 passed. The new test checks that the sidebar meter shows 71.3M / 200M (the total of all four parts, not 1.1M for input plus output) and that its hover lists the four parts and the hit rate. It also checks the hub row, that the page's four parts add up to the API's total, the hit rate, the split by feature, no $ on the page, and no sideways scrolling at 375px.

… with the parts, cache hit rate and split by feature
@nambok
nambok merged commit 3272875 into main Oct 19, 2026
1 check passed
@nambok
nambok deleted the feat/token-usage-four-parts branch October 19, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant