Repository navigation
fix(cost): Claude turn cost after restart; no $ on a subscription - #38
Merged
Merged
Conversation
…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.
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.
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.
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.