The call
Chat is a play script
You already know tokens and RAM. This lesson is only three verbs: pack the script, read the whole thing, pick the next word. That is every API call.
- 1 · PackName who is speaking. Stage directions, you, the bot.
- 2 · ReadThe model sees the entire script at once — that is the window.
- 3 · PickIt writes the next word. Safe or spicy is one knob: temperature.
Say it once: pack, read, pick. If you remember only that, this lesson worked.
1. Pack — who is talking?
A chat app looks like bubbles. Under the hood it is the same conversation with name tags. OpenAI calls the tags system, user, and assistant. Chat API
Example · ordering pizza
What this shows. System is the boss whispering rules (not shown in ChatGPT’s main thread). User is you. Assistant is earlier bot lines you are sending back so it remembers. The new answer will be one more assistant bubble.
That chat packed as a script (same words, name tags):
Same pizza · as the computer sees it
[
{ "role": "system", "content": "You are a waiter. Keep answers short. …" },
{ "role": "user", "content": "What is on a Margherita?" },
{ "role": "assistant", "content": "Tomato, mozzarella, basil." },
{ "role": "user", "content": "Add olives?" }
]
What this shows. You do not send “the latest sentence.” You send the whole script so far. Each new turn, the list grows. ChatGPT does this for you; an API does not. OpenAI’s default Hello example is just system + user — two lines of this same list.
2. Read — it all sits in RAM
Lesson 0002: one window. The script above is what fills it. The reply has to fit in the leftover space.
Postage: the envelope (name tags) costs a few extra tokens besides the words. Don’t memorise the recipe — just know “Hello” is not 1 token on the bill.
3. Pick — safe or spicy?
The model lines up guesses for the next token (lesson 0001). Temperature is how boldly it rolls the dice. Low = always the favourite. High = sometimes a wild guess. OpenAI’s knob runs from 0 to 2. temperature
Low (safe)
“What is 2 + 2?” → four, every time. Invoices, JSON, facts.
High (spicy)
“Name a pizza” → surprise pies. Stories. Not for a price list.
Finish: “I want to eat ___”
Four made-up guesses. Drag toward 0 (safe) or 2 (spicy). Watch which bar stays the winner.
Check
Three questions. Pack, read, pick.
Primary source. Glance at OpenAI’s Hello example — it is the pizza script with two lines. Optional later (not required tonight): Hugging Face on greedy vs sampling.
Wallet card: pack · read · pick.