pi-token-speed
Pi extension to measure tokens per second via sliding window.
Package details
Install pi-token-speed from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-token-speed- Package
pi-token-speed- Version
0.1.2- Published
- May 3, 2026
- Downloads
- not available
- Author
- gsanhueza
- License
- MIT
- Types
- extension
- Size
- 13.4 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-token-speed
A Pi Coding Agent extension that displays real-time tokens-per-second (TPS) performance metrics in the status bar while the AI is streaming responses.
Features
- Real-time TPS tracking — measures token throughput as the assistant generates text and thinking content
- Sliding window calculation — uses a 1-second sliding window for accurate, responsive metrics
- Color-coded speed indicators — visual feedback based on performance thresholds
- Fully configurable — customize display, thresholds and colors via
~/.pi/agent/settings.json
Speed Tiers
| Tier | TPS | Color |
|---|---|---|
| 🟥 Slow | 0–15 | #ff4444 (red) |
| 🟨 Medium | 15–30 | #ffaa00 (orange) |
| 🟩 Fast | 30–45 | #00ff88 (green) |
| 🟦 Blazing | 45+ | #44ddff (cyan) |
Installation
This package is a Pi extension. Install it with
npm install pi-token-speed
or
pi install https://github.com/gsanhueza/pi-token-speed
Configuration
You can customize speed thresholds and colors by adding a tokenSpeed section to your ~/.pi/agent/settings.json:
{
"tokenSpeed": {
"display": "tps",
"tpsSlow": 0,
"tpsMedium": 15,
"tpsFast": 30,
"tpsBlazing": 45,
"colorSlow": "#ff4444",
"colorMedium": "#ffaa00",
"colorFast": "#00ff88",
"colorBlazing": "#44ddff"
}
}
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
display |
tps, full |
tps |
Display only TPS or full information |
tpsSlow |
number | 0 |
Minimum TPS threshold ("slow") |
tpsMedium |
number | 15 |
TPS above this is "medium" |
tpsFast |
number | 30 |
TPS above this is "fast" |
tpsBlazing |
number | 45 |
TPS above this is "blazing" |
colorSlow |
string | "#ff4444" |
Color for slow tier |
colorMedium |
string | "#ffaa00" |
Color for medium tier |
colorFast |
string | "#00ff88" |
Color for fast tier |
colorBlazing |
string | "#44ddff" |
Color for blazing tier |
How It Works
- Session Start — Renders the initial status bar entry showing
⚡ TPS: -- - Message Start — When the assistant begins streaming, the engine starts tracking
- Token Update — Each text/thinking delta increments the token counter and updates the display
- Sliding Window — TPS is calculated using the most recent 1-second window of token timestamps for sub-second precision
- Message End — Final average TPS is displayed for the full response
Dependencies
| Dependency | Purpose |
|---|---|
@mariozechner/pi-coding-agent |
Pi Coding Agent SDK (peer dependency) |