@duncanbeard/pi-tps-meter

Pi extension: a live braille graph of output tokens/sec while the model streams, with accurate per-response averages.

Packages

Package details

extension

Install @duncanbeard/pi-tps-meter from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@duncanbeard/pi-tps-meter
Package
@duncanbeard/pi-tps-meter
Version
1.0.0
Published
Oct 8, 2026
Downloads
240/mo · 15/wk
Author
duncanbeard
License
MIT
Types
extension
Size
15.7 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/tps-meter.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-tps-meter

A tokens-per-second meter for pi. While the model streams, it draws a live braille line graph of output tok/s above the editor, with response averages beside it.

 100 ┤⠀⠀⠀⠀⣀⢄⢄⡠⢄⢄⠤⣀⠤⣀⠤⣀⢄⣀⠀⠀⠀⠀⣀⡀⡀⠀⣀⡀⡀⢀⢀⡀⣀⣀⣀⡀  71.4 tok/s avg (excl. 2.3s model wait)
     ┤⠀⣀⠔⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡄⠀⢀⠏⠀⠈⠈⠉⠀⠈⠈⠁⠁⠈⠀⠀⠀⠀  58.2 incl. wait · 73.0 now
   0 ┤⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠺⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  ● streaming  1.8k tok · 25.8s gen

Install

pi install npm:@duncanbeard/pi-tps-meter

Or try it for a single session without installing:

pi -e npm:@duncanbeard/pi-tps-meter

What it shows

  • tok/s avg: output tokens divided by generation time for the current response. The headline number leaves out time-to-first-token and tool execution.
  • incl. wait: the same average with model wait (request → first token) added back in. Tool time is never counted.
  • now: the instantaneous rate over a 1-second sliding window.
  • status: ● waiting for the model, ● streaming, ◌ tools while tools run, ○ done when the run ends. Also shows total tokens and generation time.

Commands

Command Effect
/tps Toggle the meter
/tps on / /tps off Show / hide the meter
/tps clear Reset the graph

How it measures

  • While text, thinking, and tool-call deltas stream in, the live rate is estimated at ~4 characters per token.
  • When each assistant message finishes, the estimate is replaced by the provider-reported usage.output, so the averages are accurate.
  • Generation time runs from the first streamed token to the end of the message. Wait time runs from the model request to the first token. Because the request time is taken after tools finish, tool execution never counts as waiting.
  • The graph resets when an agent run starts and when you open a new, resumed, or forked session. /reload keeps it.

The meter only renders in pi's interactive UI.

License

MIT