SuperAPI AI Directory

TokenCalculator.dev

TokenCalculator.dev is a browser-based LLM token counting and API cost estimation tool. Users can paste text prompts, or attach PDF, DOCX, code, data files, as well as PNG, JPEG, WebP, GIF images, and view in real time the token count, context window fit, and estimated input cost for models across providers. The tool supports 43 current models from 9 providers, including OpenAI, Anthropic, Google, DeepSeek, Qwen, Moonshot Kimi, xAI Grok, Z.ai GLM, and Meta. All text extraction, image dimension reading, and token calculation are done locally in the browser, without uploading user content, with a focus on privacy protection. OpenAI text uses exact local o200k_base BPE tokenization; other providers use a deterministic provider-calibrated UTF-8 token projection, and the results indicate the method and accuracy. Pricing data comes from Models.dev with an offline fallback.

Open website

About this tool

TokenCalculator.dev is a privacy-first, browser-based LLM token counting and API cost estimation tool that helps developers and teams understand the token size and cost of an input payload before making an API call.

Purpose

  • Measure the number of input tokens for text, code, structured data, readable documents, and supported images across multi-provider models.
  • Estimate input cost and check whether a prompt exceeds a model's context window.
  • Compare costs across different providers and models under real workloads, rather than comparing models alone.

Key capabilities

  • Single input, cross-provider measurement: after pasting a prompt or attaching files, you can simultaneously view token results, context fit, and estimated input cost for 43 current models (from 9 providers: OpenAI, Anthropic, Google, DeepSeek, Qwen, Moonshot Kimi, xAI Grok, Z.ai GLM, Meta).
  • File support: supports text-based PDF, DOCX, as well as plain text, Markdown, CSV, JSON, JavaScript, TypeScript, Python, Go, Rust, Java, C/C++, HTML, CSS, XML, YAML, TOML, SQL, and shell files, up to 12 MB per file. Scanned PDFs require OCR and are explicitly rejected, rather than returning misleading zero-token results.
  • Image token estimation: supports PNG, JPEG, WebP, GIF, reads width and height locally, and calculates vision tokens according to the published tile, patch, or media-token rules of the selected OpenAI, Claude, and Gemini models. Image tokens are added to document text and pasted prompt text, making it easier to plan multimodal requests. If a model has no published vision rules, the result shows "image unavailable" rather than fabricating an estimate.
  • Visible calculation provenance: each result indicates the method used and the accuracy level, distinguishing exact BPE tokenization from deterministic provider-calibrated projection.
  • Pricing data: from Models.dev, with a bundled offline fallback registry; prices are listed per 1 million tokens for input and output separately, and cached input is the discounted price providers charge for reused prompt prefixes.
  • What is reported: input token count, context window fit, and estimated input cost.

How to use

  • Paste the prompt into the webpage, or attach PDF, DOCX, code, data files, and images.
  • Select a provider card to view each available model.
  • Results and costs update in real time with the input, with no need to upload content.
  • Extraction for text, code, PDF, and DOCX, image dimension reading, and token calculation all run locally in the browser; except for public model metadata that may be refreshed from Models.dev, no prompt, document content, or uploaded image is sent to TokenCalculator.dev or any calculation server.

Use cases

  • Price knowledge base ingestion tasks: extract text-based PDFs locally, measure the full payload, and compare context fit and input cost across OpenAI, Claude, Gemini, and DeepSeek.
  • Budget requests for vision models: combine image dimensions with prompt text and apply the published tile, patch, or media-token rules of each vision-capable model.
  • Measure code repository review load: attach code, configuration, and documentation files as a single workload, then choose a model with sufficient context capacity.
  • Compare batch economics: measure structured data together with instructions, and compare input rates across providers before committing to a recurring workload.

Limitations

  • Scanned or encrypted PDFs require OCR, which this tool does not support and will explicitly reject.
  • Image counting is an image token and cost estimate, not OCR; pixel data is not uploaded, retained, or used to extract text from images.
  • Providers may add message wrapping, system instructions, tools, or model-specific processing, so the final bill may be affected; provider documentation remains the authoritative source. Long-context tiers, batch discounts, and provider-side overhead may change the actual invoice amount.
  • Non-OpenAI text results are explicitly labeled as estimates unless the provider publishes a deterministic local formula.
  • The current material does not provide more information about billing models, pricing plans, or registration requirements.