npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@smoose/pi-tps

v0.0.3

Published

Decode throughput (tok/s) in the footer of the pi coding agent

Readme

pi-tps

Decode throughput for pi: how fast the model is actually generating, in the footer.

<icon> 20 tok/s appears once an assistant message settles, and keeps running for the session. The icon tracks the figure: slow (<100), medium (100–200), full (>200). It needs a Nerd Font; without one the icon renders as tofu.

What it measures

tps = Σ provider output tokens / (Σ decode wall time / 1000)
decode wall time = first output token → settled message

The sums run over the most recent 200 settled messages, so a normal session is cumulative and a long one becomes a rolling readout.

  • Decode only. TTFT, queueing, tool execution and retry waits stay out of the denominator, so this reads lower than an end-to-end tokens/second figure.
  • Provider tokens. The numerator is the provider's reported usage.output, never a count of stream deltas. A message with no reported usage is skipped, not estimated.
  • Time-weighted. Windows are summed before dividing; this is not an average of per-message rates, so a slow answer weighs more than a fast one.
  • First token means real output. text_delta, thinking_delta or toolcall_delta carrying a non-empty fragment, or the start of a tool call — the last one counts so a tool call with no argument deltas still gets a first-token time instead of being dropped.
  • Cancelled and failed calls are excluded. They settle as messages but assembled no response, so they contribute nothing to the window.
  • Settled only. The figure never moves mid-stream; a displayed number is always a complete window.
  • One attempt per turn. pi restarts a turn when it auto-retries, so only the attempt that produced the message is measured.

Install

pi install npm:@smoose/pi-tps

Or from a local checkout — point settings at the directory:

{ "extensions": ["/path/to/pi-tps"] }

or symlink it into the auto-discovered directory (/reload picks it up):

ln -s /path/to/pi-tps ~/.pi/agent/extensions/pi-tps

Or run a package once without installing it:

pi -e npm:@smoose/pi-tps

Footer wiring

The extension publishes the tps status key. With @smoose/pi-footer, add a custom item and a segment to ~/.pi/agent/settings.json:

{
  "footer": {
    "segments": ["model", "thinking", "path", "git", "context_pct", "custom:tps", "cost"],
    "customItems": [
      { "id": "tps", "statusKey": "tps", "color": "accent", "hideWhenMissing": true }
    ]
  }
}

hideWhenMissing: true keeps the slot empty until the first message settles. Without a footer extension the key is simply unused; nothing breaks.

State

In memory only. Nothing is written to the session: no custom entries, nothing in the transcript, nothing in /tree. The window is cleared when:

  • the process restarts, or /reload, /new, /resume, /fork recreates the session or the extension;
  • the model changes — decode speed is a property of the model, and blending two models' samples would make the figure meaningless. Selecting the same model again does not clear it.

/tree navigation deliberately does not clear it: rewinding is not a model change and those tokens were still generated. Auto-compaction does not clear it either.

The window holds the 200 most recent samples, and the oldest drop out beyond that.

Development

bun install
bun run typecheck