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

model-cost

v0.0.4

Published

Compare LLM API pricing from your terminal. Supports 300+ models across all major providers.

Readme

Why

LLM pricing changes constantly. Comparing costs means opening multiple browser tabs, hunting through docs, and doing mental math. model-cost gives you instant answers in the terminal:

npx model-cost compare claude-opus-4-6 gpt-4o deepseek-chat

Install

npx model-cost

Or install globally:

npm install -g model-cost

Usage

# List models sorted by price (cheapest first)
model-cost

# Search by name
model-cost claude

# Filter by provider
model-cost --provider anthropic

# Compare models side by side
model-cost compare claude-sonnet-4-6 gpt-4o deepseek-chat

# Calculate cost for token usage
model-cost calc claude-opus-4-6 --input 1M --output 100K

# List all available providers
model-cost providers

# Sort by output cost
model-cost --sort output

# Show all models (no limit)
model-cost --all

# JSON output for scripting
model-cost --json

Output

  model-cost v0.0.1

  Provider          Model                        Input/1M   Output/1M   Context
  -----------------------------------------------------------------------------
  deepseek          deepseek-chat                   $0.28       $0.42    131.1K
  anthropic         claude-haiku-4-5                $1.00       $5.00      200K
  openai            gpt-4o-mini                     $0.15       $0.60      128K
  anthropic         claude-sonnet-4-6               $3.00      $15.00      200K
  openai            gpt-4o                          $2.50      $10.00      128K
  anthropic         claude-opus-4-6                 $5.00      $25.00        1M

Comparing Models

model-cost compare claude-sonnet-4-6 gpt-4o
                    claude-sonnet-4-6       gpt-4o
  --------------------------------------------------
  Provider          anthropic               openai
  Input / 1M        $3.00                   $2.50
  Output / 1M       $15.00                  $10.00
  Max Input         200K                    128K
  Max Output        64K                     16.4K

Calculating Costs

Token counts support K (thousands), M (millions), and B (billions):

model-cost calc claude-sonnet-4-6 --input 1M --output 100K
  claude-sonnet-4-6

  Input       1,000,000 tokens      $3.00
  Output      100,000 tokens        $1.50
  ------------------------------------------
  Total                             $4.50

Fuzzy Matching

Mistype a model name? model-cost suggests the closest matches:

model-cost compare clawde
  ✖ Model "clawde" not found.

  Did you mean:
    - claude-opus-4-6 (anthropic)
    - claude-sonnet-4-6 (anthropic)
    - claude-haiku-4-5 (anthropic)

Options

| Flag | Description | |------|-------------| | -p, --provider <name> | Filter by provider | | -s, --sort <field> | Sort by: input, output, name, provider | | -n, --limit <count> | Number of models to show (default: 20) | | -a, --all | Show all models (no limit) | | -u, --update | Force refresh pricing data | | -j, --json | Output as JSON | | -v, --version | Show version | | -h, --help | Show help |

Programmatic API

import { loadPrices, parseModels, calculateCost, findModel } from 'model-cost';

// Load pricing data
const { data } = await loadPrices();
const models = parseModels({ data });

// Find a model (with fuzzy matching)
const result = findModel({ models, query: 'claude-sonnet-4-6' });

// Calculate cost
if (result.model) {
  const estimate = calculateCost({
    model: result.model,
    inputTokens: 1_000_000,
    outputTokens: 100_000,
  });
  console.log(estimate.totalCost); // 4.5
}

How It Works

  1. Fetches pricing data from LiteLLM's model pricing database
  2. Caches locally in ~/.model-cost/ (refreshes every 24 hours)
  3. Parses and displays chat/completion models with input/output pricing

Credits

Pricing data from LiteLLM -- the open source LLM gateway.

License

MIT


Built with commandcode by @saqibameen