Repository navigation
feat: add a Session Cost Rate widget - #671
Merged
Merged
Conversation
Session Cost shows what a session has cost so far, but not how fast it's spending. Session Cost Rate divides the session cost by time, the agent's hourly rate: `Rate: $5.00/hr`. By default it divides by the time Claude spent working (the API duration Claude Code reports), which reads as the rate for the hours it actually worked. A `t` keybind switches to clock time, the whole session including time spent waiting for the user, which reads as the burn rate. It shows nothing until a full minute of the chosen time has passed, since a rate over the first seconds swings wildly.
This was referenced Oct 9, 2026
pcvelz
added a commit
to pcvelz/ccstatusline-usage
that referenced
this pull request
Oct 11, 2026
Upstream: label prefixes editable with e (sirmalloc#601, sirmalloc#666), Session Cost Rate (sirmalloc#671) and Extra Usage Daily Budget (sirmalloc#672) widgets, own-lock-only usage lock clearing (sirmalloc#624), NO_PROXY and request deadlines, terminal control-sequence sanitizing, git hardening and linear-time parsing, shared searchable option editor (sirmalloc#649) and widget base classes (sirmalloc#646-sirmalloc#654), node: imports (sirmalloc#657), Number.* globals lint (sirmalloc#645), test waits on redraw instead of fixed delays (sirmalloc#652). Hand edits outside conflicts: - src/widgets/shared/searchable-option-editor.tsx: compat fix - ports the fork's ref-based input handling (Enter picks from what was just typed) into upstream's new shared editor - src/utils/usage-fetch.ts: compat fix - fork's fetchFreshUsageData uses upstream's clearOwnUsageLock (sirmalloc#624) instead of the removed clearUsageLock - src/widgets/ApiUsage.tsx, src/widgets/Battery.ts: compat fix - Number.isNaN/Number.parseInt for upstream's no-restricted-globals rule - src/utils/__tests__/usage-prefetch.test.ts: compat fix - mock renamed to upstream's mockFetchUsage - src/tui/components/__tests__/PowerlineSetup.test.ts, src/tui/components/__tests__/StatusLinePreview.test.ts, src/tui/components/__tests__/TerminalWidthMenu.test.ts: compat fix - drop the fork's flushInk import, unused after upstream's waitFor switch - README.md: upstream notes linked docs/USAGE.md (deleted in the fork); inlined the proxy and workspace-trust text instead; upstream's own release-note entries not taken - .fork-keep-deleted: src/widgets/FableWeeklyUsage.ts (upstream widget, unregistered in the fork, which ships WeeklyFableUsage.ts) - src/widgets/WeeklyFableUsage.ts: compat fix - adopts upstream's shared getUsagePercentWidgetEditorDisplay, which carries the time-cursor modifier - src/tui/__tests__/App.test.ts: fork deviation - one extra down-arrow for the fork's Off Hours main-menu row - src/widgets/__tests__/CacheTimer.test.ts, src/widgets/CacheTimer.ts: compat fix - emoji toggle moved from e to o because upstream reserves e for edit-label - src/widgets/AgentAddress.ts: split the session-title guard into its own if (same behaviour) so the .fork-invariants nameSource guard matches again - docs/test-retirements.md: ledger for tests upstream renamed or replaced
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.
What
A new Session Cost Rate widget shows the session's cost per hour:
Rate: $5.00/hr. It sits next to Session Cost in the picker's Session category.Why
Session Cost shows what a session has cost so far, but not how fast it's spending. A rate makes long and short sessions comparable, and on usage-based plans, where session cost is close to what's actually billed, it reads as the agent's hourly rate.
How
cost.total_api_duration_msClaude Code sends with the status payload. That reads as a rate for the hours it actually worked. Atkeybind in the line editor switches to clock time (cost.total_duration_ms, the whole session including time spent waiting for the user), which reads as the burn rate. The editor row shows(active time)or(clock time).$5.00/hr).Rate: $4.90/hr(the Session Cost sample over 30 minutes).Demo
A status payload with $2.50 over a 2-hour session in which Claude worked for 30 minutes: the third widget uses active time ($2.50 ÷ 0.5 h), the fourth clock time ($2.50 ÷ 2 h).
Powerline
Plain
Switching between active and clock time with
tin the line editor:Powerline
Plain
Testing
ttoggle (keybind labels, editor modifier, metadata).main(with docs: explain an empty status line in one folder (workspace trust) #606 and feat(git-is-fork): render forks as an editable glyph #617 merged in locally):bun testgives 2790 pass, 0 fail (Bun 1.4.2), andbun run lintpasses.mainonly by the new widgets. The TUI opens and exits cleanly under both.