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

ai-api-pricing

v0.1.1

Published

Source-linked AI API pricing data and deterministic cost estimates.

Readme

ai-api-pricing

Zero-runtime-dependency TypeScript/JavaScript access to the source-linked AICostBudget AI API Pricing Dataset.

Data, history and issue tracker: aicostbudget/ai-api-pricing-data on GitHub. Spot a wrong price? Open an issue with the official source link.

npm install ai-api-pricing
import { estimateCost } from "ai-api-pricing";
const estimate = await estimateCost({
  modelId: "gpt-4.1", inputTokens: 1_000_000, outputTokens: 100_000,
});
console.log(estimate.total, estimate.officialSourceUrl, estimate.lastVerifiedAt);

The package exports loadPrices, getPrice, listModels, estimateCost, and compareModels. Live loading uses the GitHub Pages JSON with a 10-second timeout and falls back to the bundled snapshot on any fetch or validation error. Check the returned source field to distinguish live from bundled data. Missing required prices raise a typed MissingPriceError; the package never substitutes another rate.

From price per token to cost per result

A price estimate is the cost of one call. To measure what one correct result costs on your models, including retries and reasoning tokens, use the open LLM cost-per-task benchmark: 16 tasks with code-only validators, run with your own API keys, priced from this dataset.

Refresh the bundled snapshot

From the repository root, run:

npm run refresh-bundle --workspace ai-api-pricing

The generator reads the checked-in api/v1/prices.json, embeds its generated_at value, and rewrites src/generated/bundled.ts. Review and commit that generated file with the package change.

Data license and citation

Code is MIT-licensed. Pricing data is licensed under CC BY 4.0. Attribution: AICostBudget AI API Pricing Dataset, https://aicostbudget.com/en/datasets/ai-api-pricing, DOI 10.5281/zenodo.23087250.

Prices are verified against official provider pages; always confirm before billing decisions.