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

tokensaver-cli

v0.1.3

Published

CLI for estimating text tokens and reporting Claude Code / Codex session usage.

Readme

tokensaver-cli

CLI for estimating text token usage and reporting historical Claude Code / Codex session token consumption.

Usage

npx tokensaver-cli "Estimate this prompt"
tokensaver-cli --file ./prompt.txt
tokensaver-cli analyze
tokensaver-cli analyze day --source codex
tokensaver-cli analyze --source codex --top 10
tokensaver-cli analyze --period week --date 2026-05-02
tokensaver-cli analyze week --json

Analyze

analyze scans local session logs and reports totals by source, model, tool category, tool name, and top sessions.

Default locations:

  • Claude Code: ~/.claude/projects
  • Codex: ~/.codex/sessions

Options:

  • --table: print a human-readable table, default output mode
  • --json: print JSON for scripts
  • --source claude|codex: scan only one source
  • --top N: limit session rankings, default 20; use --top all for all
  • day|week|month|total: optional positional period, for example analyze day. week means the latest 7 days through the anchor date; month means the latest 30 days through the anchor date.
  • --period day|week|month|total: filter sessions by date range, default day
  • --date YYYY-MM-DD: anchor date for day, week, or month; default is today
  • --dir PATH: override the session directory for the selected source
  • --claude-dir PATH: override the Claude directory when scanning both
  • --codex-dir PATH: override the Codex directory when scanning both

When running interactively without a positional period or --period, analyze prompts for day, week, month, or total. Non-interactive runs default to day.

Claude reports include both non-cache and cache-aware totals:

  • Total: input + output
  • Cache: cache_read + cache_creation
  • WithCache: input + output + cache_read + cache_creation

Codex cache reads are reported separately but not added again to WithCache, because Codex cached input is already included in recorded input totals.

Tool-level token attribution is heuristic: when a turn uses multiple tools, the turn's tokens are split evenly across those tools. Source and model totals come from the recorded session token usage.

Codex reports also include execCommand details. calls is the observed command count; weighted_calls is the turn-attribution weight used for token splits. Breakdowns include command type, command text, parsed path/query, exit status, largest outputs, and slowest commands. When Codex marks a command as unknown, tokensaver applies a conservative fallback classifier for common command families such as build, test, typecheck, dev server, node eval, git, HTTP, process, terminal, browser control, and file mutation.