Skip to content

fix(cost): Claude turn cost after restart; no $ on a subscription - #38

Merged
Darknode-Official merged 1 commit into
mainfrom
fix/claude-cost-baseline
Nov 27, 2026
Merged

Darknode-Official merged 1 commit into
mainfrom
fix/claude-cost-baseline

Conversation

@Darknode-Official

Copy link
Copy Markdown
Owner

Claude Code reports total_cost_usd and modelUsage as running totals for the session (they carry across --resume). Nexus subtracted the previous total but kept it only in memory, so after a restart the first turn was charged the session's whole history. That is the $603.14 shown for a 43.6k in / 17.8k out turn.

  • Save the cost and modelUsage baselines in session.json and restore them.
  • A resumed session with no saved baseline: charge at most the turn's token-priced cost.
  • The turn summary no longer repeats the file and command counts from the recap line, and shows $ only when an API key is billed (not on a Claude subscription).

Verified: full npm test green (temp HOME). End to end with a stand-in claude that reports running totals ($0.50 per run): two turns, restart, third turn. Each turn logged $0.50 (the old code logged $1.50 after the restart). No $ without a key; $0.5000 with a key.

…per-turn $ on a subscription

Claude Code reports total_cost_usd and modelUsage as running totals for the
whole session, including --resume. Nexus subtracted the previous total but did
not save it, so the first turn after a restart charged the session's entire
history (a 43.6k/17.8k turn showed $603.14). The baselines are now saved in
session.json and restored; when a resumed session has no saved baseline the
turn is capped at the token-priced cost of that turn.

The turn summary also stops repeating the file/command counts already in the
recap line, and shows a $ figure only when an API key is billed.
@Darknode-Official
Darknode-Official merged commit 4c583bd into main Nov 27, 2026
6 checks passed
@Darknode-Official
Darknode-Official deleted the fix/claude-cost-baseline branch November 27, 2026 04:36
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