- TypeScript 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .pi/extensions | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
Token Speed for Pi
A Pi extension that shows the current model output speed (tokens per second) right next to the model name in the footer (bottom right).
Features
- Live speed over a rolling 1.5-second window, refreshed every 250 ms. Provider startup latency no longer makes the value slowly ramp up.
- Reacts to current slowdowns, bursts, and streaming pauses instead of showing the average since the response started.
- Exact speed after each assistant message, based on reported token usage (
usage.output / duration). - Uses a character-based estimate during streaming and self-calibrates the chars/token factor from completed messages.
- Keeps the last measured speed visible while idle, so the footer always shows how fast the model is running.
- Recreates the built-in footer (pwd, git branch, token stats, cache-hit rate, cost, context usage) and only adds the speed indicator next to the model name.
- Speed is highlighted while streaming and dimmed when idle; it drops out gracefully on narrow terminals.
Installation
Install the extension directly from Forgejo:
pi install https://forgejo.asxh.de/lha/pi-tokenspeed.git
Then restart Pi or run /reload in an active session. Pi stores the package in your global package configuration, so it is available in every project.
To update it later:
pi update --extensions
To remove it:
pi remove https://forgejo.asxh.de/lha/pi-tokenspeed.git
Manual project-local installation
Copy the extension into your project's Pi extension directory:
.pi/extensions/token-speed.ts
Run /reload in Pi. The footer will then show the speed next to the model name.
Manual global installation
To make the extension available in every project without using pi install:
mkdir -p ~/.pi/agent/extensions
cp .pi/extensions/token-speed.ts ~/.pi/agent/extensions/token-speed.ts
Run /reload in an active Pi session or restart Pi.
Usage
No interaction needed — the indicator is part of the footer:
- While streaming: the rolling speed updates live in an accent color, e.g.
↑1.2k ↓340 8.2%/200k claude-sonnet • high • 42.3 tok/s - When idle: the speed of the last completed message stays visible in a dim color.
- Switching the model (
/model,Ctrl+P) automatically resets the token estimation.
Notes
The extension replaces the built-in footer with a re-implementation of it (same content and layout) in order to place the speed next to the model name. If Pi's default footer changes in a future version, the custom footer may need a small adjustment. Other extensions that use setStatus() continue to appear in the status line below the footer stats.
License
MIT