Repository navigation
feat: add cost estimate to token usage output - #249
Merged
Merged
Conversation
Read total_cost_usd from Claude Code's session JSONL result entry and surface it in token-usage.json, step summary, and token-report.sh. Also switch token extraction to use the result entry's aggregated usage instead of summing individual assistant messages. Co-Authored-By: Claude <[email protected]>
tend-agent
approved these changes
Apr 11, 2026
tend-agent
added a commit
that referenced
this pull request
Apr 13, 2026
#249 switched the token-usage jq filter to `select(.type == "result")`, an event type that claude-code-action's session JSONL does not emit. Every `token-usage.json` since the merge has reported zero tokens — confirmed across all 61 runs in the past 24h on this repo. Restore the per-assistant-event aggregation from #188 and compute cost from token totals × Claude Opus 4 list prices, since `total_cost_usd` isn't available in this JSONL format. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Apr 13, 2026
max-sixty
added a commit
that referenced
this pull request
Apr 14, 2026
Bumps generator version to 0.0.12 and syncs lockfile. 50 commits since 0.0.11: notifications cost cut + freshness gate (#251, #254), token-report per-run table and cost estimate (#249, #250), review-reviewers outcome-focused Haiku analysis (#255), config workflow_extra/jobs pass-through (#227), canonical author_association tiers across skills (#261, #263), action token aggregation fix (#266), plus numerous review/mention/ci-runner fixes. Co-Authored-By: Claude <[email protected]>
Merged
max-sixty
added a commit
that referenced
this pull request
Apr 14, 2026
Bumps generator version to 0.0.12 and syncs lockfile. 50 commits since 0.0.11. Highlights: - feat: notifications cost cut + freshness gate (#251, #254) - feat: token-report per-run table + cost estimate (#249, #250) - feat: review-reviewers outcome-focused Haiku analysis (#255) - feat: config `workflow_extra` / `jobs` pass-through (#227) - skills: canonical `author_association` tiers (#261, #263) - fix: action token aggregation (#266), plus numerous review/mention/ci-runner fixes > _This was written by Claude Code on behalf of Maximilian_ Co-authored-by: Claude <[email protected]>
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.
Read
total_cost_usdfrom Claude Code's session JSONLtype: "result"entry and surface it intoken-usage.json, the step summary table, andtoken-report.sh. This also switches token extraction to use the result entry's aggregated usage instead of summing individual assistant messages — single jq pass, single source of truth.token-report.shreadscost_usdfrom each run's artifact (falls back to 0 for old runs without the field). Costs are rounded to 2 decimal places and formatted as$X.XX.Footnote notes that cost reflects API list prices, which are a large multiple of the effective rate on Claude Code subscriptions.