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

weeklygrant

v1.2.2

Published

Estimate the API-equivalent value of a weekly Codex grant from local session logs.

Readme

weeklygrant

See the API-equivalent dollar value of your weekly Codex grant — from the logs already on your machine.

npm npm downloads TypeScript Node.js CI License: MIT

Run it

Published on npm. No install or configuration required:

npx weeklygrant

Want the model-by-model breakdown instead?

npx weeklygrant usage

Other useful commands:

npx weeklygrant --json                  # complete machine-readable report
npx weeklygrant --days 30               # scan files modified in the last 30 days
npx weeklygrant --all                   # scan all history for an estimate
npx weeklygrant --refresh-prices        # look up unknown model prices
npx weeklygrant --home /path/to/.codex  # scan a different Codex home
npx weeklygrant --json --redact         # hide your local Codex home path
npx weeklygrant version                 # print the installed version

Requires Node.js 22 or newer and local Codex session logs. By default, weeklygrant looks in CODEX_HOME and then ~/.codex. Estimates scan the latest 30 days; usage and --json retain all-history behavior.

What you get

In a terminal, npx weeklygrant opens an interactive dashboard showing:

  • estimated weekly API value;
  • confidence in the estimate;
  • weekly quota used and time until reset;
  • grant, quota, and observed-cost graphs.

Use / to switch graphs, / to change the time range, and q or Escape to quit.

npx weeklygrant usage opens a per-model usage dashboard. Use / to select a model, / to change the metric, and -/+ to change the time range.

When output is piped or redirected, weeklygrant automatically prints compact text instead of the interactive UI. Pass --json for the full report.

What the number means

weeklygrant reads token counters and weekly quota observations from your local Codex JSONL session files. It prices the observed token deltas at public API rates, compares that cost with changes in your reported weekly quota, and fits an estimated full-week value.

The result is a planning estimate, not a Codex bill, credit balance, or subscription term. It can be less reliable when:

  • only a small amount of quota has moved;
  • logs are missing or spread across other machines;
  • a model has no known public price;
  • prices or rounded quota observations change.

Low- and no-confidence estimates are withheld in the interactive UI until there is enough reliable quota movement. If there is already enough history to graph, the dashboard still renders quota and cost series and shows the estimate as a dash. Press r to rescan.

[!WARNING] weeklygrant is independent and unofficial. It is not affiliated with, endorsed by, or associated with OpenAI, Codex, or models.dev. Do not use its estimate as the sole reason for a purchase or cancellation decision.

Privacy and networking

Session contents stay on your machine. weeklygrant has no telemetry, analytics, accounts, advertising, or local usage database, and it writes nothing to your session directory.

The default path uses bundled official pricing and makes no network request. --refresh-prices optionally makes one GET request to https://models.dev/api.json to fill prices for unknown models; it never replaces bundled official cards and times out after two seconds. See PRIVACY.md for details.

--json includes the resolved Codex home path. Use --redact before sharing the output. Codex session files may contain prompts even though weeklygrant only reads accounting fields; handle the original files carefully.

How it works

flowchart LR
  Home[Local Codex logs] --> Parse[Token deltas and quota]
  Parse --> Price[Price observed tokens]
  Cards[Bundled official rates] --> Price
  Price --> Fit[Fit weekly API value]
  Parse --> Fit
  Fit --> Output{Output}
  Output -->|Interactive terminal| TUI[Dashboard]
  Output -->|Pipe or --json| Report[Text or JSON]

The scanner recursively reads sessions/ and archived_sessions/ under the resolved Codex home. --days filters files by modification time. Invalid JSONL lines are skipped, and unknown models remain unpriced rather than being assigned a guessed rate.

Token counters are cumulative, so weeklygrant normally prices their positive difference; if a session counter resets, it recovers that request from the request-level usage fields without counting repeated totals twice. Quota history is split at weekly resets and plan changes while small downward jitter is ignored. The estimator rejects divergent slices with a weighted median/MAD filter, then derives the headline from pooled API cost divided by matched quota across the remaining slices. Confidence is based on independent slice agreement, matched coverage, and pair count. The grant graph uses real time and breaks at resets.

The interactive estimate runs in a worker thread so the dashboard remains responsive while files are scanned. The full JSON report also includes pricing sources, rate-card mode, scanned-file and event counts, measurement pairs, dashboard series, per-model usage series, and the resolved Codex home. The estimate TUI skips the per-model usage series to keep the worker payload small.

Develop locally

git clone https://github.com/aneeshpatne/weeklygrant.git
cd weeklygrant
npm ci
npm run dev

Run the checks before submitting a change:

npm test
npm run check
npm run build
npm pack --dry-run

The project uses TypeScript and Node.js 22+ with no runtime dependencies. The estimator lives in src/lib/codex-grant.ts; the CLI and the zero-dep TUI live in src/bin/ (term.ts plus tui.ts). Tests use Node's built-in test runner through tsx. Contribution and synthetic-fixture guidelines are in CONTRIBUTING.md.

License

MIT. Release history is in CHANGELOG.md, and security issues can be reported using SECURITY.md.