Chapter 1: Understand the bill
Explain why a short request can produce a long invoice.
- Explain why a thirty-token request can turn into nine model calls and a much larger invoice.
- Name the five principles that govern AI coding spend, from pricing the whole task to counting accepted output.
- List the five records you need to reconstruct what one task cost from the first call to the last.
- Judge a large bill by the session behind it instead of by the engineer who triggered it.
Why a short request can produce a long invoice
You approve a coding assistant for a team of 100. A month later the bill has doubled, and headcount has barely moved. Finance wants a limit. Engineers want to keep the tool.
Uber lived this at scale. Agentic tools reached about 5,000 engineers in late 2025, and by April 2026 the CTO said the year’s budget was already gone. By June, every employee was capped at $1,500 a month per tool.
Before you reach for a limit, ask a better question: what changed inside the work? Maybe more people are using the tool. Maybe tasks are running longer. Maybe a new default model costs more per token. Those are three different problems, and one blanket restriction treats them as the same one.
A prompt starts a loop
A coding agent is a model wrapped in software that can read files and run tools. That surrounding software is called a harness. A token is the small unit of text that providers use to meter what goes into a model and what comes out.
The agent works in a loop. It takes a step, looks at the result, and decides what to do next. Each new call can carry the earlier instructions and tool results along with it, so the context keeps growing as the task goes on.
The illustration below shows that growth through one task. Real tools trim and summarize some of it, and cached context is cheaper, but all of it still lands on the bill.
A large invoice is a symptom, not a verdict. Look at the session before you judge the engineer. An expensive migration can be excellent value. A cheap retry loop that never ships anything is pure waste, and the two can cost about the same.
Five principles to keep in view
- Price the whole task. A cheap call can start an expensive sequence.
- Make models earn their place. Test them on your own work before you adopt them.
- Route routine work deliberately. Decide in advance when a stronger model should take over.
- Give daily and monthly budgets separate jobs. Catch accidents fast, and approve sustained spend on purpose.
- Pay attention to accepted output. Tokens measure what you consumed. Finished work is what earned the spend.
Follow one task from request to result
| Record | What it tells you |
|---|---|
| User, team, task ID | Who owns the work and which outcome the bill belongs to. |
| Model and harness version | Whether a change in the tool explains a change in cost. |
| Input, cached input, output, cache writes | Which billed categories dominate. Use the actual model rates. |
| Calls, retries, elapsed time | Whether the agent is making progress or repeating itself. |
| Accepted result and rework | Whether the task met the quality bar and what humans had to repair. |
Find the expensive part
A developer sends a 30-token request. The agent makes nine model calls as it reads files and retries a failing test. Which number should you investigate first?
Choose an answer. You can retry after reading the explanation.
Trace one task
Pick one task that shipped and one that failed. Reconstruct what each one cost from the first call to the last. If you cannot yet join the calls to the task, that is your first measurement gap, and it comes before anything else in this guide.
Key terms
- Harness
- The software wrapped around a model that lets it read files and run tools.
- Token
- The small unit of text providers use to meter what goes into a model and what comes out.
- Agent loop
- The cycle where the agent takes a step, looks at the result, and decides what to do next.
- Carried context
- The instructions, tool schemas, and prior turns sent again with each new call, which is why context grows through a task.
Further reading
- DatabricksManaging AI coding costs at scale
The source behind the context-growth diagram in this chapter.
- TechCrunchUber caps employee AI spending after blowing through budget in four months
The cap this chapter opens with, and what preceded it.
Chapter 2: Choose your models
Turn model choice into a repeatable engineering decision.
