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

@inferwise/pricing-db

v1.0.0

Published

Maintained pricing database for LLM providers

Downloads

504

Readme

@inferwise/pricing-db

Maintained pricing database for LLM providers. Ships bundled JSON pricing for Anthropic, OpenAI, Google, xAI, and Perplexity models.

Install

npm install @inferwise/pricing-db

Usage

import { getModel, calculateCost, getAllProviders } from "@inferwise/pricing-db";

const model = getModel("anthropic", "claude-sonnet-4-20250514");
const cost = calculateCost({ model, inputTokens: 1000, outputTokens: 500 });
console.log(`Cost: $${cost.toFixed(6)}`);

API

Pricing Queries

  • getAllProviders() — List all supported providers
  • getAllModels() — Get all models across all providers
  • getModel(provider, modelId) — Look up a model by ID or alias
  • getProviderModels(provider) — Get all models for a provider
  • calculateCost(params) — Calculate USD cost for a request
  • getProviderMeta(provider) — Get metadata (dates, source URL)
  • getPricingAgeInDays(provider) — Days since last verification

Capability-Based Model Selection

  • inferRequiredCapabilities(text) — Infer required capabilities from a task description or prompt text. Returns capabilities like "code", "reasoning", "general", "creative", "vision", "search", "audio".
  • getModelsByCapabilities(required, options?) — Find models matching required capabilities, sorted by cost (cheapest first). Filter by provider, status, or max cost.
  • suggestAlternatives(modelId, provider, capabilities) — Find cheaper models that match the same capabilities. Returns alternatives with savings percentage and reasoning.
  • suggestModelForTask(text, options?) — End-to-end: infer capabilities from a task description, find the cheapest capable model, and return it with reasoning.
import { suggestModelForTask, suggestAlternatives, inferRequiredCapabilities } from "@inferwise/pricing-db";

// Suggest the cheapest model for a task
const suggestion = suggestModelForTask("classify support tickets by category");
// → { model: gpt-4o-mini, inferredCapabilities: ["general"], reasoning: "..." }

// Find cheaper alternatives to an expensive model
const alts = suggestAlternatives("claude-opus-4-20250514", "anthropic", ["code"]);
// → [{ model: claude-sonnet-4, savingsPercent: 80, reasoning: "..." }]

Pricing Data

JSON files in providers/ are validated against schema.json in CI. Community contributions welcome — see CONTRIBUTING.md.

License

Apache 2.0