Skip to content

Show per-model token counts in TUI#113

Open
bcchew-art wants to merge 1 commit into
getagentseal:mainfrom
bcchew-art:feat/tui-model-tokens
Open

Show per-model token counts in TUI#113
bcchew-art wants to merge 1 commit into
getagentseal:mainfrom
bcchew-art:feat/tui-model-tokens

Conversation

@bcchew-art
Copy link
Copy Markdown

Summary

Surfaces per-model token totals in the By Model panel of the interactive dashboard. The token data (input, output, cacheRead, cacheWrite) was already computed in session.modelBreakdown.tokens and exposed in codeburn report --format json, but not rendered in the TUI. This adds a single compact tokens column between cost and cache.

  • formatTokens extended to emit a B suffix for values at or above 1e9 so per-model cache totals (typically multi-billion) render as e.g. 4.09B instead of overflowing.
  • ModelBreakdown now aggregates outputTokens in addition to the existing input/cacheRead/cacheWrite, and shows the sum per row.
  • Zero-token rows display - rather than 0.

Before / After

Before (no tokens column):

│ By Model                                                 │
│                              cost  cache  calls          │
│ ██████████ Opus 4.6       $879.94  96.1%   4817          │
│ ████░░░░░░ Opus 4.7       $373.89  94.8%   2325          │

After:

│ By Model                                                 │
│                              cost  tokens  cache  calls  │
│ ██████████ Opus 4.6       $879.94   1.14B  96.1%   4817  │
│ ████░░░░░░ Opus 4.7       $373.89  432.7M  94.8%   2325  │
│ █░░░░░░░░░ Sonnet 4.6      $93.68  156.3M  93.4%   3126  │
│ ░░░░░░░░░░ Haiku 4.5        $4.42   23.4M  92.8%    259  │
│ ░░░░░░░░░░ <synthetic>    $0.0000       -      -      1  │

Test plan

  • npm run build succeeds
  • npx vitest run passes (244/244, 6 new tests covering formatTokens B suffix and the per-model aggregation)
  • npx tsx src/cli.ts rendered and visually checked at 80, 120, and 160 column widths
  • Period switching (1-5) still re-renders the panel correctly
  • Zero-token rows show -, not 0.00K

Add a tokens column to the By Model panel that sums input, output,
cache-read and cache-write tokens per model. The data was already
computed in session.modelBreakdown.tokens but hidden from the TUI.

Extend formatTokens to produce a B suffix for values at or above 1e9
so per-model cache totals (typically in the billions) render compactly.

Column order: cost | tokens | cache | calls.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

Unknown

Very new or empty account. Thorough review recommended.

Trust_Score   Low confidence


Key Signals

Account age Contribution quality Recent activity
1 months N/A Minimal
New account No PRs yet 2/12 months
Repos Followers Unique mergers 100+ ★ repos Signed
7 0 0 0
View full details
  • This repo: First-time contributor

firstlook

@AgentSeal AgentSeal added the needs-validation PR requires validation against real-world usage before review label May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

firstlook: unknown needs-validation PR requires validation against real-world usage before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants