Skip to content

Add per-model token counts to cost history#546

Merged
ratulsarna merged 1 commit intosteipete:mainfrom
iam-brain:iam-brain/feat/cost-chart-model-token-counts
Mar 17, 2026
Merged

Add per-model token counts to cost history#546
ratulsarna merged 1 commit intosteipete:mainfrom
iam-brain:iam-brain/feat/cost-chart-model-token-counts

Conversation

@iam-brain
Copy link
Contributor

@iam-brain iam-brain commented Mar 16, 2026

Summary

Add end-to-end per-model token-count plumbing so the cost history chart can show real scanned token counts for each model.

What changed

  • Added totalTokens to CostUsageDailyReport.ModelBreakdown and preserved it during decoding.
  • Updated Codex and Claude scanners to carry per-model token totals into each day's modelBreakdowns.
  • Removed scanner-side truncation so the full deterministic breakdown reaches the UI.
  • Sorted model breakdowns deterministically by cost descending, then token count descending, then model name descending.
  • Kept the row cap in CostHistoryChartMenuView and updated row detail rendering to show cost and token count when available.
  • Added totalTokens to the CLI modelBreakdowns payload for shape consistency.
  • Split scanner breakdown coverage into a focused test file instead of growing the existing scanner test type.

Verification

  • pnpm check
  • swift test
  • ./Scripts/compile_and_run.sh

@iam-brain iam-brain marked this pull request as ready for review March 16, 2026 17:51
@ratulsarna ratulsarna merged commit 7801425 into steipete:main Mar 17, 2026
4 checks passed
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.

2 participants