count_tokens API.
Prices per 1M tokens — editable if rates have changed since these were last checked.
| Model | Tokens | Input $/1M | Output $/1M | Estimated Cost |
|---|
Real-Time Token Counts & Cost Estimates • Runs Entirely in Your Browser
count_tokens API.
Prices per 1M tokens — editable if rates have changed since these were last checked.
| Model | Tokens | Input $/1M | Output $/1M | Estimated Cost |
|---|
This tool counts tokens and estimates API cost for GPT and Claude models as you type, entirely in your browser. GPT token counts (for the o200k_base and cl100k_base encodings used by GPT-4o and GPT-4/GPT-3.5 respectively) are calculated using a genuine JavaScript port of OpenAI's own tiktoken BPE algorithm — the count you see matches what OpenAI's API would actually bill you for. Claude does not have a publicly available tokenizer, so Claude counts here use Anthropic's own documented estimation rule of thumb (roughly 3.5 characters per token) — clearly labeled as an estimate, not an exact count. Pricing is editable per model in case rates have changed since they were last checked. Nothing you type is ever uploaded anywhere; both the tokenizer and the cost math run using your device's own processing.