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.
| # | Model | Provider | Input $/1M | Output $/1M | Cached $/1M | Context |
|---|---|---|---|---|---|---|
| 1 | Gemini Exp 1114 | Google Gemini | free | free | — | 1.0M |
| 2 | Gemini Exp 1206 | Google Gemini | free | free | — | 2.1M |
| 3 | Gemma 3 27b It | Google Gemini | free | free | — | 131K |
| 4 | Gemma 4 26b A4b It | Google Gemini | free | free | — | 262K |
| 5 | Gemma 4 31b It | Google Gemini | free | free | — | 262K |
| 6 | Learnlm 1.5 Pro Experimental | Google Gemini | free | free | — | 33K |
| 7 | Labs Leanstral 1 5 | Mistral AI | free | free | — | 262K |
| 8 | Labs Leanstral 1 5 1 | Mistral AI | free | free | — | 262K |
| 9 | Deepseek Coder V2 Base | Ollama | free | free | — | 8K |
| 10 | Deepseek Coder V2 Instruct | Ollama | free | free | — | 33K |
| 11 | Deepseek Coder V2 Lite Base | Ollama | free | free | — | 8K |
| 12 | Deepseek Coder V2 Lite Instruct | Ollama | free | free | — | 33K |
| 13 | Deepseek V3.1:671b Cloud | Ollama | free | free | — | 164K |
| 14 | GPT Oss:120b Cloud | Ollama | free | free | — | 131K |
| 15 | GPT Oss:20b Cloud | Ollama | free | free | — | 131K |
| 16 | Internlm2 5 20b Chat | Ollama | free | free | — | 33K |
| 17 | Llama3.1 | Ollama | free | free | — | 8K |
| 18 | Mistral | Ollama | free | free | — | 8K |
| 19 | Mistral 7B Instruct V0.1 | Ollama | free | free | — | 8K |
| 20 | Mistral 7B Instruct V0.2 | Ollama | free | free | — | 33K |
| 21 | Mistral Large Instruct 2407 | Ollama | free | free | — | 66K |
| 22 | Mixtral 8x22B Instruct V0.1 | Ollama | free | free | — | 66K |
| 23 | Mixtral 8x7B Instruct V0.1 | Ollama | free | free | — | 33K |
| 24 | Qwen3 Coder:480b Cloud | Ollama | free | free | — | 262K |
| 25 | Qwen2.5 Coder 7B | Nebius | $0.01 | $0.03 | — | 33K |
| 26 | Llama 3.2 3B Instruct | DeepInfra | $0.02 | $0.02 | — | 131K |
| 27 | Mistral Nemo Instruct 2407 | DeepInfra | $0.019 | $0.03 | — | 131K |
| 28 | Meta Llama 3.1 8B Instruct Turbo | DeepInfra | $0.02 | $0.04 | — | 131K |
| 29 | Qwen3 4b Fp8 | Novita AI | $0.03 | $0.03 | — | 128K |
| 30 | Meta Llama 3.1 8B Instruct | Nebius | $0.02 | $0.06 | — | 128K |
| 31 | Meta Llama 3.1 8B Instruct | DeepInfra | $0.03 | $0.05 | — | 131K |
| 32 | Llama 3.2 3b Instruct | Novita AI | $0.03 | $0.05 | — | 33K |
| 33 | Meta Llama 3 8B Instruct | DeepInfra | $0.03 | $0.06 | — | 8K |
| 34 | Gemma 4 E4B It | DeepInfra | $0.02 | $0.1 | — | 131K |
| 35 | Granite 4.0 H Micro | Cloudflare Workers AI | $0.017 | $0.112 | — | 131K |
| 36 | L3 8B Stheno V3.2 | Novita AI | $0.05 | $0.05 | — | 8K |
| 37 | Mistral Small 24B Instruct 2501 | DeepInfra | $0.05 | $0.08 | — | 33K |
| 38 | Nemotron 3.5 Lightning 30b A3b | Perplexity | $0.011 | $0.17 | $0.0011 | — |
| 39 | Gemma 3 4b It | DeepInfra | $0.05 | $0.1 | — | 131K |
| 40 | GPT Oss 20b | DeepInfra | $0.03 | $0.14 | — | 131K |
| 41 | Mistral Nemo Instruct 2407 | Nebius | $0.04 | $0.12 | — | 128K |
| 42 | Qwen2.5 7b Instruct | Novita AI | $0.07 | $0.07 | — | 32K |
| 43 | NVIDIA Nemotron Nano 9B V2 | DeepInfra | $0.04 | $0.16 | — | 131K |
| 44 | GPT Oss 120b | DeepInfra | $0.037 | $0.17 | — | 131K |
| 45 | Gemma 3 12b It | DeepInfra | $0.05 | $0.15 | — | 131K |
| 46 | Amazon.nova Micro V1:0 | Amazon Bedrock | $0.042 | $0.168 | $0.011 | 128K |
| 47 | Phi 4 | DeepInfra | $0.07 | $0.14 | — | 16K |
| 48 | Ling 3.0 Flash | DeepInfra | $0.06 | $0.18 | $0.012 | 131K |
| 49 | Ling 3.0 Flash Fast | Novita AI | $0.06 | $0.18 | $0.012 | 262K |
| 50 | Ling 3.0 Flash | Novita AI | $0.06 | $0.18 | $0.012 | 262K |
| 51 | Qwen Turbo | Alibaba DashScope | $0.05 | $0.2 | — | 129K |
| 52 | Qwen Turbo | Alibaba DashScope | $0.05 | $0.2 | — | 1M |
| 53 | Qwen Turbo | Alibaba DashScope | $0.05 | $0.2 | — | 1M |
| 54 | Qwen Turbo | Alibaba DashScope | $0.05 | $0.2 | — | 1M |
| 55 | Ministral 3b 2512 | Mistral AI | $0.1 | $0.1 | $0.01 | 131K |
| 56 | Ministral 3b | Mistral AI | $0.1 | $0.1 | $0.01 | 131K |
| 57 | Ministral 3 3b 2512 | Mistral AI | $0.1 | $0.1 | $0.01 | 131K |
| 58 | Meta.llama3 2 1b Instruct V1:0 | Amazon Bedrock | $0.1 | $0.1 | — | 128K |
| 59 | Us.meta.llama3 2 1b Instruct V1:0 | Amazon Bedrock | $0.1 | $0.1 | — | 128K |
| 60 | Llama 3.1 8b | Cerebras | $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.