Home / Guides / Cheapest AI model for coding: cost per code task compared

Cheapest AI model for coding: cost per code task compared

Coding work is priced by how many tokens a review, query, or agent run uses. The cheapest model on paper is not always the cheapest for code.

By Piotr Olszewski · Oct 25, 2026 · prices as of Nov 22, 2026

The cheapest models for coding in my measurements are GLM 5.3 Flash, GPT-6 Luna and MiMo-V2.6-Pro. GLM 5.3 Flash had the lowest cost in both the code review and SQL tasks, and GPT-6 Luna had the lowest modeled cost for the 50-step agent run. Their LMArena scores (1474, 1443 and 1479) sit in the same range as much pricier models, so the savings do not come from a large quality gap.

How I ranked the models

I ranked each model by cost per task on three workloads: a 500-line code review, a SQL query, and a 50-step coding agent. The code review and SQL figures come from a mix of measured and estimated runs, and the agent cost is modeled. Measured runs used default settings through OpenRouter, one run per task, with output capped at 16,000 tokens. I label the basis wherever it matters. More detail is in the methodology.

I used the LMArena Text score as a rough check against a large quality drop. It is not a coding benchmark, so treat it as a sanity check only.

Code review: 500 lines

The median across all 335 models is 1.2¢ per review. The lowest-cost models were:

ModelCost per reviewPer 1,000Basis
GLM 5.3 Flash0.14¢$1.41measured
GPT-6 Luna0.31¢$3.08measured
MiMo-V2.6-Pro0.44¢$4.36estimated
Gemini 3.1 Flash Lite0.44¢$4.41estimated
MiniMax M30.45¢$4.53measured
Command A+0.53¢$5.33estimated

GLM 5.3 Flash used 4,532 input tokens, 2 output tokens and 15,998 reasoning tokens, so it hit the 16,000-token cap. It still came out cheapest, because its list price is $0.043 input and $0.076 output per 1M tokens. A cap hit also means the model may not have finished a useful review, which is another reason to test your own prompts.

For comparison, Gemini 3.8 Flash scores 1496 on LMArena and costs 1.3¢ per review. GPT-6.1 Sol costs 4.9¢ and Claude Opus 5.5 costs 16¢. See the code review task page for the full list.

SQL query

The median is 0.22¢ per query. SQL is a small task, so the ranking mostly follows per-token price and reasoning volume.

ModelCost per queryPer 1,000Basis
GLM 5.3 Flash0.01¢$0.13measured
GPT-6 Luna0.04¢$0.40measured
MiMo-V2.6-Pro0.07¢$0.74estimated
Claude Haiku 5.50.08¢$0.84measured
MiniMax M30.09¢$0.92measured
GPT-5.4 Nano0.10¢$1.00estimated
Command A+0.11¢$1.14estimated

Further up, Gemini 3.8 Flash costs 0.67¢ per query and Claude Sonnet 5.5 costs 1.1¢. See write a SQL query.

50-step coding agent

The scenario uses an 8,000-token system prompt, 50 steps, 1,500 extra context tokens per step and 300 visible output tokens per step. The median is 46¢ per run. The lowest modeled costs:

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

Agent runs are dominated by input tokens, so the cached input price matters most. GPT-6 Luna lists cached input at $0.01 per 1M tokens, and its run costs 4.1¢ with caching versus $0.23 without. MiMo-V2.6-Pro goes from 6.5¢ to $1.00 without caching. At the expensive end, GPT-6 Astra costs $3.72 per run and Claude Fable 5.1 costs $3.46. See the 50-step agent task.

#ModelCost per taskWebDev scoreTokens in / outBasis
1DeepSeek logo
DeepSeek V4.1 FlashDeepSeek
2.7¢$26.61 / 1,000
16192,235,262 / 102,435modeled best value
2OpenAI logo
GPT-6 LunaOpenAI
4.1¢$40.71 / 1,000
15792,237,500 / 22,000modeled
3Xiaomi logo
MiMo-V2.6-ProXiaomi
6.5¢$64.51 / 1,000
16252,241,975 / 24,380modeled best value
4Anthropic logo
Claude Haiku 5.5Anthropic
6.6¢$66.35 / 1,000
15893,101,175 / 50,340modeled
5Z.ai logo
GLM 5.3 FlashZ.ai
7.1¢$71.44 / 1,000
16072,239,737 / 43,814modeled
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

Where reasoning tokens raise the cost

Reasoning tokens are billed as output tokens, so a low list price can hide a high task cost.

  • Claude Haiku 5.5 lists at $0.10 input and $0.50 output. In the code review it produced 3,258 output and 8,532 reasoning tokens from 7,117 input tokens, and cost 0.66¢. Cheap, but not the cheapest.
  • Mistral Small 4 lists at $0.15 / $0.60. It produced 7,522 reasoning tokens in the review (0.62¢) and 132,350 in the agent run (13¢).
  • Qwen3.8 Flash is listed with reasoning none, yet in the code review it billed 16,000 reasoning tokens and hit the cap, costing 0.83¢.
  • DeepSeek V4.1 Flash has a $0.02 input price, but its review used 16,000 reasoning tokens and cost 1.6¢.
  • Llama 4 Maverick is listed with reasoning none, yet its estimated review also hit the 16,000-token cap, at 1.1¢.

Check the actual token counts for a model before trusting its list price.

Context window and reasoning mode

Whole files and long histories go into the prompt, so context matters. The cheapest group mostly has very large windows:

  • GPT-6 Luna: 1,050,000 tokens, reasoning default
  • MiMo-V2.6-Pro: 1,050,000 tokens, reasoning none
  • GLM 5.3 Flash: 1,048,576 tokens, reasoning always
  • MiniMax M3: 1,048,576 tokens, reasoning none
  • Command A+: 192,000 tokens, reasoning none

Command A+ has the smallest window here. It is cheap in review and SQL, but at 38¢ per agent run it is well behind the leaders.

Reasoning mode is not a simple cost rule. MiMo-V2.6-Pro and MiniMax M3 are cheap with reasoning none, while GLM 5.3 Flash is cheap with reasoning always because its per-token prices are so low.

Quality check with LMArena

ModelLMArena TextCode review cost
GLM 5.3 Flash14740.14¢
MiMo-V2.6-Pro14790.44¢
GPT-6 Luna14430.31¢
MiniMax M314410.45¢
GPT-6.1 Sol14844.9¢
Gemini 3.8 Flash14961.3¢
Claude Opus 5.5150816¢

GLM 5.3 Flash and MiMo-V2.6-Pro score close to GPT-6.1 Sol at a fraction of the review cost. Claude Opus 5.5 scores 1508, only modestly above GLM 5.3 Flash at 1474, yet costs 16¢ per review. Claude Haiku 5.5 has no LMArena score in my data, so I cannot run this check for it.

Which to pick

  • Code review and SQL: GLM 5.3 Flash, with the caveat about the token cap. MiMo-V2.6-Pro and GPT-6 Luna are safer second options.
  • Agent runs: GPT-6 Luna at 4.1¢, with MiMo-V2.6-Pro at 6.5¢ and a higher LMArena score of 1479.
  • Higher quality ceiling: Gemini 3.8 Flash (1496) at 1.3¢ per review is a moderate step up in cost.

Test on your own prompts before switching. You can estimate volume costs in the calculator.

FAQ

Which model is cheapest for coding overall?

GLM 5.3 Flash had the lowest cost for code review (0.14¢) and SQL (0.01¢). GPT-6 Luna had the lowest modeled cost for the 50-step agent run at 4.1¢.

Does a low list price always mean a cheap coding task?

No. Reasoning tokens are billed as output, and models such as Mistral Small 4 and DeepSeek V4.1 Flash produced thousands of them despite low list prices.

Is the cheapest model good enough for real code?

LMArena scores of 1474 for GLM 5.3 Flash and 1479 for MiMo-V2.6-Pro suggest no large quality drop. A general score does not guarantee results on your codebase, so test your own code first.

Sources