Counting tokens for GLM models
Z.ai publishes GLM's tokenizer with the open weights, so the counts on this page are exact. GLM-5.3 and GLM-5.2 load by default. Add GLM-5.1, GLM-5, or GLM-4.6 from the compare table to price the same text on the other versions. Every GLM-5 release ships the same vocabulary file, so the count only moves when you switch to GLM-4.6, and even then only on unusual text. The context bar measures your text against the million-token window of GLM-5.2 and GLM-5.3.
Pricing and context windows
GLM input prices per million tokens, with the vocabulary and context window of each model.
| Model | Tokenizer | Price / 1M input | Context window |
|---|
| GLM-5.3 | glm-5 | $1.40 | 1M |
| GLM-5.2 | glm-5 | $1.19 | 1M |
| GLM-5.1 | glm-5 | $1.26 | 205K |
| GLM-5 | glm-5 | $0.60 | 205K |
| GLM-4.6 | glm-4.6 | $0.50 | 205K |
Prices and context windows are curated metadata refreshed periodically from the providers and OpenRouter, so treat them as guidance rather than a quote. Token counts are always produced by the real tokenizer.
How GLM tokenization works
GLM-5, 5.1, 5.2, and 5.3 share one tokenizer, so a version-specific count is not a thing. The GLM-5 vocabulary is a byte-level BPE with about 155,000 entries. Z.ai ships the same tokenizer file with GLM-5, GLM-5.1, and GLM-5.2, and GLM-5.3 is a post-training update of the same base, so any text produces the same token count across the series. GLM-4.6 uses the earlier vocabulary of about 151,000 entries. GLM-5 keeps every one of those entries at the same id and adds around 3,500 new ones, so counts on ordinary text match almost exactly: both files came to 574 tokens on our fixed 500-word English sample.
Before the merges apply, text is split with the same rule OpenAI uses for GPT-4 (contractions, runs of up to three digits, punctuation). The vocabulary was trained with a large share of Chinese, so Chinese text tokenizes more compactly here than under English-first encodings. Z.ai's own rule of thumb is about 0.75 English words or 1.5 Chinese characters per token.
Frequently asked questions
Do GLM-5, 5.1, 5.2, and 5.3 use the same tokenizer?
Yes. The tokenizer file is identical across the GLM-5 series. Z.ai publishes the same file with GLM-5, GLM-5.1, and GLM-5.2, and GLM-5.3 reuses the GLM-5.2 base, so one counter covers every version. What changes between them is the price and, from GLM-5.2 on, the context window, which grew from 200K to 1M tokens.
Does the count match what Z.ai bills?
For the text itself, yes. A real request adds a few tokens of chat formatting. The API wraps each message in role tokens and adds any tool definitions you send, so the prompt_tokens figure in a response runs slightly above a plain-text count. Reasoning is billed at the output rate, and GLM-5.3 always thinks before answering, so a reply costs more tokens than its visible text.
How does GLM-4.6 differ from GLM-5?
GLM-5 extends the GLM-4.6 vocabulary rather than replacing it. Every GLM-4.6 entry keeps its id in GLM-5, with about 3,500 new entries added on top. Counts on ordinary text are the same or within a token or two. Add GLM-4.6 from the compare table to check your own text.
Which GLM models does this cover?
GLM-5.3, GLM-5.2, GLM-5.1, GLM-5, and GLM-4.6. Z.ai's API-only variants, such as GLM-5-Turbo and GLM-5V-Turbo, belong to the same series and are not listed separately; the GLM-5 count is the closest available measurement for them. Only price and modality differ.