Token count API tester
Stop guessing token counts. This tool sends your text to OpenAI or Anthropic with your own API key and returns the exact token total the provider reports — the same number you are billed for — rather than a local heuristic estimate. It is the reliable way to verify a production prompt fits your context window and budget.
How it works
Each provider exposes the true tokenizer behind its API:
- Anthropic has a dedicated
count_tokensendpoint that returns input token count for a given model and message with no generation cost. - OpenAI does not expose a standalone counter, so the tool sends a minimal
request with a tiny
max_tokensand readsusage.prompt_tokensfrom the response, which is the exact tokenization of your input.
Your key never touches this site’s servers — the request goes straight from your browser to the provider over HTTPS.
Tips and notes
- Match the model. Tokenization differs slightly across model families, so pick the model you will actually call.
- Use it for context-window checks. Compare the returned count against the model’s context limit before shipping a long-document prompt.
- Keep keys safe. Use a restricted or low-quota key for testing, and rotate it if you ever paste it into a shared machine.