What is a token?
Models don't read letters or words, they read tokens: pieces of text such as a whole word, part of a word, a number, punctuation or even a fragment of an emoji. In English a token is roughly ¾ of a word (about 4 characters), but that ratio changes a lot across languages, code and formatting.
Why do token counts differ between models?
Each model family has its own tokenizer with its own vocabulary, so the same text produces a different count. Neither number is “wrong”. OpenAI models are counted exactly here; for other providers, which don't publish an offline tokenizer, the tool shows a clearly marked estimate.
Why do tokens matter for API costs?
APIs bill per million tokens, with separate prices for input and output. Cost = input tokens × input price + output tokens × output price. Some models charge more for very long prompts, and some prices are introductory, so check the provider's page before budgeting.
What is a context window?
The context window is the most text a model can consider at once: your prompt, any attached data and the reply it writes all share it. If your input plus the expected output is larger than the window, the request fails or gets truncated. The meter above shows how much of the window you are using.
Input vs output tokens
Input tokens are what you send. Output tokens are what the model generates, which we can't know in advance, so enter the reply length you expect. Output is usually priced several times higher than input, which is why long answers dominate many bills.
Token count vs. actual usage
The count above covers the text you entered. A real request also carries system instructions, conversation history, attached files, tool definitions and the reply, so an IDE or API dashboard can report more. Neither number is wrong: they measure different things.
How the Prompt Optimizer works
An AI model rewrites your prompt to remove repetition and filler while keeping requirements, constraints and examples. A second pass checks that nothing important was lost, and both versions are recounted locally with the selected model's tokenizer, so the savings are measured rather than promised. You always review the result before it replaces your text.
Best practices for efficient prompts
- Put stable instructions in a system prompt once instead of repeating them per message.
- Give one good example instead of five similar ones.
- Prefer specific requirements over long background stories.
- Test an optimized prompt on a few real inputs before you switch to it.
How to reduce token usage
- State repeated instructions once, or move them into a reusable system prompt.
- Send only the relevant part of long documents, or summarise older context.
- Trim repeated whitespace and boilerplate; keep indentation that carries meaning in code.
- Ask for concise output and set a sensible maximum output length.