Home / Guides / How much does an AI coding agent cost per task?

How much does an AI coding agent cost per task?

I modeled a 50-step agent run in every model. The spread is huge.

By Piotr Olszewski · Oct 11, 2026 · prices as of Oct 18, 2026

A 50-step AI coding agent costs about 48¢ per task at the median of the 326 models I track, based on my modeled scenario at list prices as of 2026-10-11. The range is wide: GPT-6 Luna comes in at 4.1¢ per task and Claude Opus 5.5 at $1.68. Across 1,000 tasks, that is $40.71 versus $1,683.28.

What I modeled

My agent scenario starts with an 8,000-token system prompt. The agent runs 50 steps, adds 1,500 tokens of context per step, and produces 300 visible output tokens per step. Reasoning tokens are billed as output tokens, so they count toward the cost.

This is a modeled result, not a measured one. The inputs are fixed, so differences come from price per token, how each tokenizer counts text, and how many reasoning tokens each model uses. See the methodology for how modeled and measured results differ.

#ModelCost per taskWebDev scoreTokens in / outBasis
1DeepSeek logo
DeepSeek V4.1 FlashDeepSeek
2.4¢$24.06 / 1,000
16182,235,262 / 102,435modeled best value
2Z.ai logo
GLM 5.3 FlashZ.ai
2.6¢$25.63 / 1,000
16062,239,737 / 43,814modeled
3OpenAI logo
GPT-6 LunaOpenAI
4.1¢$40.71 / 1,000
15782,237,500 / 22,000modeled
4Xiaomi logo
MiMo-V2.6-ProXiaomi
6.5¢$64.51 / 1,000
16252,241,975 / 24,380modeled best value
5Anthropic logo
Claude Haiku 5.5Anthropic
6.6¢$66.35 / 1,000
15853,101,175 / 50,340modeled
6OpenAI logo
GPT-5.4 NanoOpenAI
8.7¢$86.92 / 1,000
14012,237,500 / 22,000modeled
7Alibaba Qwen logo
Qwen3.8 FlashAlibaba Qwen
9.2¢$92.31 / 1,000
-2,259,875 / 96,000modeled
8Mistral logo
Mistral Small 4Mistral
13¢$135 / 1,000
-2,304,625 / 147,800modeled

The spread across models

The cheapest models in this scenario are small, low-priced options:

  • GPT-6 Luna: 4.1¢ per task ($40.71 per 1,000)
  • MiMo-V2.6-Pro: 6.5¢ per task ($64.51 per 1,000)
  • Claude Haiku 5.5: 6.6¢ per task ($66.35 per 1,000)
  • GPT-5.4 Nano: 8.7¢ per task ($86.92 per 1,000)

The most expensive are frontier tiers:

  • Claude Opus 5.5: $1.68 per task ($1,683.28 per 1,000)
  • Claude Fable 5.1: $3.46 per task ($3,461.14 per 1,000)
  • Kimi K3: $3.48 per task ($3,476.01 per 1,000)
  • GPT-6 Astra: $3.72 per task ($3,721.00 per 1,000)

The table below shows how cost, input volume and reasoning volume line up for selected models.

ModelCost per taskCost per 1,000 tasksInput tokensOutput tokensReasoning tokens
GPT-6 Luna4.1¢$40.712,237,50015,0007,000
Claude Haiku 5.56.6¢$66.353,101,17520,79029,550
Qwen3.8 Flash9.2¢$92.312,259,87515,15080,850
Claude Sonnet 5.584¢$841.643,101,17520,79010,900
Claude Opus 5.5$1.68$1,683.283,101,17520,79010,900
Claude Fable 5.1$3.46$3,461.143,101,17520,79010,900

Every row is modeled. Most models carry about 2.2 million input tokens; the Claude models carry about 3.1 million.

Context growth is the main driver

An agent resends its growing context on every step, so input tokens dominate the token count. A run carries roughly 2.2 to 3.1 million input tokens, far more than 300 visible output tokens per step would suggest.

Tokenizers add a multiplier. For the same English document, Anthropic models produce about 1.39 times the tokens of OpenAI models (OpenAI = 1.00). That is why the Claude runs show 3,101,175 input tokens while GPT-6 Luna shows 2,237,500 for the same loop.

Ways to limit context growth:

  • Trim the system prompt. Every step pays for it again.
  • Summarize or drop old tool outputs instead of keeping every result in the window.
  • Use fewer steps when a task can be solved in fewer.

Caching changes the bill

Prompt caching is the second major lever. Cached input is priced far below fresh input, and the modeled costs above assume it. Without caching, the same runs cost much more:

ModelWith cachingWithout caching
GPT-6 Luna4.1¢$0.23
Claude Sonnet 5.584¢$6.52
Claude Opus 5.5$1.68$13.04

Claude Opus 5.5 lists at $4.00 per 1M input tokens and $0.20 per 1M cached input tokens. Whether your framework and provider actually hit the cache decides which column you pay, so check cache hit rates in production before trusting a per-task estimate.

Reasoning tokens

Reasoning tokens add cost even when visible output is short. Qwen3.8 Flash uses 80,850 reasoning tokens in this scenario, and Mistral Small 4 and Mistral Large 4 each use 132,350. Because reasoning is billed as output, a low input price does not guarantee a cheap run.

Claude Haiku 5.5 shows the other side. It uses 29,550 reasoning tokens and still lands at 6.6¢ per task, because its prices are low enough to absorb the extra volume.

Code review and SQL follow the same pattern

For reviewing 500 lines of code, the median across models is 1.4¢. GPT-6 Luna runs at 0.31¢ ($3.08 per 1,000), Claude Sonnet 5.5 at 8.0¢, Claude Opus 5.5 at 16¢ and Claude Fable 5.1 at 40¢.

For writing a SQL query, the median is 0.23¢. GPT-6 Luna runs at 0.04¢ ($0.40 per 1,000), Claude Opus 5.5 at 2.2¢ and Claude Fable 5.1 at 5.5¢.

Basis matters. Twelve models are measured: Claude Haiku 5.5, Claude Sonnet 5.5, DeepSeek V4.1 Flash, Gemini 3.1 Pro Preview, Gemini 3.8 Flash, MiniMax M3, Mistral Large 4, GPT-6 Luna, GPT-6.1 Sol, Qwen3.8 Flash, Grok 4.7 and GLM 5.3 Flash. Each ran once per task with default settings via OpenRouter, with output capped at 16,000 tokens. Claude Opus 5.5 and Claude Fable 5.1 figures are estimates. In code review, Qwen3.8 Flash, GLM 5.3 Flash and DeepSeek V4.1 Flash hit the 16,000-token cap, spending it all on reasoning and returning almost no visible output.

What to do with these numbers

FAQ

How much does an AI coding agent cost per task?

In my modeled 50-step scenario, the median across 326 models is about 48¢ per task. Costs run from 4.1¢ for GPT-6 Luna to $3.72 for GPT-6 Astra at list prices as of 2026-10-11.

What makes an AI coding agent expensive?

Input tokens dominate because the agent resends its growing context at every step. Reasoning tokens, billed as output, and tokenizer differences add more on top.

Does prompt caching really matter for agent costs?

Yes. GPT-6 Luna costs 4.1¢ per task with caching and $0.23 without. Claude Opus 5.5 costs $1.68 with caching and $13.04 without, so cache hit rates strongly affect your real bill.