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

@shivam.dixit/token-budget-pricing

v0.1.4

Published

Static per-model pricing lookup table and CostModel for token-budget cost accounting.

Readme

token-budget-pricing

Static per-model pricing lookup table and a ready-made CostModel for token-budget's cost accounting (costModel, maxCost, getUsageReport()).

Pricing changes frequently and this table is a point-in-time snapshot — it will lag reality. Use overrides for up-to-date or custom rates, or supply your own CostModel entirely (e.g. backed by a live pricing API) if that matters for your use case.

Install

npm install @shivam.dixit/token-budget @shivam.dixit/token-budget-pricing

token-budget is a peer dependency (semver range, not pinned).

Usage

import { TokenBudget } from '@shivam.dixit/token-budget';
import { createCostModel } from '@shivam.dixit/token-budget-pricing';

const budget = new TokenBudget({
  maxTokens: 128000,
  model: 'gpt-4o',
  costModel: createCostModel(),
});

budget.addMessage({ role: 'user', content: 'Hello!' });
console.log(budget.stats().cost); // { inputCost, outputCost, totalCost, currency: 'USD' }

Overriding or adding models

const costModel = createCostModel({
  'my-fine-tuned-model': { input: 5e-6, output: 15e-6 }, // USD per token
  'gpt-4o': { input: 3e-6, output: 12e-6 }, // override the built-in rate
});

An unknown model name returns cost 0 rather than throwing — pass overrides for any model not in PRICING_TABLE, or import PRICING_TABLE directly to check what's covered.

What's covered

A snapshot of OpenAI, Anthropic, and Google model pricing — see src/index.ts for the current table. role is accepted by CostModel.costPerToken() for interface compatibility but isn't used here — this model is priced per-model/per-direction, not per-role.

The wider project

Part of the token-budget monorepo — the core package, the other framework/tokenizer adapters, benchmarks, and the flagship coding-agent example all live there. See the compatibility matrix for exactly what every adapter is tested against.

License

MIT