pi-tps-monitor
Pi extension that measures and displays average model TPS in the status bar.
pi install npm:pi-tps-monitorOr install from the local checkout:
pi install ./path/to/pi-tps- Tracks every assistant response in the current session.
- Computes a running session-average TPS from the final
usage.outputtoken count and the wall-clock generation time. - Shows a live TPS estimate while the model is streaming (based on the number of stream deltas).
- Resets the average when you change models so the number reflects the current model instead of blending fast and slow models together.
- Displays the result in the Pi footer via
ctx.ui.setStatus().
After installing, start Pi and send any prompt that produces a reasonably long reply, e.g.:
write a short poem about recursion
While streaming you'll see something like TPS 45.2 live; after the response
finishes you'll see the session average, e.g. TPS 38.4 (last 42.1).
/tps– show current session TPS stats/tps reset– reset the running average
Pi exposes extension events for the assistant message lifecycle:
message_start– start a timer when an assistant message begins.message_update– count streaming deltas (text_delta,thinking_delta,toolcall_delta) for the live estimate.message_end– readevent.message.usage.output, compute elapsed time, and update the running average.model_select– reset the running average when the active model changes.
npm install
npm run typecheck.
├── package.json # npm manifest + pi package manifest
├── tsconfig.json # TypeScript config
├── src/
│ └── index.ts # Extension entry point
├── test/
│ └── index.test.ts # Unit tests
├── README.md
├── CHANGELOG.md
└── LICENSE
- The live estimate counts stream deltas, which is a proxy for tokens. The final average uses the provider's reported output token count, so it is accurate.
- Stats are kept in memory for the current Pi process. They reset on restart.
To persist across reloads/resumes, store them with
pi.appendEntry()and rebuild the counters fromctx.sessionManager.getEntries()insession_start.