Skip to content

feat: total cached-content and reasoning tokens in session usage summary - #491

Open
gurjot-05 wants to merge 1 commit into
google:mainfrom
gurjot-05:feat/session-cache-reasoning-token-totals
Open

feat: total cached-content and reasoning tokens in session usage summary#491
gurjot-05 wants to merge 1 commit into
google:mainfrom
gurjot-05:feat/session-cache-reasoning-token-totals

Conversation

@gurjot-05

Copy link
Copy Markdown

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 usageMetadata field, 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 the sessionUsageMetadata computed to also sum cachedContentTokenCount and thoughtsTokenCount.
  • 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 build passes.
  • New rows appear only for sessions that used prompt caching / reasoning; other sessions are unchanged.

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.
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