Repository navigation
Usage view: per-provider/model cost and token analytics over 7/30/90 days - #236
Merged
currentbits merged 5 commits intoAug 17, 2026
Merged
Conversation
Record turn deltas in usageByDay and expose them read-only over usage:byDay.
Pure summarizeUsage rollup plus UsageView with 7/30/90-day and cost/token toggles. Not wired into App or the sidebar.
…into coder/usage-and-cost-analytics-view-per-provid-52e120 # Conflicts: # src/shared/ipc.ts
Adds the Usage nav row, the "usage" AppView route and the appWiring test that pins the nav to the usage.byDay channel. Drops the services.js pass-through so the handler reads the store directly, like activity:list. Closes #152 Co-Authored-By: Claude Opus 5 <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
currentbits
deleted the
coder/usage-and-cost-analytics-view-per-provid-52e120
branch
October 3, 2026 16:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #152.
Solenta only ever showed usage two ways: a per-thread token/cost line and a single "today vs budget" meter in the sidebar. Neither answers the question people juggling five providers actually ask — where did my quota go this week, and to which model.
usageByThreadlooks like it holds that data, but it is a cumulative per-thread snapshot with no time dimension, andspendByDayis cost-only with no provider or model dimension. So this adds the missing ledger and a view over it.Store
New persisted map, pruned by the same 90-day retention as
spendByDay:store.recordUsage()is called at the five places that already record usage — the claude, codex, kimi and opencode run paths inelectron/runner.jsplus the workflow agent roll-up inelectron/workflow.js. It records per-turn deltas keyed on tokens, not on cost:recordSpendskips whencostDelta <= 0, and reusing that gate would have made every subscription provider invisible, which is exactly the case the issue is about.spendByDay,recordSpendand the budget meter are untouched.Wire
usage:byDayhandler reading the store directly (same shape asactivity:list), preload channel,CoderApi.usage.byDay(), plus thewireClient/devCoder/fakeCodermirrors so the web build and the renderer tests stay in parity.View
A Usage nav row next to Activity, rendering
UsageView:Aggregation lives in pure
src/usage.ts(summarizeUsage), which takestodayas a parameter so the rollup is deterministic under test. Empty days inside the range are filled so the chart has no gaps.Not built
The rolling-24h hourly chart (needs hourly buckets and its own retention policy) and cache savings (providers do not report cache hits uniformly). Both are additive on top of this ledger if the daily view proves them wanted.
Verification
npm run typecheckandnpm run buildcleanwireClient × webBridge over a real socket > reconnectasserts a 1s production backoff and gets 120000; it fails identically onmainand is unrelated to this changeelectron/test/budget-spend.test.js, aggregation intest/usage.test.ts, component intest/usageView.test.tsx, and anappWiringtest pinning the Usage nav to theusage.byDaychannelBuilt by two parallel workers on isolated worktrees (store + IPC, and aggregation + view), merged and wired here.