How Much Does an AI Agent Cost? Cost per Task, Explained
An agent's bill isn't set by the price per token alone. It's set by how many times the agent re-reads its own work. Here's what a task costs, and why.
Short answer: at today's prices, with prompt caching on, one coding-agent task of about 40 steps costs from $0.059 on GPT-6 Luna to $0.97 on Claude Sonnet 5.5 and $1.94 on Claude Opus 5.5. For a developer running 20 of those tasks a day, that's about $25.98 to $853 a month. A customer support conversation costs from $0.0024 to $0.092.
The model's price matters. But two other things matter just as much: how many steps the agent takes, and whether caching is on.
What "cost per task" means
An agent doesn't answer in one go. It plans, calls a tool (reads a file, searches, runs a test), reads the result and decides what to do next, often dozens of times before it finishes. Cost per task is the total model bill for one complete job, from the request to the final answer: every step's input and output tokens added together.
It's the most useful number for budgeting, because you can set it against what the job is worth: a fixed bug, a resolved support ticket, a research brief.
Why agents cost more than chat
At every step, the agent sends the model its whole working memory: the system prompt and tool definitions, your request, and everything it has done so far. So each step re-sends everything the previous step sent, plus the latest tool result.
Tokens the agent sends at each step
- Re-sent from earlier steps
- New this step
Show as a table
| Step | Tokens sent | Of which new |
|---|---|---|
| 1 | 18,500 | 18,500 |
| 5 | 27,100 | 2,150 |
| 10 | 37,850 | 2,150 |
| 15 | 48,600 | 2,150 |
| 20 | 59,350 | 2,150 |
| 25 | 70,100 | 2,150 |
| 30 | 80,850 | 2,150 |
| 35 | 91,600 | 2,150 |
| 40 | 102,350 | 2,150 |
In this coding example, the first step sends about 18,500 tokens. By the 40th, the agent is sending about 102,000, because 39 rounds of tool results and reasoning have piled up. Across the whole task it reads about 2.42M input tokens to write about 15,000. Input outnumbers output by more than 150 to 1, which is why input price and caching matter far more for agents than output price.
It also means cost grows faster than the number of steps. Doubling the task from 40 to 80 steps multiplies the input tokens by about 3.4, not 2.
How much a coding agent costs per task
Take a Claude Code, Codex or Cursor-style task: an 18,000-token system prompt and tool definitions, 40 steps, about 1,800 tokens of tool output and 350 tokens of reasoning per step, and 90% of repeated input served from cache.
| Model | Per task | Per task, no caching | Per month |
|---|---|---|---|
| GPT-6 Luna $0.10 / $0.50 per 1M | $0.059 | $0.25 | $25.98 |
| Claude Haiku 5.5 $0.10 / $0.50 per 1M | $0.079 | $0.33 | $34.59 |
| DeepSeek V4.1 Flash $0.30 / $1.20 per 1M | $0.12 | $0.74 | $53.69 |
| Gemini 3.8 Flash $0.75 / $3.75 per 1M | $0.44 | $1.87 | $195 |
| GPT-6.1 Terra $1.00 / $5.00 per 1M | $0.48 | $2.49 | $213 |
| Claude Sonnet 5.5 $2.00 / $10.00 per 1M | $0.97 | $4.98 | $427 |
| GPT-6.1 Sol $2.00 / $10.00 per 1M | $0.97 | $4.98 | $427 |
| Claude Opus 5.5 $4.00 / $20.00 per 1M | $1.94 | $9.96 | $853 |
The agent calculator's coding agent example: 40 steps a task, 90% of repeated input cached where the model has a cache price, 20 tasks a day for 22 days. List prices checked 2–11 Nov 2026; this table updates automatically.
The "no caching" column is what the same task costs when every step is billed at the full input price. On most models caching cuts the bill by three-quarters or more, because 90% of what each step sends was sent before. Models with no cache price, and tools that don't set caching up, pay the full column.
Two things stand out. Claude Haiku 5.5 is very cheap, but this task's later steps pass 100,000 tokens, and above that Haiku's price rises fivefold for the whole request. And the spread is wide: for the same task, the most expensive model here costs dozens of times the cheapest.
What support, research and assistant agents cost
Shorter agents cost far less per task, because their context never grows large.
Customer support agent (5 steps, looking up help articles and order data, 300 conversations a day):
| Model | Per task | Per task, no caching | Per month |
|---|---|---|---|
| GPT-6 Luna $0.10 / $0.50 per 1M | $0.0024 | $0.0051 | $21.95 |
| Claude Haiku 5.5 $0.10 / $0.50 per 1M | $0.0024 | $0.0051 | $21.95 |
| Gemini 3.8 Flash $0.75 / $3.75 per 1M | $0.018 | $0.038 | $165 |
| Claude Sonnet 5.5 $2.00 / $10.00 per 1M | $0.046 | $0.10 | $412 |
| Claude Opus 5.5 $4.00 / $20.00 per 1M | $0.092 | $0.21 | $824 |
The agent calculator's customer support agent example: 5 steps a task, 80% of repeated input cached where the model has a cache price, 300 tasks a day for 30 days. List prices checked 2–11 Nov 2026; this table updates automatically.
Research agent (25 steps of browsing and reading pages, then a 2,000-token report, 10 a day):
| Model | Per task | Per task, no caching | Per month |
|---|---|---|---|
| GPT-6 Luna $0.10 / $0.50 per 1M | $0.048 | $0.15 | $10.45 |
| DeepSeek V4.1 Flash $0.30 / $1.20 per 1M | $0.11 | $0.45 | $24.47 |
| Gemini 3.8 Flash $0.75 / $3.75 per 1M | $0.36 | $1.13 | $78.38 |
| Claude Sonnet 5.5 $2.00 / $10.00 per 1M | $0.83 | $3.03 | $184 |
| Claude Opus 5.5 $4.00 / $20.00 per 1M | $1.67 | $6.05 | $367 |
The agent calculator's research agent example: 25 steps a task, 85% of repeated input cached where the model has a cache price, 10 tasks a day for 22 days. List prices checked 2–11 Nov 2026; this table updates automatically.
A personal assistant such as OpenClaw or Hermes Agent sits between the two: a typical request on Claude Sonnet 5.5 costs about $0.052. Our guide to what Hermes Agent costs to run breaks that down by model.
The five things that set the bill
- Steps per task. The biggest lever, because input grows with every step. An agent that takes 60 steps where 30 would do costs about three times as much, not twice.
- Caching. Repeated input is billed at the cache rate, typically a tenth of the input price or less. Check that your agent framework turns it on; see how to cut your AI bill in half.
- The model's input price. Compare models on input and cached-input prices, not the headline blend.
- Long-prompt surcharges. Some models charge more once a request passes a size threshold: Claude Haiku 5.5 above 100,000 tokens, Gemini 3.1 Pro above 200,000. Long agent sessions cross these.
- Thinking and retries. Reasoning tokens are billed as output on the major APIs, and a task that fails and reruns costs twice. Higher reasoning effort can still be cheaper overall if it means fewer steps.
Agent costs per month: API or subscription?
For a business, cost per task times tasks per month is the budget. For one developer, a subscription can be cheaper: Claude Code comes with Claude Pro, Max and Ultra, and Codex with ChatGPT plans, at a flat monthly price within usage limits. Our coding plans comparison sets each plan against the API cost of the same work, and the API vs subscription calculator finds your break-even point.
If you'd rather not pay per token at all, open models can run on your own hardware: see Strata and our Local AI section.
How to measure your own cost per task
- Read the usage on every response. Every major API returns input, cached and output token counts with each call. Add them up per task, not per call.
- Log tasks, not requests. Tag each call with a task ID so you can see which tasks run long, and why.
- Set a spend limit in your provider's console while you learn what normal looks like. A looping agent is the most common surprise bill.
- Model it first. The agent cost calculator takes your steps, prompt sizes and cache rate, and gives the cost per task and per month on every model we track.
Questions
How much does an AI agent cost per month?
It depends on how many tasks it runs. At list prices, a coding agent doing 20 tasks a day costs about $25.98 a month on GPT-6 Luna and $853 on Claude Opus 5.5. A support agent handling 300 conversations a day costs $21.95 to $824 on the same two models.
Why is my agent bill higher than I expected?
Usually one of three reasons: the agent takes more steps than you thought, caching isn't on, or long sessions cross a long-prompt surcharge. Because each step re-sends everything before it, a task that runs twice as long costs more than twice as much.
Does prompt caching work with agents?
Yes, and agents gain the most from it, because most of every step is text the model has already seen. In the coding example, caching cuts a Claude Sonnet 5.5 task from $4.98 to $0.97. Some providers cache repeated text automatically; others need you to mark the part to cache.
Costs come from the agent calculator's example workloads at list prices, which update automatically. Real agents vary a lot; the number of steps per task matters most.