// septim forge tools · ai-tooling · token counter

Count tokens for GPT-4, Claude, and Gemini — in the browser.

client-side tokenization  ·  no telemetry  ·  per-model accuracy notes  ·  no login

// paste text · pick model · count
0 chars
loading tokenizer module…
0 tokens
// cost estimate at current API prices rates are editable — plug in your actual tier
Model Tokens Rate / 1k input Estimated cost
// chunk breakdown · 512-token windows
// accuracy tiers

Not all token counts are equally exact.

Each model uses a different tokenizer. The GPT counts are exact. Claude and Gemini are approximations because their tokenizers are not publicly available. The error margins are tight enough for context-window planning.

ModelTokenizerAccuracyNotes
GPT-4o o200k_base exact Uses gpt-tokenizer — same BPE vocab as tiktoken. Matches the API usage.input_tokens field exactly.
GPT-4 cl100k_base exact Same library, cl100k_base vocab. Matches tiktoken output for gpt-4 and gpt-3.5-turbo.
Claude 3.5 Sonnet
Claude Opus
cl100k_base (approx) ±1–3% Anthropic's tokenizer is not public. Claude uses a BPE vocabulary related to cl100k_base. Sufficient for context-window planning; use the API usage response for billing precision.
Gemini 1.5 Pro whitespace heuristic ±5% Google's SentencePiece tokenizer is not available in pure JS without a WASM bundle. Count uses a word + punctuation split with Unicode-aware handling. Use the countTokens API endpoint for precision.
// verify zero network calls during tokenization

The tokenizer loads once. After that, it never phones home.

// how to confirm

The gpt-tokenizer module loads from jsDelivr CDN once on page open, then stays resident in memory. After that, every count runs entirely in the browser with no outbound requests. To verify: open DevTools (F12), click Network, reload, and wait for the module to load. Paste text and count — zero new requests fire. The only domains you should see are fonts.googleapis.com, fonts.gstatic.com, and cdn.jsdelivr.net. Anything else is a bug — report it to [email protected].

// if you are burning tokens faster than you realize

3 pre-commit hooks that hard-cap your per-session Claude Code token burn before you hit the limit. Self-hosted. Your Anthropic key. No subscription.

Septim Tether — $19 once →