Jump straight to the numbers

← All articles

$0.0012 for a Tool Loop—With Assumed Rates

01 / A tiny tool call still has a token bill

A function call can look like a small action: check a price, fetch an order, or read tomorrow’s weather. But the bill covers more than the short answer you see. Tool definitions, generated arguments, returned data, and repeated conversation history can all contribute tokens.

For a beginner with a tiny budget, the useful question is: what does each request send and receive? Start with one tool, one task, and a spending limit. You can add complexity after you understand the receipt.

02 / One weather question usually needs two model requests

Suppose your user asks, “Will I need an umbrella in Bristol tomorrow?” You give the model access to a function named get_weather. Its definition explains its purpose and accepts two fields: city and date.

The model does not run your weather service itself. It generates a structured request to call the function. Your application validates the arguments, executes the function, and returns the result to the model.

  • ■ First request: send the question and tool definition to the model.
  • ■ First response: receive a tool call containing the city and date.
  • ■ Local execution: your application fetches the forecast.
  • ■ Second request: send the conversation, tool call, and forecast result.
  • ■ Second response: receive the umbrella advice.

This common pattern uses two model requests for one user question. Some tasks need additional rounds. A weather provider may also charge separately; that fee is outside the model’s token bill.

03 / Count definitions, arguments, and returned data

Tool definitions consume input tokens when included in a request. Names, descriptions, parameter schemas, and examples all take space. A useful description earns its cost by helping the model choose correctly, but a long manual attached to every request can become expensive.

The model’s generated function name and arguments consume output tokens. When your application returns the forecast, that result becomes input to the next request. The previous tool call and conversation also count when you send them again.

That means one forecast can appear in several later requests if you retain the full conversation. Tool definitions can repeat too. Caching may change the rate charged for eligible input, but it does not make every repeated token free. Check the model’s pricing and the usage information your API returns.

04 / A $0.0012 receipt using example rates

Here is an illustrative calculation, not a CheapRelay price quote. Assume input costs $0.20 per million tokens and output costs $2.00 per million tokens. Assume no caching or other billable token categories for this example.

  • ■ First request: 800 input tokens for instructions, the question, and the tool definition.
  • ■ Second request: 1,200 input tokens, including repeated context and the weather result.
  • ■ Both responses combined: 400 output tokens for the tool call and final answer.
  • ■ Input cost: 2,000 ÷ 1,000,000 × $0.20 = $0.0004.
  • ■ Output cost: 400 ÷ 1,000,000 × $2.00 = $0.0008.
  • ■ Total model cost: $0.0012 for the complete loop.

At those assumptions, 100 identical loops would cost $0.12. Real usage varies with the model, schema, conversation length, results, caching, and any billed reasoning tokens. Use reported usage instead of estimating tokens from character counts.

05 / Keep the first tool small and its results smaller

Define only the tool the task needs. Require essential fields, use clear descriptions, and validate arguments before execution. For weather advice, return the date, rain probability, expected rainfall, and a short condition label. Sending an entire provider response adds input without necessarily improving the answer.

Set a maximum number of tool rounds and a sensible output limit. Track total cost across the whole user task, including retries. A low per-request cost offers little protection if a broken loop keeps requesting the same forecast.

06 / Test a complete loop before adding more tools

CheapRelay provides pay-as-you-go access through an OpenAI-compatible API at https://api.cheapapirelay.com/v1. It bills per real token, including cache reads and writes, with no monthly fee or subscription. Check current model rates and tool support before choosing a model.

Sign up for CheapRelay and test one complete tool loop with a small spending cap. Record each request’s usage, compare the total with your calculation, and expand only when you can explain every part of the bill.

Sign up Try the prices yourself, sign-up credit included.

More reading

DateAisleWritten inTitle
2026-10-28Spend lessEN$2.78 for 10,000 Documents: A Lean API Budget
A beginner walkthrough for processing 10,000 documents cheaply, with transparent token math, local extraction, a small pilot, and retry controls.
2026-10-28Spend lessEN$0.003 per request: count tokens before sending
Estimate input tokens, cap output, and check actual usage with free tools and simple math before spending a tiny API budget.
2026-10-28Spend lessENA $5 Telegram AI Bot With Pay-Per-Token Billing
Build a Telegram AI bot on a tiny budget using CheapRelay, an OpenAI-compatible API, and per-token billing.
2026-10-28Spend lessEN$1 for 1,000 Ticket Summaries: Check the Token Math
A beginner’s $1 planning budget for support-ticket summaries: estimate tokens, test a small model, and control retries before processing the queue.
2026-10-28Spend lessEN8 Million Fewer Tokens From One Prompt Trim
Trim a repeated system prompt on a tiny budget, calculate the savings, and check that shorter instructions still produce useful answers.
2026-10-28Spend lessENA $5 AI Budget Starts With a $0.96 Estimate
Estimate a small monthly AI bill with token math, repeat calls, and a spending buffer before you write any code.