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

llm-prices

v1.0.1

Published

Up-to-date LLM pricing reference and cost calculator — Claude, GPT, Gemini, DeepSeek, Mistral, Grok. Zero dependencies, library + CLI.

Downloads

269

Readme

llm-prices

npm version npm downloads license zero deps

Up-to-date LLM pricing reference and cost calculator. Claude, GPT, Gemini, DeepSeek, Mistral, Grok — input/output/cache prices per 1M tokens, context windows, and a cost calculator. Zero dependencies, works as a library and as a CLI.

Prices are regenerated from LiteLLM's canonical pricing dataset — the same source used across the industry.

Quick start (CLI, no install)

npx llm-prices claude-opus-4-8 --in 200k --out 8k
MODEL            PROVIDER   IN/1M  OUT/1M  CACHE-RD  CTX
---------------  ---------  -----  ------  --------  ---
claude-opus-4-8  anthropic  $5     $25     $0.5      1M

USAGE   TOKENS  COST
------  ------  -----
input   200K    $1
output  8K      $0.2
TOTAL           $1.2

More commands:

npx llm-prices ls anthropic            # all Anthropic models
npx llm-prices ls                      # every model in the dataset
npx llm-prices compare claude-sonnet-5 gpt-5.2 gemini-3.1-pro-preview
npx llm-prices providers

Token counts accept k/m suffixes: 500, 100k, 1.5m.

Library

npm install llm-prices
import { getPrice, calcCost, listModels } from "llm-prices";

getPrice("claude-opus-4-8");
// { id: 'claude-opus-4-8', input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }
// (USD per 1M tokens)

calcCost("gpt-5.2", { input: 120_000, output: 4_000 });
// { input: ..., output: ..., cacheRead: 0, cacheWrite: 0, total: ... }  (USD)

listModels({ provider: "anthropic" });
// [{ id, provider, input, output, cacheRead, cacheWrite, context, maxOutput }, ...]

CommonJS works too:

const { calcCost } = require("llm-prices");

Fuzzy lookup: getModel("fable") resolves to claude-fable-5 when the substring is unambiguous.

Raw data

The whole dataset is a single small JSON you can import directly:

import prices from "llm-prices/data" with { type: "json" };

API

| Function | Returns | |---|---| | getModel(id) | Full entry: prices, cache prices, context window, max output | | getPrice(id) | { input, output, cacheRead, cacheWrite } in USD per 1M tokens | | calcCost(id, { input, output, cacheRead, cacheWrite }) | Cost breakdown + total in USD for given token counts | | listModels({ provider? }) | All entries, optionally filtered | | listProviders() | Provider names in the dataset | | compare(ids) | Entries for several models at once | | updated | ISO date the data was last regenerated |

TypeScript definitions included.

Use in CI

Print the cost of your test-suite's LLM calls on every pipeline run — no install step, npx fetches the CLI on the fly:

# .github/workflows/llm-cost.yml
name: LLM cost report
on: [pull_request]

jobs:
  cost:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      # replace the token counts with your run's actuals
      - run: npx -y llm-prices claude-opus-4-8 --in 250k --out 12k >> "$GITHUB_STEP_SUMMARY"

Or budget-gate a script programmatically:

import { calcCost } from "llm-prices";

const cost = calcCost(process.env.MODEL, { input: usedIn, output: usedOut });
if (cost.total > 5) throw new Error(`LLM budget exceeded: $${cost.total.toFixed(2)}`);

Keeping prices fresh

The dataset ships inside the package and is refreshed with regular releases. To regenerate locally from the live source:

npm run update-prices

If you spot a stale price, open an issue — updates ship fast.

Why not parse provider docs or LiteLLM's 1.6 MB JSON yourself?

  • Small: the curated dataset is ~30 KB vs 1.6 MB upstream.
  • Zero dependencies: nothing but Node ≥ 18.
  • Both worlds: one package for scripts (npx), backends (import), and dashboards (raw JSON).

License

MIT © Cryptoteep