Cheapest LLMs for coding
Mistral: Mistral Nemo is the cheapest option at $0.019 per million input tokens. Coding workloads read a lot of context and call tools constantly, so tool support and a large context window matter as much as the headline price.
260 models qualify
Ranked by blended cost - input weighted 75%, output 25%.
| # | Model | Blended / 1M | Input / 1M | Output / 1M | Context | Capabilities |
|---|---|---|---|---|---|---|
| 1 | Auto Router (Beta) OpenRouter | $-1000000.0000 | $-1000000.0000 | $-1000000.0000 | 2M | ReasoningToolsVision |
| 2 | Auto Router OpenRouter | $-1000000.0000 | $-1000000.0000 | $-1000000.0000 | 2M | ReasoningToolsVision |
| 3 | Nex-N2.5-Mini (free) Nex AGI | Free | Free | Free | 262K | Free tierReasoningToolsVisionOpen weights |
| 4 | Nex-N2.5-Pro (free) Nex AGI | Free | Free | Free | 262K | Free tierReasoningToolsVisionOpen weights |
| 5 | Ling 3.0 Flash Sante (free) inclusionAI | Free | Free | Free | 262K | Free tierReasoningTools |
| 6 | Dots3-Note Preview (free) Dots Studio | Free | Free | Free | 512K | Free tierReasoningToolsVision |
| 7 | North Mini Code (free) Cohere | Free | Free | Free | 256K | Free tierReasoningToolsOpen weights |
| 8 | Free | Free | Free | 256K | Free tierReasoningToolsVisionOpen weights | |
| 9 | Free Models Router OpenRouter | Free | Free | Free | 200K | Free tierReasoningToolsVision |
| 10 | Mistral Nemo Mistral AI | $0.022 | $0.019 | $0.030 | 131K | ToolsOpen weights |
| 11 | Ling 3.0 Flash inclusionAI | $0.032 | $0.021 | $0.063 | 262K | ReasoningToolsOpen weights |
| 12 | Qwen3.7 Flash Qwen | $0.055 | $0.030 | $0.130 | 1M | ReasoningToolsVision |
| 13 | gpt-oss-20b OpenAI | $0.055 | $0.030 | $0.130 | 131K | ReasoningToolsOpen weights |
| 14 | Llama 3.1 8B Instruct Meta Llama | $0.057 | $0.050 | $0.080 | 131K | ToolsOpen weights |
| 15 | Nova Micro 1.0 Amazon | $0.061 | $0.035 | $0.140 | 128K | Tools |
| 16 | Mercury 2.5 Inception | $0.068 | $0.040 | $0.150 | 260K | ReasoningTools |
| 17 | gpt-oss-120b OpenAI | $0.070 | $0.037 | $0.170 | 131K | ReasoningToolsOpen weights |
| 18 | DeepSeek V4 Flash 0731 DeepSeek | $0.075 | $0.060 | $0.120 | 1.3M | ReasoningToolsOpen weights |
| 19 | Laguna XS 2.1 Poolside | $0.075 | $0.060 | $0.120 | 262K | Free tierReasoningToolsOpen weights |
| 20 | Gemma 3 12B | $0.075 | $0.050 | $0.150 | 131K | ToolsVisionOpen weights |
| 21 | $0.084 | $0.048 | $0.193 | 262K | ToolsOpen weights | |
| 22 | Nemotron 3 Nano 30B A3B NVIDIA | $0.087 | $0.050 | $0.200 | 262K | ReasoningToolsOpen weights |
| 23 | Ling 3.0 Flash VL inclusionAI | $0.090 | $0.060 | $0.180 | 131K | Free tierReasoningToolsVisionOpen weights |
| 24 | Ling 3.0 Flash Fin inclusionAI | $0.090 | $0.060 | $0.180 | 262K | Free tierReasoningTools |
| 25 | Ministral 3 3B 2512 Mistral AI | $0.100 | $0.100 | $0.100 | 131K | ToolsVisionOpen weights |
Frequently asked
What is the cheapest LLM for code generation and refactoring?
Mistral: Mistral Nemo at $0.019 per million input tokens and $0.030 per million output tokens, with a 131K token context window.
How many models qualify for code generation and refactoring?
260 of the 340 models tracked here meet the criteria for this list.
How much do prices vary within this category?
By roughly 3,100×, from Mistral Nemo at the bottom to GPT-5.4 Pro at the top.