Online Token Calculator
Quickly estimate the number of LLM tokens and API call costs. Supports mainstream models such as GPT-4o, Claude, DeepSeek, Gemini, and Qwen, and includes pricing for both cache hits and misses.
| Model | Enter Price / 1M Token | Output Price / 1M | Context | Occupancy | Cost Estimate | Operations |
|---|
What is a token?
A token is the smallest unit of text processed by a large language model, falling between a character and a word. In English, a common word typically corresponds to about 1 token; in Chinese, each character corresponds to approximately 1.5 to 2 tokens.
Calculation formula:
T = Number of Chinese characters × 1.5 + Number of English letters ÷ 4 + Number of digits ÷ 2 + Number of punctuation marks × 0.5
Note:This is an approximate estimate; the actual number of tokens varies depending on the tokenizer used by each model (e.g., GPT-4o uses o200k_base, while Claude uses the Anthropic Tokenizer). Cost estimates are for reference only; actual costs are subject to the API provider’s billing.
Instructions for Use:
- Supports custom models: Click “+ Add Model” to enter custom model parameters (name, pricing, context window).
- All prices are editable: Double-click a price in the table to edit it directly.
- Price Difference Between Cache Hits and Misses: Models such as DeepSeek have very low cached prices; please select based on your actual API call volume.
- Expected Output Tokens: Set the number of output tokens generated by the API call. Total fee = Input fee + Output fee
- USD/CNY Dual Currency: Supports one-click switching between U.S. dollars and Chinese yuan; DeepSeek uses Chinese yuan for pricing
- All data processing is performed locally in the browser and is not uploaded to any server.
How to use
- 1. Paste your text
- 2. Choose model and price tier
- 3. Read token count and estimated cost
Example
1,000 Chinese characters → roughly 1,500–2,000 tokens plus a USD cost estimate
FAQ
Why does Chinese cost more tokens than English?
A Chinese character often takes 1.5–2 tokens while a common English word takes about one, so the same content costs more in Chinese.
Are the built-in prices current?
They are a snapshot from when they were entered; edit the unit price in the table after a vendor changes it.