LLM usage estimate · local processing

AI Token Calculator

Paste a prompt to estimate input tokens, expected output tokens and per-call API cost for selected OpenAI, Anthropic Claude and Google Gemini models. The estimate runs in your browser.

Prompt size estimateEstimate tokens, words and characters before sending a prompt to an API.
Cost comparisonCompare per-call cost across OpenAI, Claude and Gemini model options.
Scale planningSee what 1,000 similar calls might cost before building a batch workflow.

Prompt and model inputs

Paste or type any text0 characters
Enter a non-negative whole number. Output is included only when the prompt contains text.
Input tokens
0
Words
0
Total tokens
0
Estimate note: This is not an official tokenizer. It is useful for planning prompt size and comparing model cost, but provider invoices can differ.
Estimated API cost
$0.0000
Total per request
GPT-6 Astra
BreakdownAmount
Input cost$0.0000
Output cost$0.0000
Pricing per 1M tokensIn $0.00 / Out $0.00
ProviderOpenAI
Estimated cost for 1,000 identical calls$0.00
Prices are a built-in snapshot, not live quotes or a verified current tariff. Confirm the selected model and price on the official provider pages below. Context bands, Fast, Batch/Flex, taxes, cached tokens and tools are excluded. Costs and total tokens stay at zero until the prompt contains text.
Pricing can change and may vary by region, batch mode, caching, tool use, context length and account settings. Check provider pricing before production budgeting.

How this AI token calculator works

Large language model APIs usually bill by tokens rather than by words. This page estimates token usage from your prompt, adds the expected output length, and applies the selected model's per-million-token input and output prices.

The token count is an approximation. English text, code, punctuation, whitespace and CJK characters can be split differently by each provider's tokenizer, so the final billed number may not match this estimate exactly.

Use the estimate to compare prompt sizes, model choices and expected output length before sending production traffic. For final budgeting, check the provider's current pricing, tokenizer behaviour, caching rules and account-specific settings.

The estimation method

The same rule is used for every model: each consecutive run of Latin letters, combining marks or digits contributes the larger of 1.33 or its Unicode character count divided by 4. Each Chinese, Japanese or Korean character adds 1.5; each punctuation character adds 1; other Unicode characters add 2 each. Whitespace adds 1/8 per character. The total is rounded up; an empty or whitespace-only prompt returns zero.

This is a rough text heuristic, not a measured accuracy guarantee. Repeated strings, code, emoji and languages can differ substantially from a model's tokenizer. The estimate omits message wrappers, system messages you have not pasted, tools, images and audio. It cannot confirm that a request fits a model's context window. Selecting another model changes the stored prices, not the token estimate.

Check the calculation yourself

  • With expected output set to 0, Hello world produces 3 estimated input tokens: 1.33 + 1/8 + 1.33, rounded up. 你好世界 produces 6: four CJK characters × 1.5.
  • A run of 10,000 letter a characters produces 2,500 estimated input tokens (10,000 ÷ 4). These are reproducible examples of this page's rule, not official token counts.

For a non-empty prompt, cost = (estimated input tokens × displayed input price + expected output tokens × displayed output price) ÷ 1,000,000. The batch figure multiplies this by 1,000; it does not apply a batch discount.

Official prices and token counting

Check model availability and current rates at the provider. Use its counting tools and the full request for a model-specific count, then check actual usage in the API response.

Local processing note

The prompt estimate runs in your browser. This page does not require API keys and does not call the selected model to calculate the estimate.

Good use cases

  • Compare the size of prompt drafts; use the provider's counter to check a context limit.
  • Compare high-quality and low-cost models before building an API workflow.
  • Estimate the cost of a batch job with hundreds or thousands of similar calls.
  • Adjust expected output length to understand why generated text can dominate cost.

How accurate is this AI token calculator?

It is a planning estimate, not an official tokenizer. Exact token counts depend on the model tokenizer, message format, system prompts and provider billing rules.

Why are output tokens often more expensive?

Generating text is usually priced higher than reading input. That is why long answers can cost more than the prompt that triggered them.

Does this include cached tokens or batch discounts?

No. The main calculation uses standard input and output token prices only. Cached tokens, batch mode, regional processing and tool usage can change the final cost.