Module 5 · Governance and final project

Costs and limits: how to do the math

Lesson 14 of 15 8 min lesson Updated on October 30, 2026
Progress in the course93%

In this lesson

The bill has three lines.

An agent's bill has the model, the channel and people's hours. Here you learn to estimate the model and keep spending in check.

What a token is

The model does not read words. It reads tokens, pieces of text: a whole word, part of one or a single character. To estimate, use about 4 characters per token. For the exact number, use the provider's free counter, with the model you are going to use. A typical customer message has some 12 to 15 tokens. Lean instructions of 1,200 words, some 1,900.

Who pays for the input

The model does not keep the conversation. With each reply, it receives the instructions, the excerpts from the knowledge base, the tools, the history and the new message all over again, and you pay for all of it again. That is why the fourth reply costs more than the first.

In the example bakery, each reply has 2,550 input tokens and only 80 output tokens. The input dominates the bill. What weighs most is the size of the instructions and the history, not the short reply.

The bakery math

The bakery has 400 conversations a month, with 4 replies each: 1,600 replies. The input adds up to 4.08 million tokens, and the output to 128 thousand. Now open the pricing page of the model you use, note the date and multiply:

(millions of input tokens x input price) + (millions of output tokens x output price)

Prices change, and so does the exchange rate. That is why this lesson does not fix any values: the right math is the one you redo with the page open and the date noted.

A model for each task, caching and batching

High volume and a simple task call for the small model: classifying, extracting data, routing. A delicate, rare task can take the bigger one. Start with the cheapest one that can do the job and move up only where the test shows it falls short.

Two discounts are worth the math. Batching, for work that can wait, costs half at Anthropic. And caching: the fixed part of the instructions, which repeats in every reply, is read for a fraction of the input price.

Alert, limit and error budget

Set up two defenses in your account with the provider. The alert, at half the monthly cap, only notifies you. Your own limit, below the provider's cap, cuts off the calls. Note who receives the alert.

Google's SRE book says that 100% is not the right target. Write down how many serious errors a week you accept, for example two. Went over? Pause without asking permission, fix the cause and turn it back on after the attack battery from lesson 12.

Scenario

Hypothetical: on a sale day, the bakery's alert goes off at noon. The owner pauses the agent at 1 p.m., lowers the cap on exchanges per conversation and turns it back on in the afternoon.

What is not in the price table

The WhatsApp channel is charged by Meta, per message delivered. And people's hours (confirming sessions, answering escalations, reading conversations) do not show up on any pricing page, but they are what weighs most in a small agent.

What the pros know

Cached reads cost a fraction. On Anthropic's pricing page, reading a stretch of text that is already in the cache costs a small fraction of the normal input price. Since the fixed instructions repeat in every reply, they can become much cheaper. People who design the agent around cost put what does not change (instructions, rules, knowledge base) at the start of the request and what changes (the customer's message) at the end, because the cache only reuses the opening part that repeats exactly the same.

Careful

Before using a model's free tier with real customer messages, read on the provider's page whether the data can be used to improve the product. Test with made-up data.

Practice · 10 min

  1. Count the tokens in your instructions with the 4-character yardstick and then with the provider's counter.
  2. Redo the bakery math with your own numbers and the price on the model's page, noting the date.
  3. Set up the alert at half the cap, note who receives it and write down the week's error budget.
Deliverable: the "Cost and limits" document, with the math, the date you read the prices, the alert, the limit and the error budget.

Summary

Sources

Read on October 30, 2026.

  1. Anthropic. Pricing: caching and batching.
  2. Anthropic. Batch processing.
  3. Google. Embracing Risk (SRE book): error budget.
  4. Meta. WhatsApp Pricing.

Lesson quiz

Three situations to apply what you learned.

Lesson 14 of 15

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp