Phase 1 · Building with LLMs · Prompting
Tokens and the context window
How text becomes tokens, and what fits in one request.
Open this lesson Create a free account
Why it matters
Tokens are the unit behind every limit in an LLM app: how much you can send, how long the reply can be, how long it takes and what it costs. A prompt that works on ten customer reviews can fail, slow down or run up a bill on ten thousand. Thinking in tokens lets you size a request before you send it, instead of finding out from an error message or an invoice.
What you'll be able to do
- Estimate how many tokens a piece of text will use, and explain why exact counts vary
- Turn the usage numbers in a response into a cost estimate
- Check that a request fits the context window with room left for the reply
- Decide what to send when you have more material than budget
Before this lesson
Next in this phase: Prompt fundamentals