← Back to Registry
πŸͺ™

LLM & MCP Token Calculator

Count BPE tokens, MCP schema overhead, context usage, and API costs locally.

Loading Tool...

About, how to use & limitations

About LLM & MCP Token Calculator

LLM & MCP Token Calculator measures BPE token counts for prompts, documents, and Model Context Protocol (MCP) JSON tool schemas right in your browser. It estimates input, prompt-cached, and output costs across OpenAI, Anthropic, and Google models, shows context window utilization, and lets you plug in custom per-million-token pricing. Tokenization runs 100% client-side using o200k_base BPE so your prompts and proprietary tool schemas never leave your device.

How to use

  1. Choose Prompt Mode to count tokens for text or system prompts, or MCP Schema Mode to inspect JSON tool definitions.
  2. Paste or type your content into the input editor; token counts and character stats update automatically.
  3. Adjust Expected Output Tokens and toggle Prompt Cache Hit to simulate real request pricing.
  4. Review the model comparison table for context window usage and per-request / 1,000-request cost estimates, or enter Custom Pricing.

Limitations & notes

  • Token counts use exact OpenAI o200k_base BPE tokenization in the browser; Anthropic and Google models use calibrated BPE estimates (typically within 5-10%).
  • Model prices are reference rates per 1M tokens and may change; use the Custom row to model negotiated or enterprise rates.
  • Nothing is sent to any server or AI APIβ€”all tokenization and math run locally.

FAQ

Why measure MCP tool schema tokens?
Connected MCP servers inject every tool's name, description, and JSON inputSchema into the model's context on every turn. Measuring schema overhead helps prevent context bloat and unexpected API bills.
How accurate is the token count?
OpenAI models using o200k_base are counted with exact BPE tokenization via gpt-tokenizer. Non-OpenAI models (Claude, Gemini) use a calibrated BPE estimate because their proprietary tokenizers are not public.
Is my prompt or schema sent to an API?
No. All tokenization and cost calculations happen locally in your browser.