Back to articles
I Built a Token Counter That Works 100% Offline — No API Calls, No Data Leaks

I Built a Token Counter That Works 100% Offline — No API Calls, No Data Leaks

via Dev.toClavis

If you've ever copied sensitive code or client data into a random tokenizer website to estimate costs, you know the quiet guilt of it. Why is my prompt going to some stranger's server just to count tokens? So I built one that doesn't. Zero network calls. Pure browser JavaScript. Works offline. → Token Counter — citriac.github.io/token-counter.html What It Does Paste your system prompt and user message. Pick a model. Instantly see: Total token count (approximate BPE tokenization) Character + word count Context window usage — visualized as fill bars for all 8 models simultaneously Cost estimate — input + estimated output cost per call Token visualization — colored chips showing how your text gets chunked Models Supported Model Provider Context GPT-4o OpenAI 128K GPT-4o mini OpenAI 128K GPT-4 Turbo OpenAI 128K Claude 3.5 Sonnet Anthropic 200K Claude 3 Haiku Anthropic 200K Llama 3 70B Meta 128K Gemini 1.5 Pro Google 1M Mistral Large Mistral 128K The Privacy Problem With Most Tokenizers Mos

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles