Lesson 5 · Module 1: System Prompts That Control Agents and Cut Cost
Tokens and pricing: measuring what each agent run really costs
Video coming soon
Learn it with your tutor on the live board
Key points from the video
The surprise bill
- An AI agent answered every customer message
- Customers were happy
- The monthly bill was three times the guess
What you will learn
- What a token is and how to estimate it
- How to calculate the cost of one agent run
- How to log real usage and cost per outcome
What a token is
- A token is a small chunk of text, often part of a word
- Rule of thumb: 1 token is about 4 characters of English
- 1,000 tokens is about 750 English words
- Providers count tokens, not words or messages
Input and output have different prices
- Input tokens: everything you send to the model
- Output tokens: everything the model writes back
- Output usually costs several times more than input
- Example prices: 3 dollars in, 15 dollars out, per million tokens
- Our example prices are round numbers, not this page's
What goes into the input
- System prompt: role, rules, output format
- The customer's message
- Conversation history so far
- Tool results, like a calendar lookup
Worked example: one model call
- A support reply with one model call
- Cost = tokens x price / 1,000,000
- Add input and output for the run total
layout: side
cells:
A1: Part
B1: Tokens
C1: $ per M
D1: Cost
A2: Input
B2: 2000
C2: 3
A3: Output
B3: 300
C3: 15
A4: Run total
A5: 1200 runs
format: {D2:D4: "currency:4", D5: currency}
steps:
- at: "two thousand tokens of input"
type: {D2: "=B2*C2/1000000"}
- at: "fill it down"
fill: D2:D3
- at: "Add them up"
type: {D4: "=SUM(D2:D3)"}
highlight: D4
- at: "twelve hundred replies"
type: {D5: "=D4*1200"}
highlight: D5 Worked example: a real agent run
- One booking run = 3 model calls
- Each call re-sends everything so far
- Cost per row = (in x 3 + out x 15) / 1,000,000
layout: side
cells:
A1: Step
B1: In
C1: Out
D1: Cost
A2: Read message
B2: 2000
C2: 120
A3: Check calendar
B3: 2400
C3: 80
A4: Write reply
B4: 2700
C4: 300
A5: Run total
A6: 1200 runs
format: {D2:D5: "currency:4", D6: currency}
steps:
- at: "same formula as before"
type: {D2: "=(B2*3+C2*15)/1000000"}
- at: "Copy it down"
fill: D2:D4
- at: "Add the three rows"
type: {D5: "=SUM(D2:D4)"}
highlight: D5
- at: "twelve hundred runs"
type: {D6: "=D5*1200"}
highlight: D6 Measure, don't guess
- Every reply carries a usage section
- It gives the exact input and output tokens
- n8n and Make show it in the AI step's output
- Log every run in a Google Sheet
layout: side
cells:
A1: Day
B1: Workflow
C1: In
D1: Out
E1: Cost
A2: Mon
B2: booking
C2: 2412
D2: 96
A3: Mon
B3: reply
C3: 1980
D3: 310
A4: Tue
B4: booking
C4: 2655
D4: 140
format: {E2:E4: "currency:4"}
steps:
- at: "what it cost"
type: {E2: "=(C2*3+D2*15)/1000000"}
- at: "copied down the cost column"
fill: E2:E4
highlight: E2:E4 Cost per outcome
- Group the log by workflow
- Divide by what the client cares about
- Lead check: 7.20 dollars / 60 qualified leads = 12 cents each
layout: side
kind: bar
title: Monthly agent cost, dollars
unit: $
data: {Bookings: 34.56, Replies: 12.60, Lead check: 7.20, Invoices: 2.40}
steps:
- at: "four workflows"
show: all
- at: "bookings are the biggest"
highlight: Bookings
- at: "from largest to smallest"
sort: desc Common mistake: the growing snowball
- Testing one short message and multiplying
- Forgetting history grows with every turn
- Forgetting tool results and retries
- Fix: test long, messy conversations and log them
Your exercise
- Pick one agent workflow you've built or planned
- Run it 5 times with realistic, messy messages
- Log input and output tokens for every call
- Work out cost per run and per month
Recap
- Providers charge per token, input and output priced separately
- A run is several calls, each re-sending the whole context
- Log real usage and report cost per outcome
Transcript
The surprise bill. Picture Sara. She runs a small online skincare shop, and last month she switched on an AI agent to answer customer messages. It worked beautifully. Customers got friendly replies in seconds, and her inbox finally stayed empty. Then the bill arrived, and it was three times what she had guessed. Her laptop showed the same agent, the same shop, the same customers. So where did the money go? Nobody had measured what one agent run really costs. In this lesson you'll learn to do exactly that, so you can price your automations for clients with confidence instead of crossing your fingers.
What you will learn. Here's the plan for the next few minutes. First, you'll learn what a token is, because tokens are the unit every AI provider charges in, and you'll learn a quick rule for estimating them. Second, you'll calculate the cost of one full agent run by hand, using a booking and support example from a small business. Third, you'll see how to read the real usage numbers that come back with every reply, log them, and turn them into a cost per booking or per qualified lead. Those three steps turn money from a mystery into a number you control.
What a token is. A model doesn't read whole words. It cuts every sentence into small chunks called tokens. Think of a long word like "rescheduling" being cut by scissors into two or three pieces. In English, one token is about four characters, so a thousand tokens is roughly seven hundred and fifty words. Other languages, code and odd product names often use more tokens per word. This matters because the provider never charges you per message or per customer. It charges per token, both for what you send in and for what the model writes back. So the first habit is simple: think in tokens.
Input and output have different prices. Every provider publishes a pricing page like this one. You'll always see two prices. Input tokens are everything you send: your instructions, the customer's message, any data. Output tokens are what the model writes back. Output is usually several times more expensive, because the model produces output one token at a time, which uses more computing power than reading input. In this lesson we'll use round example prices, not the ones on this page: three dollars per million input tokens and fifteen dollars per million output tokens. Real prices change often and differ by model, so always check the current page before you quote a client.
What goes into the input. Here's where people get surprised. The input isn't just the customer's short message. Every single call to the model carries your full system prompt, the one you wrote in the earlier lessons with its role, rules and output format. It also carries the conversation history so far, plus any tool results, like the free slots your calendar tool just returned. All of that is input, and all of it is paid for, every time. A customer's ten word question can easily sit on top of two thousand tokens of instructions and context.
Worked example: one model call. Let's do one call slowly. Sara's support reply sends two thousand tokens of input: the system prompt, the message and a little history. Cost is tokens times price, divided by a million, so input is six tenths of a cent. Now fill it down for the output row: three hundred tokens at fifteen dollars per million is less than half a cent. Add them up and one reply costs about one cent. If Sara gets forty messages a day, that's twelve hundred replies a month, and the whole month comes to about twelve dollars and sixty cents.
Worked example: a real agent run. But an agent rarely calls the model just once. A booking run might read the message, call the calendar tool, then write the reply. That's three model calls, and each call re-sends everything so far, so the input grows from two thousand to two thousand four hundred to two thousand seven hundred tokens. The sheet prices each row with the same formula as before: input tokens times three plus output tokens times fifteen, divided by a million. Copy it down to the other two steps. Add the three rows and the total is almost three cents per run, more than two and a half times our single reply. Over twelve hundred runs that's about thirty four dollars and fifty six cents a month. That gap is exactly Sara's surprise bill.
Measure, don't guess. Estimates are a start, but every API reply tells you the real numbers. Next to the answer, the response carries a usage section with the exact input tokens and output tokens for that call. In no-code tools like n8n or Make, you'll see the same usage fields in the output of the AI step. The habit is to write them to a log on every run: which workflow, how many tokens, what it cost. A simple Google Sheet works fine, and one formula copied down the cost column prices every row. Once you have a week of real rows, your prices for clients stop being guesses and start being facts.
Cost per outcome. Now group your log by workflow. Here are four workflows from Sara's month: customer replies, bookings, lead checks and invoices. The bookings are the biggest line, because every booking run makes three model calls and each one carries a growing input. Sorted from largest to smallest, you instantly see where saving effort pays off. Then divide by the outcome your client actually values. The lead check cost seven dollars and twenty cents and found sixty qualified leads, so each qualified lead cost twelve cents. That's a number a business owner understands, and one you can put straight into a proposal.
Common mistake: the growing snowball. The most common mistake is testing one short, polite message, seeing a tiny cost, and multiplying it by a thousand. Real conversations behave like a snowball rolling downhill. Every turn adds to the history, and the whole history is sent again with each new message, so the cost of turn eight is far bigger than turn one. Tool results and retries after an error add more. The fix is to test long, messy conversations, like an angry customer rebooking twice, and to price from your logged averages, never from your best case.
Your exercise. Now it's your turn. Pick one agent workflow you've built or planned, maybe answering customer messages or booking appointments. Run it five times with realistic, messy messages, not polite one liners. Open a spreadsheet and log the input and output tokens for every model call, using the usage numbers your tool shows. Then use your calculator or a formula to get the cost per run and the cost for a month of your expected volume. Bring those numbers to the next lesson, where we'll cut them down with shorter prompts, smaller models and prompt caching.
Recap. Let's recap. First, every provider charges per token, roughly three quarters of a word, and output tokens cost more than input tokens. Second, an agent run is usually several model calls, and each call re-sends the system prompt, history and tool results, so costs grow quickly. Third, don't guess: read the usage numbers from every reply, keep them in a simple table, and report cost per booking, per reply or per qualified lead. That's how Sara's next bill becomes a short receipt she expected.
Explore the animations
The animations from the video, exact and live: play them, pause, drag the slider or jump to a step at your own pace.
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Lesson summary
- Video watched
- Providers charge per token, input and output priced separately
- A run is several calls, each re-sending the whole context
- Log real usage and report cost per outcome