feat: total cached-content and reasoning tokens in session usage summary - #491
Open
gurjot-05 wants to merge 1 commit into
Open
feat: total cached-content and reasoning tokens in session usage summary#491gurjot-05 wants to merge 1 commit into
gurjot-05 wants to merge 1 commit into
Conversation
The event tab's per-event usage view already renders every usageMetadata field, but the "Usage Summary for Session" totals aggregated only prompt, candidates, and total tokens. Cached-content (cache-read) and thoughts (reasoning) tokens were invisible at the session level, even though they matter for cost tracking. Sum cachedContentTokenCount and thoughtsTokenCount across the session's events and add "Total Cached Content Tokens" and "Total Thoughts Tokens" rows to the session summary. Each row renders only when its total is greater than zero, so sessions without caching or reasoning are unchanged.
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
Adds session-level totals for cached-content (cache-read) and thoughts (reasoning) tokens to the Event tab's "Usage Summary for Session".
Why
The per-event usage view already renders every
usageMetadatafield, but the session-level rollup only summed prompt, candidates, and total tokens. Cache-read and reasoning tokens are billed differently and are useful for cost-at-a-glance, so they belong in the session totals too.Changes
event-tab.component.ts— extend thesessionUsageMetadatacomputed to also sumcachedContentTokenCountandthoughtsTokenCount.event-tab.component.html— add "Total Cached Content Tokens" and "Total Thoughts Tokens" rows, each shown only when its total is> 0, so sessions without caching/reasoning look unchanged.Testing
npm run buildpasses.