Price per 1M logo

Cheapest models for code generation

Tool-capable models sorted by blended cost — relevant for codegen, refactors and test writing in CI.

Current leader: Gemini Exp 1114 (Google Gemini). Refreshed 2026-10-28 12:57 UTC.

#ModelProviderInput $/1MOutput $/1MCached $/1MContext
1Gemini Exp 1114Google Geminifreefree—1.0M
2Gemini Exp 1206Google Geminifreefree—2.1M
3Gemma 3 27b ItGoogle Geminifreefree—131K
4Gemma 4 26b A4b ItGoogle Geminifreefree—262K
5Gemma 4 31b ItGoogle Geminifreefree—262K
6Learnlm 1.5 Pro ExperimentalGoogle Geminifreefree—33K
7Labs Leanstral 1 5Mistral AIfreefree—262K
8Labs Leanstral 1 5 1Mistral AIfreefree—262K
9Deepseek Coder V2 BaseOllamafreefree—8K
10Deepseek Coder V2 InstructOllamafreefree—33K
11Deepseek Coder V2 Lite BaseOllamafreefree—8K
12Deepseek Coder V2 Lite InstructOllamafreefree—33K
13Deepseek V3.1:671b CloudOllamafreefree—164K
14GPT Oss:120b CloudOllamafreefree—131K
15GPT Oss:20b CloudOllamafreefree—131K
16Internlm2 5 20b ChatOllamafreefree—33K
17Llama3.1Ollamafreefree—8K
18MistralOllamafreefree—8K
19Mistral 7B Instruct V0.1Ollamafreefree—8K
20Mistral 7B Instruct V0.2Ollamafreefree—33K
21Mistral Large Instruct 2407Ollamafreefree—66K
22Mixtral 8x22B Instruct V0.1Ollamafreefree—66K
23Mixtral 8x7B Instruct V0.1Ollamafreefree—33K
24Qwen3 Coder:480b CloudOllamafreefree—262K
25Qwen2.5 Coder 7BNebius$0.01$0.03—33K
26Llama 3.2 3B InstructDeepInfra$0.02$0.02—131K
27Mistral Nemo Instruct 2407DeepInfra$0.019$0.03—131K
28Meta Llama 3.1 8B Instruct TurboDeepInfra$0.02$0.04—131K
29Qwen3 4b Fp8Novita AI$0.03$0.03—128K
30Meta Llama 3.1 8B InstructNebius$0.02$0.06—128K
31Meta Llama 3.1 8B InstructDeepInfra$0.03$0.05—131K
32Llama 3.2 3b InstructNovita AI$0.03$0.05—33K
33Meta Llama 3 8B InstructDeepInfra$0.03$0.06—8K
34Gemma 4 E4B ItDeepInfra$0.02$0.1—131K
35Granite 4.0 H MicroCloudflare Workers AI$0.017$0.112—131K
36L3 8B Stheno V3.2Novita AI$0.05$0.05—8K
37Mistral Small 24B Instruct 2501DeepInfra$0.05$0.08—33K
38Nemotron 3.5 Lightning 30b A3bPerplexity$0.011$0.17$0.0011—
39Gemma 3 4b ItDeepInfra$0.05$0.1—131K
40GPT Oss 20bDeepInfra$0.03$0.14—131K
41Mistral Nemo Instruct 2407Nebius$0.04$0.12—128K
42Qwen2.5 7b InstructNovita AI$0.07$0.07—32K
43NVIDIA Nemotron Nano 9B V2DeepInfra$0.04$0.16—131K
44GPT Oss 120bDeepInfra$0.037$0.17—131K
45Gemma 3 12b ItDeepInfra$0.05$0.15—131K
46Amazon.nova Micro V1:0Amazon Bedrock$0.042$0.168$0.011128K
47Phi 4DeepInfra$0.07$0.14—16K
48Ling 3.0 FlashDeepInfra$0.06$0.18$0.012131K
49Ling 3.0 Flash FastNovita AI$0.06$0.18$0.012262K
50Ling 3.0 FlashNovita AI$0.06$0.18$0.012262K
51Qwen TurboAlibaba DashScope$0.05$0.2—129K
52Qwen TurboAlibaba DashScope$0.05$0.2—1M
53Qwen TurboAlibaba DashScope$0.05$0.2—1M
54Qwen TurboAlibaba DashScope$0.05$0.2—1M
55Ministral 3b 2512Mistral AI$0.1$0.1$0.01131K
56Ministral 3bMistral AI$0.1$0.1$0.01131K
57Ministral 3 3b 2512Mistral AI$0.1$0.1$0.01131K
58Meta.llama3 2 1b Instruct V1:0Amazon Bedrock$0.1$0.1—128K
59Us.meta.llama3 2 1b Instruct V1:0Amazon Bedrock$0.1$0.1—128K
60Llama 3.1 8bCerebras$0.1$0.1—128K

Other use cases

Frequently asked

› Which coding model is cheapest per token?

Gemini Exp 1114 from Google Gemini currently leads this list, at $0/1M input tokens. Rankings are recomputed from the raw dataset on every refresh, so they track price cuts automatically.

› How are these rankings calculated?

Each use case applies a capability filter (context size, vision, tool calling, cache pricing) and then ranks the surviving models by the blended cost that profile actually pays. See the methodology page for the exact formulas.

› Is the cheapest model always the right choice?

No. Check the capability flags and context window, and benchmark quality on your own data — the cheapest model that fails your evals costs more than the second cheapest that passes them.