Add token speed widgets (InputSpeed, OutputSpeed, TotalSpeed)#141
Open
olion500 wants to merge 1 commit intosirmalloc:mainfrom
Open
Add token speed widgets (InputSpeed, OutputSpeed, TotalSpeed)#141olion500 wants to merge 1 commit intosirmalloc:mainfrom
olion500 wants to merge 1 commit intosirmalloc:mainfrom
Conversation
- Add SpeedMetrics type for tracking token throughput - Implement speed calculation utilities in speed-metrics.ts - Add InputSpeed, OutputSpeed, TotalSpeed widgets - Extend jsonl.ts to extract timing data for speed calculation - Inject speedMetrics into RenderContext for widget access - Add unit tests for speed widgets
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.
Overview
This PR adds three new widgets that display token throughput (tokens per second) for Claude Code sessions:
Motivation
Token speed metrics help users understand Claude's response performance and can be useful for:
Implementation Details
Speed Calculation
Speed is calculated by measuring active processing time - the time between user requests and assistant responses:
This approach excludes idle time (user thinking, typing) and gives a more accurate representation of Claude's response throughput.
Note: The measured speed includes tool execution time (file reads, bash commands, etc.), so output speed may appear lower than pure token generation speed.
Configuration Example
{ "lines": [ { "items": [ { "type": "InputSpeed", "color": "cyan" }, { "type": "OutputSpeed", "color": "cyan" }, { "type": "TotalSpeed", "color": "cyan" } ] } ] }Example Output