A free, in-browser tool that counts LLM tokens and estimates API cost across OpenAI, Anthropic, Google, Meta, Mistral, xAI and DeepSeek models using live pricing. Prompts never leave the browser.


Token Counter is a free, client-side web tool for anyone writing prompts against paid LLM APIs. Paste a prompt, build a multi-turn chat or load a text file, and it shows the token count, how much of the model's context window it fills, and what the request would cost. Everything runs in the browser, so prompt text is never sent to a server.
I built the tool end to end: the tokenizer layer, the live pricing integration, the React interface, the SEO and content pages, and the GitHub Actions pipeline that deploys it to GitHub Pages.
The app is a Next.js 16 App Router project (React 19, TypeScript, Tailwind CSS 4) exported as a fully static site. OpenAI counts come from js-tiktoken; Claude, Gemini, Llama, Mistral, xAI and DeepSeek are approximated with per-provider characters-per-token ratios, since those vendors don't publish a browser tokenizer. Chat mode adds a small per-message overhead to approximate the role tags chat APIs insert. Model prices and context sizes are fetched in the browser from OpenRouter's public models endpoint and mapped onto the seven supported providers. The site also ships explainer articles, a sitemap, robots.txt, JSON-LD structured data and Open Graph images, with analytics and ads that load only when configured.