StartLesson 2 · Tokens and the context window
Before you start
About 54 minutes · 10 steps
What you'll do
See how text is split into tokens, how much fits into one call, and what each call costs. Then make the app record the cost of every call.
Why it matters
You pay for every token you send and every token you get back, on every call. Send too much and the assistant gets slow, expensive, or too big to run at all.
What you'll walk away with
- How to estimate the tokens and the cost of a call
- Why sending every document with every question doesn't work
- A call log your own code writes: tokens, time and cost for every call
What “done” looks like
- The tests for Log every call pass
- You've read the call log your code wrote
- You've answered the two quick questions
Already comfortable with this? You can skip the explanations and go straight there; the tests tell you whether your code is right.
All 10 steps in this lesson
- 1· 2 min
- 2· 4 min
- 3· 3 min
- 4· 1 min
- 5· 5 min
- 6· 6 min
- 7· 25 min
- 8· 5 min
- 9· 2 min
- 10· 1 min