Free AI token counter (multi-vendor, browser-only)
Estimate tokens before you call an API. OpenAI “exact” rows use tiktoken encodingForModel. GPT‑5.5 / GPT‑5.4 Nano/Mini / GPT‑5.2 / GPT‑5.1 reuse o200k_base like today’s GPT‑5 family until dedicated tiktoken ids ship. Anthropic rows all use the same @anthropic-ai/tokenizer count (the npm API has no per-model id — pick the label that matches your target model; numbers match across those rows). DeepSeek, Codex, Gemini, Grok (incl. Grok 4.3), Kimi, MiniMax, MiMo, and Alibaba Qwen rows share the same o200k_base byte-pair proxy: useful for rough budgets, not vendor-official billing. Qwen / Tongyi / DashScope tokenization is not replicated here.
How to use this tool
- 1
Open AI token counter
Use it for this task: OpenAI GPT-5 / GPT-4o, Anthropic Claude, Gemini, Grok, DeepSeek, Qwen, Kimi, MiniMax, Codex token counts - 100% in-browser.
- 2
Paste your text
Add the content in the main text box, adjust any options, and review the live result.
- 3
Copy the finished text
Copy the output into your editor, chat, API request, or document when it looks right.
Quick facts
| Runs offline? | Yes — JavaScript only, no HTTP upload of your text. |
|---|---|
| OpenAI rows | Exact when a concrete tiktoken model is selected; GPT‑5.5 / 5.4 / 5.2 / 5.1 proxy rows share o200k BPE with the GPT‑5 line today. |
| Anthropic Claude | Local @anthropic-ai/tokenizer — all Claude-labeled rows share the same count; verify with API usage for billing. |
| Other vendors (Grok, DeepSeek, Gemini, Qwen, Kimi, MiniMax, MiMo, Codex) | Rows use the same o200k_base industry proxy in the browser — directional estimates only; use each vendor’s official usage APIs for invoices. |
Top use cases
- OpenAI GPT-5 / GPT-4o, Anthropic Claude, Gemini, Grok, DeepSeek, Qwen, Kimi, MiniMax, Codex token counts - 100% in-browser.
- Runs offline?: Yes — JavaScript only, no HTTP upload of your text.
- OpenAI rows: Exact when a concrete tiktoken model is selected; GPT‑5.5 / 5.4 / 5.2 / 5.1 proxy rows share o200k BPE with the GPT‑5 line today.
- Anthropic Claude: Local @anthropic-ai/tokenizer — all Claude-labeled rows share the same count; verify with API usage for billing.
- Other vendors (Grok, DeepSeek, Gemini, Qwen, Kimi, MiniMax, MiMo, Codex): Rows use the same o200k_base industry proxy in the browser — directional estimates only; use each vendor’s official usage APIs for invoices.
FAQ
Are OpenAI “exact” rows the same as OpenAI Playground counts?▾
Yes for the listed tiktoken model ids — we call encodingForModel with the same mapping OpenAI documents.
Is my text sent to a server?▾
No. Your text never leaves this tab. Safe Local Tools is a static site; counting runs entirely client-side.
Why are GPT‑5.5 / GPT‑5.4 rows labeled “proxy”?▾
tiktoken has not yet exposed unique model ids for every marketing name. Those rows intentionally reuse the o200k_base tokenizer that powers the GPT‑5 family today so you still get a consistent budgeting number.
Why do many Anthropic rows show the same token count?▾
The Anthropic npm tokenizer exposes a single countTokens(text) API without a per-model parameter here, so every Claude-labeled row shares one number — pick the label that matches your target model for clarity, then confirm with Anthropic’s count_tokens API if billing must match production.
Can I use Grok / Qwen / DeepSeek proxy rows for invoices?▾
No — those rows are o200k_base industry proxies for rough sizing only. Use each vendor’s console or API usage fields for authoritative token accounting.
Are Alibaba Qwen / Tongyi counts official?▾
No. Qwen-labeled rows are browser-side o200k proxies for budgeting drafts; they are not DashScope or official Qwen tokenizer output. For production billing on Alibaba Cloud, use the provider’s documented token or usage APIs.