A prompt that reads fine in an editor can still blow the context window once you add retrieved chunks, a few-shot transcript, or ChatML framing. Counting tokens after the API returns an error is the expensive way to learn the limit.
The Prompt Editor counts as you type and colors the context bar when you get close. The prompt stays in the browser.
What the sidebar is actually counting
Pick a target model first. The same paragraph is not the same number of tokens on every encoding.
- Exact — OpenAI models, counted with the matching tokenizer
- Estimate — other vendors, counted with an o200k proxy
The estimate is good enough to see that you are near the ceiling. It is not the number to put in a Qwen or GLM cost spreadsheet. Send to TokenWorkbox opens TokenWorkbox with the current prompt so you can run a finer exact count, a cost estimate, and chunking there.
ChatML mode adds a second line on each card: content tokens, and tokens with framing. The sidebar total includes that overhead. A short system prompt plus three turns often costs more than the words alone suggest.
You can set a custom context window when the deployment limit is smaller than the catalog default. Leave it empty to use the model default.
The 70% and 90% alerts
The bar is a share of the selected window:
| Share | What it means |
|---|---|
| Under 70% | Room for another turn or a retrieved chunk |
| About 70% and up | Amber warning — trim before the next paste |
| About 90%, or over the limit | Red — the request is likely to truncate or fail |
These are static checks against the window you selected. They do not call the model.
Trim without changing the instruction
When the bar goes amber, cut the payload before you rewrite the system prompt.
- Open Clean and run a whitespace normalize. Extra blank lines and zero-width characters add tokens and do not help the model.
- If the draft was pasted from Markdown or HTML, strip markup, URLs, emoji, or boilerplate signatures. Keep the instruction.
- Use compress only when you want aggressive whitespace folding. Read the result. Compress shortens tokens; it can also glue headings to body text.
- Use JSON escape when the next step is pasting the string into a request body, not when you are still editing.
Then return to the editor. The draft and the cleaner are separate views — copy the cleaned text back, or send either one to TokenWorkbox.
For a retrieval prompt, the chunk is usually the part that should shrink. The system rules should stay stable. That split is the point of the RAG prompt layout, and it is easier to see in ChatML mode than in one text buffer.
Save the slim copy as its own version
After a trim, save a snapshot on Versions and label it Slim. Keep the earlier Draft so you can diff what the compress step removed. Token counts are stored with the snapshot, using the model selected in the editor at save time.
If two wordings are both under the window and you need to pick one, put them on A/B Compare with the same target model. Different models make the token bars incomparable.
A practical order
- Write or import the prompt in the editor and set the real model (or a custom window).
- Read the amber and red thresholds before you add more context.
- Clean and snapshot the slim version.
- Send the release candidate to TokenWorkbox when you need an exact non-OpenAI count or a cost figure.
The checker will not shorten the prompt for you. It shows the budget while the text is still local, which is the moment a trim is cheap.