Skip to content

Show per-model cached tokens alongside cost in desktop and menubar - #1265

Open
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:feat/token-breakdown-desktop-menubar
Open

Show per-model cached tokens alongside cost in desktop and menubar#1265
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:feat/token-breakdown-desktop-menubar

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

Summary

  • Show per-model input, output and cache-read tokens alongside cost in the desktop Overview and macOS menubar Models rows. Keep observed token counts visible for unpriced models in the desktop Models tables.
  • Carry counts through fresh-session and durable-day aggregation, using the same model-name grouping as cost and the existing billable-output normalization.
  • Invalidate pre-change status snapshots once so an unchanged session corpus also receives the new fields.

Previously, the menubar payload discarded per-model token counts, Overview had no cache-read column, and the desktop Models table hid usage when a model had no attributed cost. A menubar row now includes a secondary line such as 12.3K in · 4.5K out · 67.8K cache read, with its cost on the primary line.

Cache-read means reused input. Cache pricing was already included in attributed cost; this change exposes usage without changing pricing. Cache-write remains a separate payload field and is included in the macOS accessibility description. Reasoning is added to output only where the provider reports it separately.

The new fields are optional. Older payloads still decode, missing counts remain unknown, and known zero stays zero. Alias merges do not present partial counts when a contributor lacks data. Overview uses the period/provider-scoped model rows when available, with its previous daily-history source retained for older payloads. The existing 20-model cap remains. Daily/session cache formats and stored history are unchanged.

Testing

  • Tested locally against real data
  • npm test passes in the completed branch validation run
  • npm run build succeeds

Validation against the unchanged main base (4a9d8852):

  • Root: main 3,738 passed, branch 3,748 passed, five skipped on each. An independent full rerun at 00:01 UTC hit three existing time-sensitive assertions in cli-status-menubar.test.ts: their fixture offsets placed calls in the future. The entire file passed 23/23 on rerun after that window; the other 3,725 tests passed in the full run.
  • Desktop: main 827 passed / 27 failed / 4 skipped; branch 829 passed / 27 failed / 4 skipped. The same 21 usePolled and six overviewSnapshot failures occur under local Node 26 with unavailable jsdom localStorage; no new failures.
  • macOS: 433 tests in 55 Swift Testing suites passed. This is a partial run: 12 XCTest-importing suites cannot compile with the local Command Line Tools and were excluded, then restored. Full Swift-suite validation requires Xcode.
  • Root/app typechecks and builds pass; git diff --check is clean.

The new CLI regression plants a render-v5 snapshot without token fields, verifies that the new binary recomputes the counts, then requires the next identical call to leave the snapshot byte-identical. Pipeline fixtures also cover fresh versus durable history, provider/range selection, alias merging, cache-only usage and unpriced models.

Real Hermes data returns input=139, output=393, cacheRead=30,592, cacheWrite=0 with the existing attributed cost unchanged. A 15-model real corpus also reconciled model counts with the period totals.

Layout was checked using the actual branch components with fixture data: native SwiftUI views at the 360pt popover width, and desktop Overview/Models at 1200px and 900px. An additional 900px check reserved the 186px sidebar and applied the real content padding. Cache values, costs and zero-cost usage remain visible. These are isolated component/native-view renders, not validation of an installed release; no installed applications were replaced.

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