A system rule that wins, and what it costs
The fake model follows a system rule that says "only one of". Token counts use the rough rule of 4 characters per token.
The system message holds the rules and role that apply to the whole conversation. It beats user requests when they conflict, but every word in it is paid for on every call, so keep it short and put only stable rules there.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 6 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write estimate_tokens(text) that returns the rough token count (characters divided by 4, rounded up) and monthly_cost(tokens, calls, price_per_mtok).
Write build_messages(system, user) that returns a list with a system message and a user message in the usual chat format.
Explain it without notes
What is the system message for, and what belongs in it?
Why is the system prompt not a security boundary?
How would you estimate the monthly cost of a system prompt?
Expected output
I was charged twice -> billing
Where is my parcel -> shipping
Write me a poem -> other
no system rule -> Happy to help! Here is a little poem about your day: roses are red.
short system prompt: 13 tokens per call, 0.65 dollars per 100000 calls
long system prompt: 88 tokens per call, 4.40 dollars per 100000 calls