← Catalog

pi-tokstream

Producer-only token throughput data for Pi: live tok/s while streaming plus provider-reported usage per exchange, with no rendering. Built to feed renderers like herdr-sidecar.

Package

Install

Install with PiG

pig install npm:pi-tokstream

Install with Pi

pi install npm:pi-tokstream
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.2 (README.md). PiG does not review it.

pi-tokstream

Live tokens per second for your Pi session, recorded as data that other tools can draw. A producer-only Pi and Gentle Shell extension.

What it does

While the main model streams, it estimates the output rate (tok/s); when each message finalizes, it keeps the provider-reported throughput and usage (input, output, cache read, cache write). Finished subagent tasks are relayed with their own last reported usage. Everything goes into an append-only JSONL journal beside the session file, size-rotated so it stays bounded. It renders nothing: renderers such as the herdr-sidecar agents view read the journal and own all presentation.

What it solves

  • "Is the model actually streaming, and how fast?" A side panel can show a live rate without hooking into Pi itself.
  • Invented numbers. Estimates are labeled as estimates, provider numbers as reported, and a missing category is null, never zero.
  • Logs that grow forever. The journal rotates at 2 MiB and keeps one previous generation.

Install

# Gentle Shell
gentle-shell install npm:pi-tokstream

# Pi
pi install npm:pi-tokstream

Then /reload inside the session.

Quick reference

CommandEffect
/tokstream or /tokstream statusthe switch plus the current snapshot (n/a (no data) before any measurement)
/tokstream offstop all journal production until /tokstream on or a Pi restart (not persisted)
/tokstream onresume production

Documentation

I want to…Read
Read the journal from a rendererdocs/journal.md
Know who owns what between producer and rendererdocs/design.md
Run the testsdocs/development.md

License

MIT — see LICENSE.