OverpayingForAIPricing desk

Lesson 2 of 5 · 7 min read · Beginner

What a tool call is and why it costs tokens

A tool call is the model asking for something outside itself. The result comes back as text, gets added to the conversation, and is re-sent on every later step. That is why a 12-step run bills 166,800 input tokens, and this lesson prices it on four models.

In this lesson you will

  • Explain what a tool call is and where its result goes
  • Read a 12-step cost trace and see why step 12 costs five times step 1
  • Compare the same run on four models and say which number dominates the bill

A tool call is the model writing, instead of an answer, a small structured request: *call the search tool with this query*. The system runs the tool, takes whatever came back (a list, a web page, a file, a number) and pastes it into the conversation as text. Then it asks the model what to do next, sending the whole conversation again, including that new paste.

One step of an agent, as tokens1Instructions + tools4,000 tokens, every step2Everything so fargrows 1,800 per step3Model decides300 tokens out4Tool runs1,500 tokens back5Appendedre-sent next step
Figure 1.Each step sends the instructions, the whole history, gets a short decision back, runs the tool, and adds the result to the history for next time.

The reference trace

To put numbers on this, the site uses one reference run everywhere: a 4,000-token system prompt and tool list sent on every step, a 1,500-token tool result appended after each step, and 300 output tokens per step for the model's reasoning and tool call. So the input at step *k* is 4,000 + (*k* − 1) × 1,800 tokens: step 1 sends 4,000 tokens, step 12 sends 23,800. Add them up over 12 steps and you get 166,800 input tokens and 3,600 output tokens.

The same 12-step run priced on four models. Cost = input tokens × input rate + output tokens × output rate, rates in $ per 1M tokens from the catalogue.
Model$/1M in / outInput costOutput cost12-step run
DeepSeek V4 Flash$0.05 / $0.16$0.0083$0.0006$0.0089
Gemini 3.8 Flash$0.75 / $3.75$0.125$0.0135$0.139
Claude Sonnet 5$2 / $10$0.334$0.036$0.370
GPT-5.4$2.50 / $15$0.417$0.054$0.471
Cost of one 12-step agent run$ per runDeepSeek V4 Flash0.01 cheapestGemini 3.8 Flash0.14Claude Sonnet 50.37GPT-5.40.47 53× DeepSeek
Figure 2.Same tokens, four prices. The gap between the cheapest and dearest is about 53×.

Two things to notice

  • Input is 98% of the bill. On Sonnet 5, $0.334 of the $0.370 is input. "Keep the answers short" barely moves an agent bill; keeping the *history* short does.
  • Later steps cost more for the same work. On Sonnet 5, step 1 costs about $0.011 (4,000 in, 300 out) and step 12 about $0.051 (23,800 in, 300 out). Five times the price for one more tool call, because it drags eleven earlier results along with it.
  • Doubling the steps more than doubles the cost. The same guide's 30-step run bills 903,000 input tokens: $1.90 on Sonnet 5, about five times the 12-step figure, not two and a half.

Knowledge check

Why does step 12 of an agent run cost about five times step 1 on the same model?

Lesson FAQ

How much does an AI agent cost to run?

On the site's 12-step reference trace (166,800 input and 3,600 output tokens), about $0.0089 on DeepSeek V4 Flash, $0.139 on Gemini 3.8 Flash, $0.37 on Claude Sonnet 5 and $0.47 on GPT-5.4 without caching. A 30-step run costs roughly five times as much because the re-sent history grows every step.

What is a tool call?

The model's structured request for something outside itself: a search, a file read, a calculation, a booking. The system runs it and pastes the result into the conversation as text, which is then re-sent on every later step. The tool's own cost (an API fee, say) is separate from the tokens.

Why is input 98% of an agent bill?

Because every step re-sends the instructions and every earlier tool result, while the model only writes a short decision back. In the 12-step trace, 166,800 of the 170,400 billed tokens are input.

Does prompt caching help agents?

Substantially. Cache reads cost roughly a tenth of the list input rate on Anthropic and OpenAI, about a quarter on Gemini, taking the 12-step Sonnet 5 run from $0.37 to about $0.12. It only works while the start of the prompt stays identical.

Finished reading?

Mark it done to track your progress through the course.

Save progress across devices

Get a private link that restores your lessons on any device. Email is optional and only used to send you the link.

Compare, calculate, decide

If our calculators helped you cut down on hidden AI wallet leaks, thanks for using them. A tiny fraction of your savings is what keeps our pricing indexes updated daily.

Not sure which AI is cheapest for your use case? Find out in 30 seconds — no signup required.

AI cost intelligence

Stop overpaying for AI tools

Join the OverpayingForAI list for pricing updates, cheaper alternatives, and practical buying guidance.

Now tracking 50+ AI tools, models, platforms, subscriptions, coding tools, and automation products.

We use your email only for OverpayingForAI updates. Unsubscribe anytime.