CruxDevCruxDev Tools Prompts
ai Utility • Zero-Server Privacy • 100% Client-Side

Prompt Token & Cost Estimator

Count tokens for any prompt and estimate the API cost per call with September 2026 models — GPT-5.6, Claude 5, Gemini 3.8, DeepSeek V4.

Overview

Count tokens with the real o200k_base BPE tokenizer bundled locally, forecast round-trip cost across 27 models from a static September 2026 price snapshot, and model prompt-caching savings. Everything runs offline; no text ever leaves the page.

How It Works

Paste a prompt or upload a text or code file (.txt, .md, .json, .csv, .py, .ts, .yaml and similar) to see live token, character, word, and context-load counts. Pick a tokenizer family, set expected output tokens, and read the cost table per 1,000 and 100,000 calls.

Step-by-Step Usage Guide

  1. Paste text or upload a text or code file; the token, character, word, and context-load counters update live.
  2. Choose a tokenizer family from the dropdown, or use the category filter pills and model search to narrow the board.
  3. Enter a value in the 'Expected Output Tokens' input or pick a 300, 800, 2000, or 8000 preset to forecast round-trip cost.
  4. Enable the prompt-caching toggle, set the cache-hit slider between 10 and 95 percent, and read cost per call, per 1,000, and per 100,000 calls.

Technical Specifications & Standards

Token counts are exact BPE counts for OpenAI's o200k_base encoding, the GPT-4o-era tokenizer, via the gpt-tokenizer library. The Tokenizer Family dropdown applies a stated heuristic to that one count — about 1.02 times for Anthropic and 1.08 times for Google — and every model row in the cost table uses the same resulting token count. The hardcoded price board covers 27 models, carries its catalog date, and drives a cost table with per-call, per-1,000, and per-100,000 figures plus a 'Best Value' highlight. Custom models you define persist in localStorage.

Targeted Use Cases

  • Budgeting a batch job: paste the prompt, set an output preset, and read the per-100,000-calls figure for the model you plan to use.
  • Comparing providers: compare the cost table rows, switch the tokenizer-family dropdown, and use the 'Best Value' highlight to shortlist models for the same workload.
  • Sizing a context: watch the context-load indicator while uploading a long .md document to see whether the prompt fits before spending anything.
  • Estimating caching gains: toggle prompt caching and sweep the 10 to 95 percent cache-hit slider to see how a repeated system prompt changes cost.

Notes & Gotchas

  • Only the OpenAI family setting gives the exact o200k_base count. The Anthropic and Google settings are heuristics by construction, not those providers' real tokenizers, and DeepSeek, xAI and Mistral rows use whichever count is selected.
  • The price board is hardcoded and dated, so prices drift. Verify current rates against the provider before committing to a budget.
  • There is no separate DeepSeek, xAI or Mistral tokenizer setting; pick the family closest to your model and keep a safety margin.
  • Define custom models for unlisted pricing; they persist in localStorage so repeat sessions keep your figures. The tool makes no network calls at all.

Frequently Asked Questions

Which token counts are exact?

Counts for o200k_base, the GPT-4o-era tokenizer, are exact BPE counts from the bundled gpt-tokenizer library. Every other family setting is an approximation.

How accurate are the Anthropic and Google numbers?

They are stated heuristics: the exact o200k_base count multiplied by about 1.02 for Anthropic and 1.08 for Google, not real provider tokenizers.

Are the prices live?

No. The 27-model board is hardcoded and labelled with its catalog date. Confirm current prices with the provider before relying on a figure.

Is my prompt text uploaded anywhere?

No. The tokenizer is bundled locally and the tool makes no network calls, so text stays in the browser. Uploads are read locally as text, and the file picker lists common text and code extensions such as .txt, .md, .json, .csv, .py, .ts and .yaml.