Skip to content

AI agent cost calculator

Estimate what an agent task costs in model fees, per run, per month and per customer, across Claude, GPT, Gemini, Grok, DeepSeek and more. Free, no sign-up, and nothing you type leaves your browser.

Prices checked December 4, 2026 from 8 official pricing pages. See the table.

The task

Start from

Searches, reads a dozen pages and writes a short report. Web pages make each step heavy. Preset values are assumptions, not measurements.

Model calls in the agent loop.

System prompt, tool definitions and the task.

Tool results and reasoning carried into the next call.

Reasoning (thinking) tokens bill as output on most models.

Calls repeated after errors or bad tool calls.

Prompt caching
Batch API

Half price or so, results within hours. Only for work nobody is waiting on.

  • Claude Sonnet 5.5
  • GPT-6.2 Sol
  • Gemini 4 Hydrogen
  • DeepSeek V4 Pro

Estimated model cost

Prices checked December 4, 2026
Estimated model cost, per task
ModelRelative costPer task
Claude Sonnet 5.5Anthropic · 237,000 in (142,450 cached) · 6,000 out$0.342
GPT-6.2 SolOpenAI · 237,000 in (142,450 cached) · 6,000 out$0.342
Gemini 4 HydrogenGoogle · 237,000 in (142,450 cached) · 6,000 out$0.217
DeepSeek V4 ProLowestDeepSeek · 237,000 in (142,450 cached) · 6,000 out$0.170
  • Not included: search and other tool API fees, hosting, and taxes.
Cost per task as the loop grows (Claude Sonnet 5.5)
1102030405060

Steps per task. Each step re-sends the conversation so far, so cost grows faster than the step count.

Runs in your browser. Nothing is uploaded.
Tokens (OpenAI o200k_base)
–
Characters
0
Words
0

Exact for OpenAI's o200k_base encoding (GPT-4o and the GPT-5 models). Claude, Gemini, Grok, DeepSeek and others use their own tokenizers, so for them treat it as an estimate. Anthropic says Claude models from 4.7 on produce about 30% more tokens for the same text than earlier Claude models, so expect Claude counts to run higher.

How the math works

An agent works in a loop: the model reads the task, calls a tool, reads the result, and decides what to do next. Every call re-sends the conversation so far, so the input grows each step.

  • Input at step i = starting context + (i − 1) × context added per step
  • Total input for n steps = n × start + added × n(n − 1) / 2
  • Cost = Σ over steps of (new input × input price + cached input × cache-read price + output × output price), × (1 + retries), × the batch discount if used

Where a provider charges more above a prompt length (a long-context tier), that step is priced at the higher rate. Where it charges to write to the cache, new input is priced at the cache-write rate when caching is on.

Worked example: a 12-step research task on Claude Sonnet 5.5

Start with 6,000 tokens of instructions and tools, add 2,500 tokens of search results and pages each step, and write 500 tokens per step. Over 12 steps that is 237,000 input tokens and 6,000 output tokens. At $2.00 per million input and $10.00 per million output, the task costs $0.534. With prompt caching serving 70% of the repeated input, it costs $0.311.

Current API prices: Claude, OpenAI, Gemini, Grok, DeepSeek and more

US dollars per million tokens on each provider's standard paid API, checked December 4, 2026. Every row links to the official pricing page it came from. “Long context” is the higher rate some providers charge once a prompt passes a length; “batch” is the discount for asynchronous jobs. Download as CSV.

ModelInputOutputCache readCache writeBatchLong contextSource
Anthropic
Claude Fable 5.2$8.00$40.00$0.20$10.00−50%–platform.claude.com
Claude Opus 5.5$4.00$20.00$0.20$5.00−50%–platform.claude.com
Claude Sonnet 5.5$2.00$10.00$0.10$2.50−50%–platform.claude.com
Claude Haiku 5.5$0.10$0.50$0.01$0.125−50%>100k: $0.50 / $2.50platform.claude.com
OpenAI
GPT-6.2 Astra$8.00$40.00$0.40$10.00−50%>272k: $16.00 / $60.00developers.openai.com
GPT-6.2 Sol$2.00$10.00$0.10$2.50−50%>272k: $4.00 / $15.00developers.openai.com
GPT-6.1 Terra$1.00$5.00$0.05$1.25−50%>272k: $2.00 / $7.50developers.openai.com
GPT-6 Luna$0.10$0.50$0.01$0.125−50%>272k: $0.20 / $0.75developers.openai.com
Google
Gemini 4 Carbon$4.00$20.00$0.20–−50%–aistudio.google.com
Gemini 4 Neon$3.00$15.00$0.15–−50%–aistudio.google.com
Gemini 4 Hydrogen$1.50$7.50$0.075–−50%–aistudio.google.com
Gemini 3.8 Flash$0.75$3.75$0.075–−50%–aistudio.google.com
Gemini 3.5 Flash-Lite$0.30$2.50$0.03–−50%–aistudio.google.com
xAI
Grok 4.7$2.00$6.00$0.50–−20%>200k: $4.00 / $12.00docs.grok.com
Grok 4.3$1.25$2.50$0.20–−20%>200k: $2.50 / $5.00docs.grok.com
DeepSeek
DeepSeek V4 Pro$1.32$3.96$0.044–––api-docs.deepseek.com
DeepSeek V4.1 Flash$0.30$1.20$0.006–––api-docs.deepseek.com
Moonshot
Kimi K3.1 Pro$2.00$10.00$0.20$2.00−40%–platform.kimi.ai
Kimi K3$3.00$15.00$0.30$3.00−40%–platform.kimi.ai
Alibaba
Qwen4 Max$1.50$4.50––−50%–alibabacloud.com
Qwen3.7 Plus$0.40$1.60–––>256k: $1.20 / $4.80alibabacloud.com
Qwen3.8 Flash$0.15$0.47––––alibabacloud.com
Mistral
Mistral Large 4$0.70$2.10$0.07–−50%–mistral.ai
Mistral Small 4$0.15$0.60––−50%–mistral.ai
Pricing notes by model
  • Claude Fable 5.2: Full 1M-token context at the standard price. Claude models from 4.7 on count about 30% more tokens for the same text than earlier Claude models.
  • Claude Opus 5.5: Full 1M-token context at the standard price. Claude models from 4.7 on count about 30% more tokens for the same text than earlier Claude models.
  • Claude Sonnet 5.5: Full 1M-token context at the standard price. Claude models from 4.7 on count about 30% more tokens for the same text than earlier Claude models.
  • Claude Haiku 5.5: A request whose prompt is over 100,000 tokens (cache reads and writes included) pays the higher prices for the whole request.
  • GPT-6.2 Astra: Requests above 272K input tokens are billed at the higher long-context rates.
  • GPT-6.2 Sol: Requests above 272K input tokens are billed at the higher long-context rates.
  • GPT-6.1 Terra: Requests above 272K input tokens are billed at the higher long-context rates.
  • GPT-6 Luna: Requests above 272K input tokens are billed at the higher long-context rates.
  • Gemini 4 Carbon: Output price includes thinking tokens. Caching is implicit, with no write or storage charge.
  • Gemini 4 Neon: Output price includes thinking tokens. Caching is implicit, with no write or storage charge.
  • Gemini 4 Hydrogen: Output price includes thinking tokens. Caching is implicit, with no write or storage charge.
  • Gemini 3.8 Flash: Google has announced new prices from 2027-01-01: $1.50 input, $7.50 output, $0.15 cache read per 1M tokens.
  • Gemini 3.5 Flash-Lite: Output price includes thinking tokens. Explicit context caching also charges $1.00 per 1M tokens per hour of storage.
  • Grok 4.7: A request whose prompt reaches 200K tokens is billed at the long-context rate for all of its tokens.
  • Grok 4.3: A request whose prompt reaches 200K tokens is billed at the long-context rate for all of its tokens.
  • DeepSeek V4 Pro: Peak prices shown. Off-peak is half price: peak is 01:00–04:00 and 06:00–10:00 UTC, Monday to Friday.
  • DeepSeek V4.1 Flash: Peak prices shown. Off-peak is half price: peak is 01:00–04:00 and 06:00–10:00 UTC, Monday to Friday.
  • Kimi K3.1 Pro: Context caching is automatic.
  • Kimi K3: The earlier K3 release, priced above the newer K3.1 Pro.
  • Qwen4 Max: International (Singapore) list price; other deployment regions are priced differently. Cache prices are not published per model.
  • Qwen3.7 Plus: International (Singapore) list price, with a higher rate for requests above 256K input tokens. Cache prices are not published per model.
  • Qwen3.8 Flash: International (Singapore) list price; other deployment regions are priced differently. Cache prices are not published per model.
  • Mistral Large 4: The FAQ on Mistral's pricing page still shows an older price; this row uses the API price table and the model page, which agree.

Price change log

  • 2026-12-04: Table published: 24 models from 8 providers, each checked against the provider's official pricing page. Announced but not yet in effect: Gemini 3.8 Flash rises to $1.50 / $7.50 on 2027-01-01. Left out: Mistral Medium 3.5 (deprecated 2026-10-31), Gemini 4 Argon (routed to Carbon from 2026-12-15) and Kimi's K2 series (closed to new users).

Why agents cost more than chat

A chat reply is one call. An agent task is ten, thirty, sometimes a hundred, and each one carries everything before it. That is why cost grows faster than the number of steps (the curve in the calculator), and why the same model can look cheap in a chat window and expensive in production. Three things drive it: the number of steps, how much each tool result adds to the context, and retries after failed tool calls. On Claude Sonnet 5.5 with the research shape above, 5 steps cost $0.135 and 60 steps cost $9.87: twelve times the steps, about 73 times the cost. Caching helps most where the loop is longest: across the 20 models in the table with a published cache price, serving 70% of the repeated input from cache cut this task's cost by 39% to 54%. Our guide to what AI agents cost goes deeper.

Five ways to cut agent cost

  1. Turn on prompt caching. The repeated prefix is most of an agent's input.
  2. Trim tool results before they enter the context. Return the five relevant rows, not the whole page.
  3. Route by difficulty. A fast model for lookups and formatting, a flagship only for the hard step.
  4. Cap the loop. A step limit and a spending cap stop a stuck agent from running all night.
  5. Batch what nobody is waiting for. Overnight reports and bulk labelling rarely need an instant answer.

More in LLM cost optimization.

Capping cost per customer

If you put agents in front of your own customers, the average matters less than the heaviest user. OpenLegion Platform gives each of your customers a workspace with its own credit cap, so one account can't spend another's budget, and every model call and tool action is recorded against that customer. Use the per-customer tab above to pick a cap and a price floor.

If you'd rather not run agents yourself

OpenLegion App is a team of AI agents for one person, with flat plans instead of API bills: Plus is $20 a month with 10,000 credits, Pro is $50 a month with 30,000 credits and the option to use your own AI provider key. You set a daily credit limit, and work stops at the limit instead of running up a bill. The App is invite-only for now.

Questions

Maintained by the OpenLegion team. Prices are re-checked weekly against each provider's own pricing page; corrections to support@openlegion.ai. Price table and sources

How much does an AI agent cost to run?

It depends on three things: how many model calls the task takes, how much context each call carries, and the model's price. A 12-step research task on a mid-tier model typically costs a few cents to a few tens of cents in API fees; a 30-step coding task on a flagship model can cost a dollar or more. Put your own numbers into the calculator above for an estimate.

Why does my agent cost more than the chat price suggests?

Chat prices are quoted per token, but an agent makes many calls per task and re-sends the whole conversation every time. Input grows with every step, so a task with twice the steps costs much more than twice as much. Retries and tool results that pull in long documents add to it.

How much does prompt caching save?

On providers that price it, a cached read costs a fraction of normal input: often a tenth. Because agents re-send the same growing prefix, caching usually cuts input cost by more than half. Some providers charge extra to write to the cache, which the calculator includes.

How accurate is the token count for Claude and Gemini?

The counter is exact for OpenAI's o200k_base encoding. Anthropic, Google and the other providers use their own tokenizers and don't publish them for the browser, so for their models treat the count as an estimate. For an exact count, use the provider's token-counting endpoint with your own API key.

How often are the prices updated?

Every row links to the provider's official pricing page and was checked on December 4, 2026. We re-check weekly and log changes below the table. If you spot a stale price, email support@openlegion.ai and we'll fix it.

Agents with a spending limit built in

A credit cap per customer on the Platform, or a flat plan in the App.