← Catalog

pi-run-stats

Pi extension: append a dim stats line (time, duration, model, thinking level, tool calls, tokens, cost) after each completed AI run

Package

Install

Install with PiG

pig install npm:pi-run-stats

Install with Pi

pi install npm:pi-run-stats
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.

{
  "image": "https://cdn.jsdelivr.net/npm/pi-run-stats/assets/preview.png",
  "extensions": [
    "./extensions/run-stats.ts"
  ]
}

README

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

pi-run-stats

A Pi extension that appends a dim stats line after each completed AI run.

◷ 17:22:31 · 8.4s · opencode-go/deepseek-v4.1-flash · high · 2 turns · 3 tools · 12.3k tok · 38 tok/s · $0.0123

What it shows

After a full agent run settles — every tool call and intermediate reply finished — one line under the reply:

PartMeaning
◷ 17:22:31Timestamp of the run's final assistant message. Older entries are disambiguated: yesterday 10:05:06, Jan 15 09:30:00, 2025-06-03 14:05:06 (expanded shows the absolute date)
8.4sTotal run duration (12m 30s / 1h 50m for long runs)
provider/modelModel that produced the reply
highThinking level, bare value (omitted when the model has none)
2 turnsTurns this run completed. A turn is one model request plus the tool calls it triggered, so this also counts the model requests
3 toolsTool calls this run made (omitted when there were none)
12.3k tokTokens spent by this run, summed over every model request it made (unlike the footer, which accumulates the whole session)
38 tok/sOutput throughput: output tokens over generation time, so tool execution and idle waits are excluded. Omitted when generation time was not measurable
$0.0123Cost of this run, summed the same way

The line shows the per-run figures. Press ctrl+o (Pi's tool-output toggle) to expand the extra breakdown:

◷ 2026-10-09 17:22:31 · 8.4s · opencode-go/deepseek-v4.1-flash · high · 2 turns · 3 tools · 52k tok · 38 tok/s · $0.0300 · gen 6.2s · +2 nested tools ↑29k ↓1.2k R21k W800
  • gen 6.2s — generation time behind the tok/s figure
  • +2 nested tools — calls those tools made to other tools (codemode-style nesting)
  • ↑ ↓ R W — input / output / cache read / cache write

Design notes:

  • The line is stored as a session entry and never enters the LLM context — zero token cost.
  • Only one line per completed run: intermediate tool-call rounds show nothing.
  • Aborted runs (Escape) and runs that end with an error show nothing; the successful retry run does.
  • Entries persist with the session, so reopened sessions still show past lines.
  • Token and cost figures are per run, not cumulative — the Pi footer already shows session totals and context usage.

Install

pi install npm:pi-run-stats

Then restart Pi.

Usage

The line is on by default. Toggle it with:

/run-stats

License

MIT