@pi-plugins/speed

Inference speed extension for pi-agent: tokens/sec and time to first token.

Packages

Package details

extension

Install @pi-plugins/speed from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@pi-plugins/speed
Package
@pi-plugins/speed
Version
0.1.2
Published
Jul 23, 2026
Downloads
244/mo · 244/wk
Author
kedom1337
License
MIT
Types
extension
Size
35.4 KB
Dependencies
1 dependency · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./dist/index.mjs"
  ]
}

Security note

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

README

@pi-plugins/speed

A pi-agent extension that measures inference speed per LLM request — tokens per second (TPS) and time to first token (TTFT) — and shows it on a shared status line above the editor.

Install

pi install npm:@pi-plugins/speed

For a one-off run without adding it to settings:

pi -e npm:@pi-plugins/speed

For local development, load it straight from this directory:

pi -e ./plugins/speed

Usage

/speed   # session report: last request + per-model aggregates & quantiles

Example report:

Inference speed — this session (14 requests)

Last request  anthropic/claude-opus-4-6
  48.3 tok/s · TTFT 920ms · 1.2k tok in 25.6s

Per model
  anthropic/claude-opus-4-6    12 req · 45.1 tok/s · 14.8k tok
    TTFT   p50 1.02s · max 2.31s
    tok/s  p50 45.8 · min 39.2
  openai/gpt-5.5                2 req · 88.7 tok/s · 3.1k tok
    TTFT   max 690ms
    tok/s  min 86.1

Notes

  • Samples are kept per session (up to 1000) and reset when the session ends.
  • Quantiles are exact (nearest-rank over the raw samples, per model) and gated: a percentile is shown only once at least 2 samples lie strictly beyond its rank.
  • TPS uses provider-reported token counts, so reasoning/thinking tokens count toward throughput even when they are not displayed.
  • While a response is streaming, the status line only shows the measured TTFT; the tokens/sec figure appears once the request completes and real usage is known. There is deliberately no mid-stream tok/s estimate.
  • The measured TTFT is end-to-end from pi's perspective; providers that batch their first deltas will look slightly slower than raw API metrics.