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

@smarzban/pi-usage

v0.1.0

Published

Private local token-usage dashboard for Pi, Claude Code, Codex CLI, and Grok Build

Downloads

13

Readme

@smarzban/pi-usage

A private, local token-usage dashboard for Pi, Claude Code, Codex CLI, and Grok Build.

Install

pi install npm:@smarzban/pi-usage

Run /usage to scan local session metadata and open today's centered overlay dashboard. The default view shows providers used through Pi only. Press o to show the other local sources, then Enter to drill from source to provider to model. Press / to filter source, provider, or model names, Enter to keep the query, and Esc to clear it. Press v to switch between the table and local-time braille graph, where f and c select Fresh and Cache Read metrics. Press e to choose any priced provider and model in Pi's local catalog, including models without configured credentials, and estimate the current selection at pay-as-you-go API rates. Use /usage today, /usage 7d, /usage 30d, /usage month, /usage all, or /usage rebuild for a full local index rebuild followed by today's view. 30d is a rolling 30 local-calendar-day window, while month runs from the first local day of the current month through today. Arrow keys select rows, while Left Arrow or Backspace returns to the previous level. Terminals narrower than 100 columns automatically use a compact inspector layout.

Data and privacy

pi-usage reads only whitelisted usage fields from JSONL session stores and writes a local, normalized JSON index at ~/.pi/agent/pi-usage/index.json with private directory and file permissions. Malformed JSONL records are skipped, and a single line over 64 MiB is discarded rather than retained or retried indefinitely. The index includes source session identifiers and local source-file paths for incremental reconciliation, but never transcript content. It never sends network requests, reads credentials, or retains prompts, code, tool input, or raw transcript lines.

It imports Pi sessions, Claude Code assistant usage, Codex cumulative token snapshots, and Grok Build turn_completed usage. When Pi stores a nested aggregate with explicit local child-session links, the aggregate is omitted only if every linked child resolves to files scanned in the same import; otherwise it remains. Cursor is intentionally unsupported because reliable local usage counters are not available and its database contains credentials.

Fresh means normalized uncached Input + Output + Cache Write. Codex and Grok report cache hits inside their raw input counters, so the importer separates those buckets before indexing. Cache Read stays separate in dashboard headlines and rows. The normalized total counts every consumed bucket once, including Cache Read, and remains available for accounting and cost calculations. For Claude, whose transcript exposes disjoint uncached-input and cache buckets, the importer reconstructs that total; for other harnesses it preserves their reported total. Reasoning and cache columns remain source-native subsets, not values to add again. API-equivalent costs are native recorded values where a harness supplies one and explicitly unavailable otherwise. PAYG estimates apply the selected model's current Pi-catalog rates to the recorded token mix. They remain approximate because tokenization, caching behavior, discounts, and pricing can differ. Neither figure is a subscription balance or guaranteed vendor bill. Claude and Codex local formats can drift, retention and deleted files can make history incomplete, and large histories produce a correspondingly large local JSON index.

License

MIT