Cheapest AI to write a SQL query (Oct 2026)

The cheapest model overall is Summarize at <0.01¢ per task. If you want a top-quartile model, the cheapest is DeepSeek V4.1 Flash at 0.03¢.

10 cheapest models

Any model with a price, including small and older ones.

#ModelCost per taskWebDev scoreTokens in / outBasis
1S
SummarizeScaledown
<0.01¢$0.0071 / 1,000
-177 / 2,630estimated
2S
ExtractScaledown
<0.01¢$0.0071 / 1,000
-177 / 2,630estimated
3OpenAI logo
gpt-oss-20bOpenAI
<0.01¢$0.04 / 1,000
1317126 / 459estimated best value
4Mistral logo
Mistral NemoMistral
<0.01¢$0.10 / 1,000
-121 / 3,158estimated
5S
Llama 3 8B LunarisSao10K
0.01¢$0.14 / 1,000
-177 / 2,630estimated
6OpenAI logo
gpt-oss-safeguard-20bOpenAI
0.01¢$0.15 / 1,000
-126 / 459estimated
7Google logo
Gemma 3 4BGoogle
0.02¢$0.17 / 1,000
1303135 / 1,589estimated
8I
Ling 3.0 FlashInclusionai
0.02¢$0.17 / 1,000
-176 / 2,629estimated
9OpenAI logo
GPT-5 NanoOpenAI
0.02¢$0.19 / 1,000
1338126 / 459estimated best value
10N
Nex-N2.5-MiniNex Agi
0.02¢$0.22 / 1,000
-145 / 2,129estimated

Cheapest high-quality models

Only models in the top 25% of LMArena WebDev scores (≥ 1513).

#ModelCost per taskWebDev scoreTokens in / outBasis
1DeepSeek logo
DeepSeek V4.1 FlashDeepSeek
0.03¢$0.32 / 1,000
1618145 / 2,129measured best value
2Z.ai logo
GLM 5.3 FlashZ.ai
0.03¢$0.33 / 1,000
1606128 / 1,596measured
3DeepSeek logo
DeepSeek V4 Flash 0423DeepSeek
0.04¢$0.40 / 1,000
1581145 / 2,129estimated
4OpenAI logo
GPT-6 LunaOpenAI
0.04¢$0.40 / 1,000
1578126 / 782measured
5Xiaomi logo
MiMo-V2.6-ProXiaomi
0.07¢$0.74 / 1,000
1625274 / 708estimated best value
6Xiaomi logo
MiMo-V2.6-FlashXiaomi
0.08¢$0.76 / 1,000
1634175 / 2,626estimated best value
7Anthropic logo
Claude Haiku 5.5Anthropic
0.08¢$0.84 / 1,000
1585182 / 1,650measured
8DeepSeek logo
DeepSeek V4 Pro 0423DeepSeek
0.09¢$0.92 / 1,000
1582145 / 2,129estimated
9OpenAI logo
GPT-5.6 LunaOpenAI
0.10¢$0.96 / 1,000
1519126 / 782estimated
10Z.ai logo
GLM 5.2Z.ai
0.39¢$3.94 / 1,000
1605128 / 1,596estimated

Cheapest model of each lab

ModelCost per taskScore
OpenAI logo
gpt-oss-20bOpenAI
<0.01¢$0.04 / 1,000
1317
Mistral logo
Mistral NemoMistral
<0.01¢$0.10 / 1,000
-
Google logo
Gemma 3 4BGoogle
0.02¢$0.17 / 1,000
1303
Meta logo
Llama 3.1 8B InstructMeta
0.02¢$0.22 / 1,000
1211
DeepSeek logo
DeepSeek V4.1 FlashDeepSeek
0.03¢$0.32 / 1,000
1618
Z.ai logo
GLM 5.3 FlashZ.ai
0.03¢$0.33 / 1,000
1606
Alibaba Qwen logo
Qwen3.7 FlashAlibaba Qwen
0.03¢$0.35 / 1,000
-
Xiaomi logo
MiMo-V2.6-ProXiaomi
0.07¢$0.74 / 1,000
1625
MiniMax logo
MiniMax M2.5MiniMax
0.07¢$0.74 / 1,000
1386
Anthropic logo
Claude Haiku 5.5Anthropic
0.08¢$0.84 / 1,000
1585
Moonshot AI logo
Kimi K2 0711Moonshot AI
0.18¢$1.80 / 1,000
1418
xAI logo
Grok Build 0.1xAI
0.44¢$4.42 / 1,000
-

FAQ

What is the cheapest AI to write a SQL query?

The cheapest model overall is Summarize at &lt;0.01¢ per task. If you want a top-quartile model, the cheapest is DeepSeek V4.1 Flash at 0.03¢.

Is the cheapest model good enough?

Often not for hard tasks. That is why this page also lists the cheapest models in the top quarter of LMArena scores and the cheapest model of every major lab.