LLM Token & Cost Calculator

Estimate prompt token counts and project single-request and monthly batch inference costs with prompt caching.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
0 tokens (estimated)
0 characters · 0 words · Prose BPE heuristic

Model Pricing & Token Settings

50% cached

Per-Request Cost

$0.000000
Uncached Input (0 tok): $0.0000
Cached Input (0 tok): $0.0000
Output (0 tok): $0.0000

Monthly Projection

$0.00
Total Requests: 10,000
Monthly Input Spend: $0.00
Monthly Output Spend: $0.00

About This Tool

Deploying large language models (LLMs) requires estimating token consumption and understanding provider pricing models. Pricing structures charge per million tokens and often differentiate between fresh input tokens, cached prompt tokens, and generated output tokens.

This utility provides an in-browser token estimator calibrated for modern Byte-Pair Encoding (BPE) tokenizers (cl100k and o200k) with sensitivity to code punctuation and multilingual scripts. Model prices are fully user-editable so your estimates never go stale as providers adjust rates.

Key Features

  • Byte-Pair Encoding token estimation: Heuristic approximation designed for modern tokenizers, accounting for code punctuation density and multilingual characters.
  • Fully user-editable pricing: Pre-populated with current rates for popular models, while allowing manual overrides so pricing never becomes obsolete.
  • Prompt caching calculations: Simulate cost reductions from input prompt caching tiers offered by major API providers.
  • Monthly batch forecasting: Project operational monthly spend across custom request volumes and average response lengths.
  • Client-side privacy: Prompt text is analyzed entirely in browser memory and is never transmitted to an external API or server.

Frequently Asked Questions

How accurate is the token estimator compared to official tokenizers?
The heuristic models character length, word boundaries, code punctuation density, and multilingual ideographs, delivering an estimated count within 5% to 10% of official tokenizer implementations for typical English prose and structured code.
What is prompt caching and how does it save money?
Prompt caching allows API providers to reuse KV cache states for repetitive prefix tokens (such as long system instructions, documentation, or few-shot examples), reducing costs by 50% to 90% compared to standard input token pricing.
Why are all pricing rates user-editable?
AI providers regularly update their price sheets and introduce discounted batch tiers. User-editable inputs guarantee you can calculate accurate costs for any proprietary, fine-tuned, or newly released model.
Is my prompt text sent over the network to count tokens?
No. All text parsing, character counting, and financial calculations execute locally in your browser. Nothing leaves your device.