Short answer
A token is a chunk of text (often part of a word) converted to an ID the model understands. Context windows and API prices are usually measured in tokens.
Why it matters
Diagram
Article
Tokenization basics
Algorithms such as byte-pair encoding split text into subwords from a fixed vocabulary. Digits, whitespace, and non-English scripts may tokenize less efficiently than everyday English prose.
Code and JSON often consume more tokens than the same information in compact English.
Context and cost
Both input and output tokens usually count toward usage. System prompts, tool schemas, and retrieved chunks all spend budget before the user even sees an answer.
Practical counting
Use the model’s official tokenizer when accuracy matters. Rule-of-thumb word-to-token ratios are rough and language-dependent.
Product UX
Show users remaining capacity in human terms when possible (“about 20 pages”) while enforcing hard token limits server-side.
Security note
Extremely long inputs can be used for denial-of-wallet or context flooding. Enforce limits and authentication.
Working with Tokens in practice
Token budgets decide how much evidence you can include, how long answers can be, and what a feature will cost at scale.
Trailing whitespace, markdown fences, and repeated newlines can burn tokens silently—sanitize prompts in middleware.
Deeper intuition
A token is a chunk of text (often part of a word) converted to an ID the model understands. Context windows and API prices are usually measured in tokens.
Some languages tokenize to far more pieces per word than English; multilingual UX should budget accordingly.
Readers comparing approaches should keep Tokens connected to large-language-models, context-windows, tokenization, ai-apis, prompt-engineering, because isolated definitions rarely survive contact with production constraints.
Authoritative references for Tokens appear in the sources list—prefer primary papers, official documentation, and standards bodies over anonymous social threads when decisions have lasting impact.
Implementation checklist
Version prompts, model IDs, and retrieval configs as a unit.
Build a living eval set from real user failures, not only academic benchmarks.
Define quantitative and qualitative checks specific to Tokens before expanding scope.
Record known limitations of Tokens in your runbook so on-call responders do not rediscover them during incidents.
Evaluation and failure analysis
When Tokens underperforms, separate data issues, configuration mistakes, and true method limits. Jumping to a larger model without that triage repeats the same failures at higher cost.
Create a small gold set that represents the ugly cases—not only the demo cases—for Tokens. Re-run it on every prompt, model, or index change.
For user-facing features involving Tokens, track both helpful outcomes and harmful ones (privacy incidents, wrong actions, biased errors) so success metrics cannot hide safety debt.
Examples and FAQs in context
Budgeting RAG. You reserve 1,500 tokens for system+question, 6,000 for retrieved chunks, and 1,000 for the answer.
How many tokens are in a word? Often about 0.5–2 tokens for English words, but it varies widely; always measure with the real tokenizer.
What to read next
Continue from Tokens into large-language-models, context-windows, tokenization, ai-apis, prompt-engineering. If you are building a product, pair conceptual pages with the API, retrieval, and responsible-AI branches before wide rollout.
This article is educational and not legal, medical, or financial advice. Where Tokens intersects regulation or rights (privacy, copyright, employment decisions), consult qualified professionals and primary official sources for your jurisdiction.
Examples
Budgeting RAG
FAQ
How many tokens are in a word?
Sources
-
OpenAI API Documentation
OpenAIOfficial OpenAI platform documentation.
-
Language Models are Few-Shot Learners
NeurIPS / arXivGPT-3 few-shot learning paper (Brown et al.).
-
Hugging Face Documentation
Hugging FaceOpen model hub and Transformers library docs.