Skip to content

BOTOOM/llm-token-calculator

TokenBudget

Sponsor Buy Me a Coffee License: MIT

A powerful token counter and cost calculator for LLM APIs. Compare pricing across OpenAI, Anthropic, Google, Mistral, AWS Bedrock, Qwen, and more.

Features

  • Real-time Token Counting: Accurate token counting using js-tiktoken for OpenAI models
  • Multi-Provider Support: Compare costs across 50+ models from major providers
  • Live Pricing Data: Fetches current pricing from LiteLLM's maintained database
  • Usage Projections: Estimate daily and monthly costs based on your usage patterns
  • Input & Output Analysis: Calculate tokens for both prompts and expected responses
  • Light & Dark Mode: Automatically detects system preference with manual toggle
  • Privacy First: All calculations happen client-side, no data sent to servers

Supported Providers

Provider Models
OpenAI GPT-4.1, GPT-5, GPT-5.4, o1, o3, o4-mini, Codex
Anthropic Claude 3.5, Claude 4, Claude 4.6 Opus/Sonnet
Google Gemini 2.5, Gemini 3, Gemini 3.1 Flash/Pro
AWS Bedrock Nova, Nova 2, Titan Text, Titan Multimodal
Mistral Large, Small, Codestral, Pixtral
Qwen QwQ, Qwen 2.5, Qwen VL
DeepSeek V3, R1, Coder V2
Meta Llama 4, Llama 3.3
Groq Fast inference models
xAI Grok 2
Cohere Command R+
AI21 Jamba 1.5

Getting Started

# Clone the repository
git clone https://github.com/BOTOOM/llm-token-calculator.git

# Navigate to the project
cd llm-token-calculator

# Install dependencies
pnpm install

# Start development server
pnpm dev

Open http://localhost:3000 to see the calculator.

How It Works

  1. Paste your prompt in the input area (or enter token count directly)
  2. Optionally add expected output to calculate total tokens
  3. View token counts across different providers
  4. Configure usage (requests/day, active days)
  5. Filter models by capabilities (vision, reasoning, coding, etc.)
  6. Compare costs in the interactive table

Pricing Formula

Total Cost = (Input Tokens * Input Rate) + (Output Tokens * Output Rate)

Tech Stack

Contributing

Contributions are welcome! Please read our Contributing Guide and Code of Conduct first.

Security

For security issues, please see our Security Policy.

Support the Project

If you find this tool useful, consider supporting its development:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links


Pricing data from LiteLLM

Releases

No releases published

Packages

 
 
 

Contributors