AI for Business

How Much Does an AI Agent Cost? Token Math and Savings

One four-call agent task costs about 5 cents on gpt-5.6-terra, and 20,000 runs a month cost about $1,012. Here is the line-by-line receipt, the retry and caching math, and a 5-minute estimate.

Toolbit AI - Team
7 min read
How Much Does an AI Agent Cost? Token Math and Savings

One real AI agent task costs about 5 cents in model fees. Run that task 20,000 times a month and the bill is about $1,012.

Short answer: A four-call agent that reads ten support tickets and drafts replies costs $0.0506 per run on OpenAI's gpt-5.6-terra, and one retry was 23% of that. Caching the repeated prompt cuts it to $0.0344, and a cheaper model cuts it to about half a cent.

These figures are the model bill for running an agent; build and maintenance costs (developer time, hosting) are separate and not covered here.

One agent task costs about 5 cents: a worked example

The worked example is an agent that summarizes ten support tickets and drafts a reply to each. It makes four model calls, and one is a retry after a tool timed out.

TurnWhat happenedInput tokensOutput tokens
1Plan and call the ticket tool3,000500
2Read the tool result, continue3,500400
3Retry turn 2 (tool timed out)3,500400
4Write the final answer3,900600
Total13,9001,900

At terra's $2.00 input and $12.00 output per 1M tokens, the receipt reads:

  • Input: 13,900 / 1,000,000 x $2.00 = $0.0278
  • Output: 1,900 / 1,000,000 x $12.00 = $0.0228
  • Total: $0.0506

The retry alone cost $0.0118 ($0.0070 input plus $0.0048 output). That is 23% of the bill for a call nobody wanted. On Claude Sonnet 5 ($2 input, $10 output), the same task costs $0.0468, so the 5-cent figure is not one vendor's quirk.

The retry turn alone was $0.0118, or 23% of the $0.0506 task; the other three turns cost $0.0208 in input and $0.0180 in output

Split by line, the three non-retry turns cost $0.0208 in input and $0.0180 in output. The retry adds $0.0118, for $0.0506 in total.

The price list: what each model charges per 1M tokens

Each call is billed on three rates: input, cached input and output. These are standard, short-context list prices on each vendor's page, checked October 21, 2026.

ModelInputCached inputOutput
OpenAI gpt-5.6-luna$0.20$0.02$1.20
OpenAI gpt-5.6-terra$2.00$0.20$12.00
OpenAI gpt-6-astra$10.00$1.00$50.00
Claude Haiku 4.5$1$0.10$5
Claude Sonnet 5$2$0.20$10
Claude Opus 5$5$0.50$25
Gemini 3.8 Flash$0.75$0.075$3.75
Gemini 4 Argon$2.00$0.10$10.00

Newer rows exist too: Claude Haiku 5.5 lists $0.10 input and $0.50 output for prompts up to 100,000 tokens. Google says Gemini 4 Argon's price rises December 1, 2026, and the Flash models' on January 1, 2027. Check OpenAI API pricing, Claude API pricing and Gemini API pricing before you budget, or compare them in Toolbit's LLM price check.

Thinking is billed too: OpenAI bills reasoning tokens as output; in one docs example, 1,024 of 1,186 output tokens were reasoning, about 86%. Google's output price includes thinking. Anthropic says Opus 4.5 and models numbered 4.6 and up keep prior turns' thinking in context and bill it as input. For why models reason first, see how AI models get smarter in training.

Token counts also vary by tokenizer and language. Anthropic says Claude 4.7 and later models use a newer tokenizer that produces about 30% more tokens for the same text, so count with the vendor's own tool.

Why 20,000 runs become a $1,000 bill

Volume, not unit price, makes the bill: 20,000 x $0.0506 = $1,012 a month on terra, and the same volume costs $936 on Sonnet 5. Each line on the invoice is a fraction of a cent, so nothing looks alarming until the total arrives.

Agents that hand work between several models multiply this again, so weigh that before splitting one agent into a team, as our guide to when multi-agent systems pay off explains.

Hidden costs: why long conversations cost more per turn

Each call re-bills the whole conversation so far. OpenAI's conversation-state guide says "each text generation request is independent and stateless," and earlier tokens in the chain "are billed as input tokens."

Input tokens per send grow from 3,000 to 6,600 over ten sends, for 48,000 in total versus 30,000 if each send stayed at 3,000

Take a 10-turn chat with a 3,000-token base, where each reply adds 400 tokens. The sends grow 3,000, 3,400, 3,800 and so on up to 6,600, totaling 48,000 input tokens. A flat 3,000 per send would total 30,000. Re-sending history added 18,000 tokens, or 60%.

Other costs hide in the same loop:

  • Tool definitions. On Claude Sonnet 5, tool use adds a 354 or 474-token system prompt, on top of your normal input and output.
  • Retries. A retry late in a long chat re-pays the whole grown context.
  • Agentic loops. Google bills "intermediate input / reasoning tokens generated during agentic loops" at list rates.
  • Long context. Past 272K input tokens, gpt-6-astra's input doubles from $10.00 to $20.00 and output rises from $50.00 to $75.00. For terra's long-context rate, check the vendor page.

Long context is not pricier per token everywhere. Anthropic says a 900k-token request is billed at the same per-token rate as a 9k one: $1.80 versus $0.018 at $2.00 per 1M. Haiku 5.5 is the exception, priced by prompt length.

Which five levers make the bill cheaper?

Five levers cut the bill: route easy steps to a cheaper model, cache the repeated prefix, batch what can wait, trim context and stop wasted retries.

LeverSaving (list price)Trade-off
Model routing90% (terra to luna); 80% (Opus 5 to Haiku 4.5)Quality drops if a hard step goes to the small model
Prompt caching32% on our task ($0.0506 to $0.0344)Needs a stable prefix: 1,024+ tokens on GPT-5.6 and Sonnet 5, 4,096 on Haiku 4.5
Batch API50% at Anthropic and Google; terra: check vendor pageResults arrive asynchronously, not live
Shorter contextDepends on how much history you trimTrimming can break the cache
Retry hygiene, lower thinkingOur one retry was 23% of the billLess reasoning on steps that need it

Routing. Running the whole task on luna costs $0.00506, or $101.20 for 20,000 runs. Anthropic's advice: "Choose Haiku for simple tasks, Sonnet for most production workloads, and Opus for the most complex reasoning." Our guide to picking the right AI model covers the routing rules.

Caching. Caching the 3,000-token prefix on turns 2 to 4 saves $0.0162 per task, bringing 20,000 runs to $688. That assumes every call hits the cache and ignores write fees (on Claude, 5-minute cache writes cost 1.25x base input). OpenAI caches by default on supported models, and its guide says caching "does not change how the model generates output tokens."

Batch. Anthropic offers 50% off "both input and output tokens," and says batch and caching discounts can be combined. Google lists a 50% batch cut. OpenAI's gpt-6-astra batch rates are half of standard ($5.00 input, $25.00 output); check terra's batch row on the pricing page before you budget.

Shorter context. Summarize or drop old turns so each send carries less history; in our 10-turn chat, re-sent history was 18,000 of 48,000 input tokens. Trimming changes the prefix, so it can lower your cache hit rate.

Thinking caps. OpenAI exposes reasoning.effort and max_output_tokens, which includes reasoning. On current Claude models, use adaptive thinking with an effort setting.

How do you track spend as it happens?

Read the usage object every response returns, and log cost per task as the agent runs. OpenAI reports reasoning_tokens; Anthropic reports cache_read_input_tokens and cache_creation_input_tokens.

  • OpenAI: "Spend alerts do not enforce a cap." Hard limits at organization or project level return a 429 error, and "recorded spend can slightly exceed the configured amount." A Prompt Caching Dashboard shows cache hit rates.
  • Anthropic: for workspace spend controls, check the Console.
  • Google: a free tier exists with "Limited access to certain models."

Wiring this into monitoring is core LLMOps work.

How to estimate your own cost in 5 minutes

  1. Write down two rates for your model from the vendor's pricing page. Ours: $2.00 input, $12.00 output.
  2. Count tokens for the prompt and expected history with the vendor's tool. Ours: 13,900 in, 1,900 out.
  3. Price one task: (input x input rate + output x output rate) / 1,000,000. Ours: $0.0506. Add tool tokens if you use tools.
  4. Add retries and growing history. A 1-in-10 retry rate means x1.1; sum each turn's growing input.
  5. Multiply by monthly volume. Ours: 20,000 x $0.0506 = $1,012.
  6. Apply levers: the cached rate for stable prefixes, x0.5 for batchable work, the cheap model's rate for easy turns.
  7. Set a spend alert below your hard limit, then compare real usage counts against the estimate.

When is paying for a bigger model worth it?

Pay for the larger model only on steps where the cheaper one fails your quality check, using this rule:

  • Easy, repetitive steps (classify, extract, summarize): route to the small model and save 80 to 90%.
  • Hard reasoning steps: keep the larger model, cap thinking and fix the retries first.
  • Work that can wait: batch it before you downgrade the model.
Share this article

Related articles

Continue exploring similar guides and insights