Token Count API Tester

Live token count via your own API key — exact, not estimated

Ad placeholder (leaderboard)

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_tokens endpoint 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_tokens and reads usage.prompt_tokens from 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.
Ad placeholder (rectangle)