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

@tokenledger/cli

v0.7.1

Published

TokenLedger CLI: live LLM pricing (OpenRouter / models.dev / GitHub Copilot / Vercel), multi-lane projections, and credits plans from the terminal.

Readme

@tokenledger/cli

Command-line AI unit economics for SaaS products. Pulls live model pricing from OpenRouter (or models.dev / GitHub Copilot / Vercel AI Gateway with --source) and projects AI spend, revenue, and gross margin for your subscription tiers.

Install

npm install -g @tokenledger/cli
# or local:
npm install @tokenledger/cli
npx tokenledger --help

Requires Node.js ≥ 20.

Commands

tokenledger models [search]

List model pricing — live from OpenRouter (thousands of models), live from models.dev / GitHub Copilot / Vercel AI Gateway with --source, or the bundled estimate catalog with --offline.

tokenledger models
tokenledger models claude
tokenledger models --provider openai --sort price -l 5
tokenledger models --source models.dev "claude-opus"
tokenledger models --source github
tokenledger models --source vercel --sort price -l 10
tokenledger models --featured
tokenledger models -k coding --sort price      # cheapest coding models
tokenledger models -k reasoning -s price -l 10 # cheapest reasoning models
tokenledger models -k vision                   # vision-capable models
tokenledger models --sort context              # largest context windows first
tokenledger models --json

Options: -p, --provider <name>, -s, --sort <price|output|context|provider|id> (default provider), -l, --limit <n>, -k, --category <general|coding|reasoning|vision|image|embedding|audio>, -f, --featured, --source <openrouter|models.dev|github|vercel|offline>, --search <term>, -o, --offline, -j, --json.

Categories are inferred from a model's id/name (plus modality and per-image pricing when available): general (text), coding, reasoning, vision (image input), image (image generation), embedding, audio.

tokenledger search <term>

Same as models <term> — search the catalog by id or name. Handy if search is easier to remember than the positional form.

tokenledger search gpt-4o
tokenledger search claude --source models.dev
tokenledger search gpt-5 --source github
tokenledger search coder -k coding --sort price -l 5

Options: -p, --provider <name>, -s, --sort <price|output|context|provider|id>, -l, --limit <n>, -k, --category <name>, -f, --featured, --source <openrouter|models.dev|github|vercel|offline>, -o, --offline, -j, --json.

tokenledger estimate

Project AI spend, revenue, and margin for a model and tier mix.

tokenledger estimate
tokenledger estimate -m openai/gpt-4o-mini -u 12000
tokenledger estimate -t "Free:8000:0:18000:6000:25000" -t "Pro:3200:29:120000:40000:250000" -u 12000

Options: -m, --model <id>, -u, --users <n>, -t, --tier <spec> (repeatable — usage format Name:users:price:requests, or token format Name:users:price:input:output:quota), -z, --size <short|medium|long|heavy|custom> (default medium), --input-per <n> / --output-per <n> (per-exchange tokens when --size custom), -f, --tiers <file>, --source <openrouter|models.dev|github|vercel|offline>, -o, --offline, -j, --json.

Tiers can be written in business terms (requests per user per month, with an interaction-size preset) — no raw token counts needed. The derived per-exchange token assumption is printed above the projection. Example with the usage format:

tokenledger estimate -m openai/gpt-4o-mini -u 12000 \
  -t "Free:8000:0:100" -t "Pro:3200:29:1000" -t "Business:800:99:5000" --size medium

--size presets: Short (quick answers/classifications), Medium (typical assistant response), Long (detailed generation/analysis), Heavy (large-context/code-heavy), or Custom with --input-per/--output-per. The ADVANCED path (raw input:output:quota) lets power users set exact tokens directly.

tokenledger scenario <file>

Run a projection from a scenario JSON file.

tokenledger scenario scenario.json
tokenledger scenario scenario.json --json

tokenledger compare [models...]

Compare multiple models against the same scenario. Defaults to the curated featured set.

tokenledger compare
tokenledger compare openai/gpt-4o-mini "~google/gemini-flash-latest"
tokenledger compare --scenario scenario.json --limit 10

Compare models across different pricing sources by passing a --source list (commas or spaces) that maps positionally to each model. default means OpenRouter:

tokenledger compare openai/gpt-4o-mini openai/gpt-4o-mini --source models.dev,default
tokenledger compare openai/gpt-4o-mini anthropic/claude-3.5-haiku --source models.dev,offline
tokenledger compare openai/gpt-5.6-sol github-copilot/gpt-5.6-sol --source vercel,github

A single value (e.g. --source models.dev) applies to every model. When the comparison mixes sources, a Source column appears and each model is priced against its own catalog.

Options: --scenario <file>, -t, --tier <spec>, -f, --tiers <file>, -u, --users <n>, -l, --limit <n>, -k, --category <name>, --source <openrouter|models.dev|github|vercel|offline|default,...>, -o, --offline, -j, --json. With -k, --category, the default featured set is narrowed to that category (e.g. compare -k coding compares coding models).

tokenledger init [file]

Scaffold a starter scenario JSON (the bundled Growth plan):

tokenledger init                           # writes scenario.json
tokenledger init my-plan.json -m openai/gpt-4o-mini

tokenledger wizard

Build a scenario interactively, step by step — no JSON required. Every question shows a [default]; press Enter to accept it.

tokenledger wizard
tokenledger wizard --offline
tokenledger wizard --source models.dev
tokenledger wizard --source github
tokenledger wizard --source vercel
tokenledger wizard --name "Launch plan" --file launch.json

Flow: scenario name → token or image lane → model (type an id, or a search term like claude to choose from matches) → total users (0 to keep tier counts as-is) → interaction size (Short/Medium/Long/Heavy, or Custom with your own per-exchange tokens) → number of tiers → per-tier users, price, and requests per user / month → live projection → save to a scenario JSON file. Token budgets are derived automatically from requests × interaction size, and the assumption is shown, so you never enter raw token counts.

Options: --source <openrouter|models.dev|github|vercel|offline>, -o, --offline, -n, --name <name>, -f, --file <file>. To pipe/script answers, set TOKENLEDGER_WIZARD_SCRIPT=1 (respects the non-interactive CLI guard).

tokenledger images [search]

List image-generation model pricing (USD per generated image) — live from OpenRouter (or Vercel with --source vercel), or the bundled catalog with --offline.

tokenledger images
tokenledger images --sort price -l 5
tokenledger images --featured
tokenledger images --json

Options: -p, --provider <name>, -s, --sort <price|provider|id>, -l, --limit <n>, -f, --featured, --source <openrouter|vercel|offline>, -o, --offline, -j, --json.

tokenledger image-estimate

Project image-generation spend, revenue, and margin — the image lane: image model × images/user/month × users.

tokenledger image-estimate
tokenledger image-estimate -m openai/gpt-5-image
tokenledger image-estimate -t "Free:8000:0:5" -t "Pro:3200:29:100" -t "Business:800:99:500" -u 12000

Options: -m, --model <id>, -u, --users <n>, -t, --tier <spec> (repeatable, Name:users:price:imagesPerUser:quota), -f, --tiers <file>, -o, --offline, -j, --json.

tokenledger embeddings [search]

List embedding model pricing (USD per 1M tokens). Best catalogs: --source models.dev or --source vercel.

tokenledger embeddings
tokenledger embeddings --source models.dev --sort price -l 10
tokenledger embed-estimate -m openai/text-embedding-3-small
tokenledger embed-compare --limit 8

tokenledger videos [search]

List video-generation pricing (USD per generated second, typically the 720p list rate from Vercel).

tokenledger videos --source vercel
tokenledger video-estimate -m alibaba/wan-v2.6-t2v
tokenledger video-compare --limit 8

Token-lane cache hits: tokenledger estimate --cache-hit 40 applies a 40% prompt-cache hit rate (uses each model's cacheRead price).

tokenledger credits

Included monthly credits, per-model burn, optional overage budget, and reset timing.

tokenledger credits
tokenledger credits -m openai/gpt-4o-mini --credit-value 0.01 --multiplier 1 --reset monthly
tokenledger credits -t "Pro:3200:29:1000:500:10:0.015" --size medium

Burn: credits = (list AI $ × multiplier) / creditValue. Included credits are prepaid; effective AI cost = overage only. Overage budget is per user; 0 = hard stop (no billed overage). --reset monthly|weekly|never + --reset-day + --as-of drive days-to-reset.

tokenledger image-compare [models...]

Compare image-generation models against the same scenario. Defaults to the curated featured image set.

tokenledger image-compare
tokenledger image-compare openai/gpt-5-image google/gemini-3.1-flash-image
tokenledger image-compare --scenario scenario.json --limit 10

Options: --scenario <file>, -t, --tier <spec>, -f, --tiers <file>, -u, --users <n>, -l, --limit <n>, -o, --offline, -j, --json.

Scenario format

{
  "name": "Growth plan",
  "model": "openai/gpt-4o-mini",
  "users": 12000,
  "tiers": [
    { "name": "Free", "users": 8000, "price": 0, "input": 18000, "output": 6000, "quota": 25000 },
    { "name": "Pro", "users": 3200, "price": 29, "input": 120000, "output": 40000, "quota": 250000 },
    { "name": "Business", "users": 800, "price": 99, "input": 420000, "output": 140000, "quota": 1000000 }
  ]
}

model and users are optional; users scales the per-tier splits proportionally. Tiers may also carry "images" (images generated per user per month) for the image lane:

{ "name": "Pro", "users": 3200, "price": 29, "input": 120000, "output": 40000, "quota": 250000, "images": 100 }

Tiers can instead be written in business terms — requests per user per month plus an optional size preset — and the token budgets are derived for you (default size: medium):

{
  "name": "Growth plan (usage)",
  "model": "openai/gpt-4o-mini",
  "tiers": [
    { "name": "Free", "users": 8000, "price": 0, "requests": 100 },
    { "name": "Pro", "users": 3200, "price": 29, "requests": 1000, "size": "long" }
  ]
}

size is one of short, medium, long, heavy (presets) or custom (which then requires inputPerExchange/outputPerExchange in the tier).

Pricing source

By default every command hits the public OpenRouter models endpoint (https://openrouter.ai/api/v1/models) — no API key.

With --source models.dev, the token-lane commands (models, estimate, scenario, compare, wizard) use the models.dev public catalog instead (https://models.dev, via mdev-sdk) — the same open catalog of providers, models, and prices that powers OpenCode. It carries ~7,000⁺ priced models with provider display names from the catalog itself.

--source github loads the GitHub Copilot slice of models.dev (github-copilot/<model>). GitHub Models (the playground / inference catalog) was retired in July 2026; Copilot is the remaining GitHub-hosted list with public prices.

--source vercel loads Vercel AI Gateway (https://ai-gateway.vercel.sh/v1/models, no API key). Language prices are per token (scaled to USD/1M); image models quote USD per generated image, so the image lane works here too.

compare also accepts a per-model source list: --source models.dev,default prices the first model from models.dev and the second from OpenRouter (default = OpenRouter), each row showing its Source column.

If a live feed is unreachable, the CLI falls back to the bundled estimate catalog and tells you so. Use --offline (alias for --source offline) to force the bundled catalog. Image-lane commands (images, image-estimate, image-compare) run on OpenRouter, Vercel, or the offline catalog — models.dev and GitHub Copilot do not publish per-image prices.

Output

Both referenced money formatting and per-tier tables come from @tokenledger/core, so the CLI always matches the web planner's math. --json emits the full projection for scripting.

License

MIT