feat(cli): add /usage for per-turn token timeline#160
Merged
emal-avala merged 2 commits intomainfrom Apr 22, 2026
Merged
Conversation
Complements /cost (aggregate totals) with a per-turn breakdown: model, input, output, cache read, cache write — plus a total row and a cache-hit-rate hint pulled from the totals. Reads the `usage` payload on each assistant message. Messages without usage (older sessions, streaming failures) are skipped rather than shown with zeros, so the table only reports turns where data is real.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
3 tasks
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.
Summary
Adds `/usage` — a per-turn token timeline table.
Followed by a one-line cache hit rate hint. `/cost` stays the go-to for aggregate cost; `/usage` is for "where did my tokens go this session?".
Why
`/cost` already shows per-model aggregates, but you can't see a timeline — was turn 3 the one that ate the context, or turn 7? The per-turn table answers that without needing to dig through tracing logs.
Handles mixed-model sessions: each row picks the model that turn actually used (the `model` field on the assistant message), falling back to the session's current model when it's missing.
Implementation
Test plan