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

@tokenmath/tokenmath

v1.0.1

Published

Zero-dependency developer CLI for LLM token counting, API pricing calculation, and CI/CD budget guardrails.

Readme

TokenMath.net — AI Token Counter & LLM Cost Calculator

TokenMath.net is a production-ready, privacy-first developer utility for real-time AI token counting, prompt caching economics modeling, multimodal calculations, and LLM API budget planning.


Key Features

  • Universal Token Counter: Live token counts across GPT-6 (o200k_base), GPT-4 (cl100k_base), Claude 5 (calibrated BPE), Gemini 3 (SentencePiece), and DeepSeek/Llama.
  • Cost Estimator & Budget Planner: Detailed input, cached read/write, output, and batch pricing with volume scaling.
  • Price Comparison Matrix: Interactive 19-model price matrix with multi-column sorting and 1-click CSV Export.
  • Multimodal Calculators:
    • Audio & Video: Gemini 1 fps video frame tokens (290 tok/s), Whisper STT per-minute rates, and OpenAI TTS.
    • Vision Calculator: High/low-res downscaling and 512×512 tiling calculations for OpenAI, Anthropic, and Google.
  • Developer Tools:
    • Prompt Sanitizer & PII Redactor: 100% client-side redaction of API keys (sk-..., ghp_..., AWS, DB strings), emails, and IPs with whitespace minification.
    • Vector Embeddings & RAG Ingestion: Dimension sizes, chunking parameters, and vector database pricing.
    • GPU TCO Break-Even Solver: Rented H100/A100/L40S vs Cloud API cost inflection threshold.
  • Model Directory (/models) & Dedicated Model Pages (/model/[slug]): 19 pre-rendered static deep-dive pages with Schema.org Product structured data.
  • Developer Guide (/guide) & FAQ (/faq): 12-minute technical guide on caching architecture, batch discounts, and rate limits.
  • TokenMath CLI Companion (npx @tokenmath/tokenmath): Zero-install terminal utility to calculate API invocation costs, compare models, and pipe prompt files into CI/CD budget guardrails.
  • Automated Price Sync (/api/sync-prices): Programmatic endpoint ready for weekly GitHub Actions cron jobs.

TokenMath CLI Companion (@tokenmath/tokenmath)

Execute calculations and count tokens directly in your terminal with zero installation:

# Instant calculation with caching and explicit tokens
npx @tokenmath/tokenmath calculate --model gpt-5-6-sol --input 10000 --output 2000

# Pipe prompt files to count tokens
cat prompt.txt | npx @tokenmath/tokenmath count

# Head-to-head comparison
npx @tokenmath/tokenmath compare claude-sonnet-5 gpt-5-6-sol --input 10000 --output 2000

# Export master pricing registry as JSON
npx @tokenmath/tokenmath prices --json

Or install globally:

npm install -g @tokenmath/tokenmath
tokenmath calculate --model claude-sonnet-5 --prompt system.txt

Tech Stack

  • Framework: Next.js 16 (App Router, Turbopack)
  • Language: TypeScript (Strict Mode)
  • Styling: Tailwind CSS, Lucide Icons
  • Tokenizers: gpt-tokenizer (exact BPE) + calibrated statistical models
  • Architecture: 100% Client-Side Calculations (Zero Prompts Transmitted or Stored)

Getting Started

1. Install Dependencies

npm install

2. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.

3. Production Build

npm run build
npm run start -- -p 3030

Deployment Guide

Option 1: Vercel (Recommended)

  1. Push your repository to GitHub:
    git init
    git add .
    git commit -m "feat: initial production release of TokenMath.net"
    git remote add origin https://github.com/<your-username>/tokenmath.git
    git push -u origin main
  2. Go to vercel.com and click "Add New Project".
  3. Import your tokenmath repository.
  4. Next.js is auto-detected. Click Deploy.
  5. Under Project Settings > Domains, connect tokenmath.net.

Option 2: Cloudflare Pages / Netlify

  • Build command: npm run build
  • Output directory: .next (or standalone)
  • Node.js Version: >= 20.x

Post-Launch Monetization (Google AdSense)

  1. Open public/ads.txt and replace pub-XXXXXXXXXXXXXXXX with your official Google AdSense publisher ID:
    google.com, pub-XXXXXXXXXXXXXXXX, DIRECT, f08c47fec0942fa0
  2. When your AdSense account is approved, paste your client script in components/AdSlot.tsx.
  3. Ad placements can be turned ON/OFF anytime via the hidden Admin Console at /admin.

License & Privacy

TokenMath.net is designed with a privacy-first philosophy. No user input, prompt text, uploaded documents, or calculated figures are ever sent to any remote server or third party.