Skip to main content

LLM Token Counter & Price Estimator

Estimate prompt tokens and standard API costs across current OpenAI, Anthropic, Google, DeepSeek, and Mistral models

LLM Token Counter & Multi-Model Price Calculator

Standard global text rates checked November 5, 2026. Estimates exclude cached input, media, tool calls, and processing-tier changes. DeepSeek uses peak rates; off-peak is 50% lower. Confirm current rates with OpenAI, Anthropic, Google, Google long-decode documentation, DeepSeek, and Mistral.

Published maximum: 128,000 output tokens for this model. Estimates also respect the remaining context window.

Token counts are rough estimates based on text length. The prompt stays in this tab and is never sent to a model. Maximum: 1,000,000 characters (273 used).

Estimated Tokens
72
Input Cost ($)
$0.000144
Est. Total Cost ($)
$0.005144
Context Window Used
0.05%

Model Catalog (14 Models)

Model prices, response limits, and estimated costs for the current prompt and expected output. Costs cap output to the published model limit and remaining context. Select a model to update the estimate above.
ProviderModel NameInput Price / 1MOutput Price / 1MContext WindowMax OutputEst. OutputEst. Total CostSelect
OpenAIGPT-6 Astra$10.00$50.001050k128k500$0.025720
OpenAIGPT-6.1 Sol$2.00$10.001050k128k500$0.005144
OpenAIGPT-6 Luna$0.10$0.501050k128k500$0.000257
AnthropicClaude Opus 5.5$4.00$20.001000k128k500$0.010288
AnthropicClaude Sonnet 5.5$2.00$10.001000k128k500$0.005144
AnthropicClaude Fable 5.1$10.00$50.001000k128k500$0.025720
AnthropicClaude Haiku 5.5Prompts over 100k tokens use the higher long-context rates shown in the estimate.$0.10$0.501000k128k500$0.000257
GoogleGemini 4 ArgonIntroductory rates through November 30, 2026; standard rates become $4 input / $20 output. A single request is limited to 65,536 output tokens. Longer outputs require background long decode in 65,536-token hops and remain bounded by the available context.$2.00$10.001000k1000k500$0.005144
GoogleGemini 3.8 FlashIntroductory rates through December 31, 2026; standard rates become $1.50 input / $7.50 output.$0.75$3.751000k66k500$0.001929
GoogleGemini 3.1 Flash-Lite$0.25$1.501000k66k500$0.000768
DeepSeekDeepSeek V4.1 Flash (peak)Peak rates shown; off-peak rates are 50% lower. Cached input has a separate lower rate.$0.30$1.201000k393k500$0.000622
DeepSeekDeepSeek V4 Pro (peak)Peak rates shown; off-peak rates are 50% lower. Cached input has a separate lower rate.$1.32$3.961000k393k500$0.002075
MistralMistral Large 4$0.70$2.101000kContext-bound500$0.001100
MistralMistral Small 4$0.15$0.60256kContext-bound500$0.000311

Was this LLM Token Counter & Price Estimator helpful?

Help us keep tools reliable, fast, and bug-free.

What you can do with LLM Token Counter & Price Estimator

  • Count tokens for gpt-4
  • Estimate claude api cost

How this AI tool works

Estimate prompt token counts and compare standard text API costs for current OpenAI, Anthropic, Google, DeepSeek, and Mistral models.

Example input

Hello world.

Example output

4 estimated input tokens (12 characters) · GPT-6.1 Sol input: $0.000008 · 500 expected output tokens: $0.005000 · total: $0.005008

Practical workflow

  1. Paste the prompt text you plan to send to a model.
  2. Read the estimated token count and per-model price breakdown, based on each model's per-million-token rates.
  3. Iterate on the prompt and watch how trimming context changes the estimated cost.

Common use cases

  • Budget an LLM feature by estimating cost per request before building it.
  • Compare model price/performance for the same prompt.
  • Keep long RAG contexts under a model's token limit.

Important notes and limitations

  • The count uses a simple average of one token per 3.8 UTF-16 code units; provider tokenizers can differ, especially for source code, non-Latin text, and emoji. Treat counts as rough budgeting estimates and use the provider tokenizer when exact counts matter. Prompts are limited to 1,000,000 characters. The output field uses each model's published response limit where available, and every estimate is capped to the model's remaining context window.
  • Standard global text prices were checked on November 5, 2026, and published output limits were checked on November 6, 2026. GPT-6 and Claude 5.5 models allow up to 128,000 output tokens, Gemini 4 Argon up to 1,000,000 through background long decode, Gemini 3.8 Flash and Gemini 3.1 Flash-Lite up to 65,536, and DeepSeek V4 up to 393,216. A single Gemini 4 Argon request is limited to 65,536 output tokens; longer output continues in 65,536-token hops and remains bounded by the available context. Mistral models use their context windows as an upper bound because the reviewed model cards do not list a separate response cap. Introductory rates, DeepSeek peak pricing, long-context tiers, cached input, media, tools, and processing tiers can change the estimate; follow the provider links in the tool before budgeting.

Python & CLI token counting scripts

Python tiktoken exact OpenAI token count

python3 -c "import tiktoken; enc = tiktoken.get_encoding('o200k_base'); print(len(enc.encode('Your prompt text')))"

Calculates exact token count for GPT-4o models using the official OpenAI o200k_base tokenizer.

Count tokens with cl100k_base (GPT-4 / GPT-3.5)

python3 -c "import tiktoken; enc = tiktoken.get_encoding('cl100k_base'); print(len(enc.encode('Your prompt text')))"

Calculates token usage for older GPT-4, GPT-3.5-Turbo, and text-embedding-ada-002 models.

Inspect token byte split

python3 -c "import tiktoken; enc = tiktoken.get_encoding('o200k_base'); print([enc.decode([t]) for t in enc.encode('Hello world')])"

Visualizes how individual words, spaces, and punctuation marks are split into BPE token chunks.

LLM Tokenizer Encodings & Context Window Comparison

Model FamilyTokenizer EncodingVocab SizeEnglish Chars/Token RatioCode Chars/Token Ratio
GPT-4o / GPT-4o-minio200k_base (BPE)200,000 tokens~4.2 chars / token~3.8 chars / token (Better whitespace efficiency)
GPT-4 / GPT-3.5-Turbocl100k_base (BPE)100,000 tokens~3.9 chars / token~3.2 chars / token (Higher token cost for non-English & code)
Claude 3.5 Sonnet / HaikuAnthropic Claude BPE~65,000 tokens~3.8 chars / token~3.4 chars / token (Optimized for XML tags & markdown)
Llama 3 / 3.1tiktoken-based 128k BPE128,256 tokens~4.1 chars / token~3.6 chars / token (Open weights standard)

LLM prompt tokenization & context window troubleshooting

Token count mismatch between local estimate and OpenAI API billing

Cause: Chat Completions API prepends hidden message framing tokens (e.g. '<|im_start|>user\n...<|im_end|>', approximately 3-4 overhead tokens per message) plus system prompt wrappers.

Solution: Add 4 overhead tokens per message in multi-turn conversations to estimate exact API billing.

High token consumption for Turkish, Asian or non-English text

Cause: Older tokenizers (cl100k_base) split non-Latin characters into multiple 1-byte or 2-byte tokens. One Turkish word could consume 4-6 tokens.

Solution: Use o200k_base (GPT-4o) which expanded vocabulary to 200k tokens, reducing non-English token count by up to 35%.

context_length_exceeded (Maximum context length exceeded)

Cause: Combined input prompt tokens plus requested 'max_tokens' output exceeds model limit.

Solution: Prune conversational history, filter binary/lockfiles using Codebase to Prompt, or lower 'max_tokens' setting.

Continue your workflow

  • Codebase to Prompt — Package entire code repositories into clean token-optimized prompts with file filters.
  • System Prompt Builder — Assemble structured system instructions and persona rules within token limits.
  • Word Counter — Measure raw word, character, sentence, and byte statistics of input text.
  • Diff Checker — Compare prompt revisions and identify added or removed tokens across iterations.
  • LLM Tool Builder — Build JSON function calling and tool schemas within strict token budget limits.

Frequently asked questions

How is the token count calculated?

The counter estimates about one token per 3.8 UTF-16 code units. Source code, non-Latin text, and emoji can differ substantially from that average, so use the provider's tokenizer when exact counts matter.

Which models does the price estimate cover?

The catalog includes GPT-6, Claude 5.5, Gemini 3 and 4, DeepSeek V4.1, and Mistral 4 API models with standard global text input and output rates checked on November 5, 2026.

Is my prompt text kept private?

Yes. Counting happens locally in the open tab; prompts are not sent to an API or saved in browser storage and clear when you reload the page.