Quick Recommendations

Our top 3 picks for this use case, ranked by value.

🏆 Top Pick

GLM-4-Flash

Zhipu AI's ultra-cheap model. Near-free pricing for high-volume Chinese and English text tasks.

$0.010/M input Medium project: $0.01 128K tokens
View Full Pricing →
#2

Amazon Nova Micro

Amazon's most cost-effective model. Optimized for speed and low-cost text generation tasks.

$0.035/M input Medium project: $0.04 128K tokens
View Full Pricing →
#3

Gemini 2.5 Flash Lite

The most affordable Gemini model. Ultra-low cost for high-volume, simple coding and text tasks.

$0.037/M input Medium project: $0.04 1M tokens
View Full Pricing →

Why These Models?

The AI coding API pricing landscape in 2026 spans three orders of magnitude — from $0.075 per million tokens (Gemini 1.5 Flash) to $30 per million tokens (GPT-4). Choosing the right model can save you 100x on API costs.

The cheapest models across all providers are: Gemini 1.5 Flash ($0.075/M), Gemini 2.0 Flash ($0.10/M), Mistral Small 3 ($0.10/M), GPT-4o mini ($0.15/M), and Gemini 2.5 Flash ($0.15/M). But the cheapest model isn't always the best value — match model capability to task complexity.

Complete Rankings & Pricing

All 113 models ranked for cheapest ai coding api 2026. Costs calculated at 30% cache hit rate.

RankModelProvider Small ProjectMedium ProjectLarge ProjectCode Review Compare
#1 GLM-4-Flash Zhipu AI <$0.01 $0.01 $0.03 <$0.01 vs GLM-4-Flash
#2 Amazon Nova Micro Amazon <$0.01 $0.04 $0.20 <$0.01 vs GLM-4-Flash
#3 Gemini 2.5 Flash Lite Google <$0.01 $0.04 $0.22 $0.01 vs GLM-4-Flash
#4 MiniMax Text 01 MiniMax <$0.01 $0.06 $0.29 $0.01 vs GLM-4-Flash
#5 Stable Code 3B Stability AI <$0.01 $0.06 $0.29 $0.01 vs GLM-4-Flash
#6 Llama 3.1 8B Meta <$0.01 $0.04 $0.19 $0.01 vs GLM-4-Flash
#7 Phi-3 Mini Microsoft <$0.01 $0.04 $0.19 $0.01 vs GLM-4-Flash
#8 Amazon Nova Lite Amazon <$0.01 $0.07 $0.34 $0.02 vs GLM-4-Flash
#9 Gemini 1.5 Flash Google $0.01 $0.09 $0.43 $0.02 vs GLM-4-Flash
#10 Gemini 2.0 Flash Lite Google $0.01 $0.09 $0.43 $0.02 vs GLM-4-Flash
#11 Qwen Turbo Qwen $0.01 $0.08 $0.38 $0.02 vs GLM-4-Flash
#12 Gemini 2.0 Flash Google $0.02 $0.12 $0.58 $0.03 vs GLM-4-Flash
#13 Mistral Small 3 Mistral $0.01 $0.10 $0.47 $0.02 vs GLM-4-Flash
#14 Microsoft Phi-4 Microsoft $0.01 $0.10 $0.47 $0.02 vs GLM-4-Flash
#15 Gemma 3 27B Google $0.02 $0.12 $0.58 $0.03 vs GLM-4-Flash
#16 Stable LM 2 Stability AI $0.02 $0.12 $0.58 $0.03 vs GLM-4-Flash
#17 GPT-4.1 Nano OpenAI $0.02 $0.12 $0.58 $0.03 vs GLM-4-Flash
#18 Mistral Small 3 Mistral $0.01 $0.10 $0.47 $0.02 vs GLM-4-Flash
#19 Phi-3 Medium Microsoft $0.01 $0.10 $0.47 $0.02 vs GLM-4-Flash
#20 Phi-4 Mini Microsoft $0.01 $0.10 $0.47 $0.02 vs GLM-4-Flash
#21 GLM-4-Air Zhipu AI <$0.01 $0.08 $0.39 $0.03 vs GLM-4-Flash
#22 DeepSeek V3 DeepSeek $0.01 $0.11 $0.53 $0.03 vs GLM-4-Flash
#23 DeepSeek R1 DeepSeek $0.02 $0.16 $0.80 $0.04 vs GLM-4-Flash
#24 GPT-4o mini OpenAI $0.02 $0.18 $0.92 $0.05 vs GLM-4-Flash
#25 Gemini 2.5 Flash Google $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#26 Mistral Nemo Mistral <$0.01 $0.08 $0.41 $0.03 vs GLM-4-Flash
#27 Qwen 3 Turbo Qwen $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#28 DeepSeek Jiuge DeepSeek $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#29 Cohere Command R Cohere $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#30 Yi-Lightning 01.ai $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#31 MiniMax-M1 MiniMax $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#32 Gemini 2.5 Flash Google $0.02 $0.17 $0.86 $0.04 vs GLM-4-Flash
#33 Pixtral 12B Mistral <$0.01 $0.08 $0.41 $0.03 vs GLM-4-Flash
#34 Reka Flash Reka $0.03 $0.23 $1.15 $0.06 vs GLM-4-Flash
#35 Groq Gemma 2 9B Groq $0.01 $0.11 $0.55 $0.04 vs GLM-4-Flash
#36 Qwen 2.5 Coder 32B Qwen $0.02 $0.15 $0.75 $0.04 vs GLM-4-Flash
#37 Llama 3.1 70B Meta $0.02 $0.15 $0.75 $0.04 vs GLM-4-Flash
#38 Llama 4 Scout Meta $0.03 $0.23 $1.15 $0.06 vs GLM-4-Flash
#39 Groq Mixtral 8x7B Groq $0.02 $0.13 $0.66 $0.05 vs GLM-4-Flash
#40 Claude 3 Haiku Anthropic $0.05 $0.34 $1.69 $0.07 vs GLM-4-Flash
#41 Qwen Coder Turbo Qwen $0.05 $0.34 $1.69 $0.07 vs GLM-4-Flash
#42 Llama 3.3 70B Meta $0.04 $0.29 $1.44 $0.07 vs GLM-4-Flash
#43 DeepSeek Chat V3 DeepSeek $0.04 $0.31 $1.57 $0.07 vs GLM-4-Flash
#44 DeepSeek Coder V2 DeepSeek $0.04 $0.31 $1.57 $0.07 vs GLM-4-Flash
#45 DeepSeek Coder V3 DeepSeek $0.04 $0.31 $1.57 $0.07 vs GLM-4-Flash
#46 DeepSeek V3.2 DeepSeek $0.05 $0.34 $1.73 $0.08 vs GLM-4-Flash
#47 Grok 3 Mini xAI $0.03 $0.21 $1.02 $0.07 vs GLM-4-Flash
#48 Codestral Mistral $0.04 $0.29 $1.43 $0.07 vs GLM-4-Flash
#49 Qwen Coder Turbo V2 Qwen $0.05 $0.34 $1.73 $0.08 vs GLM-4-Flash
#50 Qwen Plus Qwen $0.05 $0.38 $1.90 $0.10 vs GLM-4-Flash
#51 Mistral Medium Mistral $0.07 $0.54 $2.70 $0.12 vs GLM-4-Flash
#52 GPT-4.1 mini OpenAI $0.06 $0.46 $2.30 $0.11 vs GLM-4-Flash
#53 Qwen 2.5 72B Qwen $0.04 $0.30 $1.50 $0.09 vs GLM-4-Flash
#54 Llama 4 Maverick Meta $0.06 $0.46 $2.30 $0.11 vs GLM-4-Flash
#55 Reka Edge Reka $0.04 $0.34 $1.70 $0.10 vs GLM-4-Flash
#56 GPT-3.5 Turbo OpenAI $0.06 $0.48 $2.38 $0.13 vs GLM-4-Flash
#57 Qwen 3 Coder Qwen $0.08 $0.57 $2.88 $0.14 vs GLM-4-Flash
#58 QVQ 72B Preview Qwen $0.06 $0.48 $2.38 $0.13 vs GLM-4-Flash
#59 DeepSeek Reasoner (R1) DeepSeek $0.08 $0.63 $3.15 $0.15 vs GLM-4-Flash
#60 Groq Llama 3.3 70B Groq $0.04 $0.36 $1.82 $0.12 vs GLM-4-Flash
#61 GLM-4-Plus Zhipu AI $0.05 $0.38 $1.92 $0.14 vs GLM-4-Flash
#62 Databricks DBRX Instruct Databricks $0.09 $0.71 $3.56 $0.19 vs GLM-4-Flash
#63 Claude 3.5 Haiku Anthropic $0.16 $1.24 $6.21 $0.32 vs GLM-4-Flash
#64 Qwen Coder Plus Qwen $0.15 $1.08 $5.40 $0.24 vs GLM-4-Flash
#65 Claude 4 Haiku Anthropic $0.16 $1.24 $6.21 $0.32 vs GLM-4-Flash
#66 Amazon Nova Pro Amazon $0.12 $0.92 $4.60 $0.22 vs GLM-4-Flash
#67 Together Mistral Small 3 Together AI $0.05 $0.44 $2.20 $0.16 vs GLM-4-Flash
#68 Together Llama 3.3 70B Together AI $0.06 $0.48 $2.42 $0.18 vs GLM-4-Flash
#69 Claude Sonnet 4 Lite Anthropic $0.21 $1.55 $7.76 $0.40 vs GLM-4-Flash
#70 Perplexity Sonar Perplexity $0.07 $0.55 $2.75 $0.20 vs GLM-4-Flash
#71 Reka Core Reka $0.11 $0.85 $4.25 $0.24 vs GLM-4-Flash
#72 OpenAI o1-mini OpenAI $0.17 $1.27 $6.33 $0.30 vs GLM-4-Flash
#73 OpenAI o3-mini OpenAI $0.17 $1.27 $6.33 $0.30 vs GLM-4-Flash
#74 OpenAI o4-mini OpenAI $0.17 $1.27 $6.33 $0.30 vs GLM-4-Flash
#75 O3 Mini OpenAI $0.17 $1.27 $6.33 $0.30 vs GLM-4-Flash
#76 Gemini 2.5 Pro Google $0.34 $2.44 $12.19 $0.47 vs GLM-4-Flash
#77 Gemini 1.5 Pro Google $0.19 $1.44 $7.19 $0.34 vs GLM-4-Flash
#78 Grok Code xAI $0.28 $2.02 $10.13 $0.45 vs GLM-4-Flash
#79 Qwen Max Qwen $0.25 $1.84 $9.20 $0.44 vs GLM-4-Flash
#80 Mistral Large 2 Mistral $0.25 $1.90 $9.50 $0.50 vs GLM-4-Flash
#81 GPT-4.1 OpenAI $0.31 $2.30 $11.50 $0.55 vs GLM-4-Flash
#82 Mistral Large 3 Mistral $0.25 $1.90 $9.50 $0.50 vs GLM-4-Flash
#83 Cohere Command A Cohere $0.31 $2.30 $11.50 $0.55 vs GLM-4-Flash
#84 Mistral Large 24.07 Mistral $0.25 $1.90 $9.50 $0.50 vs GLM-4-Flash
#85 Pixtral Large Mistral $0.25 $1.90 $9.50 $0.50 vs GLM-4-Flash
#86 Grok 2 xAI $0.37 $2.70 $13.50 $0.60 vs GLM-4-Flash
#87 Grok 2 Vision xAI $0.37 $2.70 $13.50 $0.60 vs GLM-4-Flash
#88 GPT-4o OpenAI $0.41 $3.06 $15.31 $0.78 vs GLM-4-Flash
#89 Gemini 2.0 Pro Google $0.39 $2.88 $14.38 $0.69 vs GLM-4-Flash
#90 Amazon Nova Premier Amazon $0.46 $3.38 $16.88 $0.75 vs GLM-4-Flash
#91 Cohere Command R+ Cohere $0.39 $2.88 $14.38 $0.69 vs GLM-4-Flash
#92 Yi-Large 01.ai $0.39 $2.88 $14.38 $0.69 vs GLM-4-Flash
#93 Claude Sonnet 4 Anthropic $0.62 $4.66 $23.29 $1.20 vs GLM-4-Flash
#94 Claude 3.5 Sonnet Anthropic $0.62 $4.66 $23.29 $1.20 vs GLM-4-Flash
#95 Claude 3 Sonnet Anthropic $0.55 $4.05 $20.25 $0.90 vs GLM-4-Flash
#96 Qwen 3.6 Plus Qwen $0.62 $4.66 $23.29 $1.20 vs GLM-4-Flash
#97 Grok 3 xAI $0.55 $4.05 $20.25 $0.90 vs GLM-4-Flash
#98 Perplexity Sonar Pro Perplexity $0.55 $4.05 $20.25 $0.90 vs GLM-4-Flash
#99 Grok 4 xAI $0.93 $6.75 $33.75 $1.50 vs GLM-4-Flash
#100 Qwen 3 Max Qwen $0.78 $5.75 $28.75 $1.38 vs GLM-4-Flash
#101 Grok 3 Vision xAI $0.78 $5.75 $28.75 $1.38 vs GLM-4-Flash
#102 Perplexity Sonar Reasoning Pro Perplexity $0.78 $5.75 $28.75 $1.38 vs GLM-4-Flash
#103 Databricks Llama 3.1 405B Databricks $0.63 $4.75 $23.75 $1.25 vs GLM-4-Flash
#104 GLM-4-AllTools Zhipu AI $0.46 $3.85 $19.25 $1.40 vs GLM-4-Flash
#105 GPT-4 Turbo OpenAI $1.25 $9.50 $47.50 $2.50 vs GLM-4-Flash
#106 OpenAI o3 OpenAI $1.55 $11.50 $57.50 $2.75 vs GLM-4-Flash
#107 Claude Opus 4 Anthropic $3.08 $23.29 $116.44 $6.02 vs GLM-4-Flash
#108 Claude 3 Opus Anthropic $2.77 $20.25 $101.25 $4.50 vs GLM-4-Flash
#109 OpenAI o1 OpenAI $2.32 $17.25 $86.25 $4.13 vs GLM-4-Flash
#110 O1 Preview OpenAI $2.32 $17.25 $86.25 $4.13 vs GLM-4-Flash
#111 OpenAI o1 Pro OpenAI $3.10 $23.00 $115.00 $5.50 vs GLM-4-Flash
#112 OpenAI o3 Pro OpenAI $3.10 $23.00 $115.00 $5.50 vs GLM-4-Flash
#113 GPT-4 OpenAI $2.85 $22.50 $112.50 $6.75 vs GLM-4-Flash

Frequently Asked Questions

What is the cheapest AI coding API in 2026?

Gemini 1.5 Flash at $0.075 per million input tokens is the cheapest. GPT-4o mini and Gemini 2.5 Flash are close behind at $0.15/M.

Is the cheapest model good enough for coding?

For simple coding tasks, yes. Budget models like GPT-4o mini and DeepSeek Chat handle basic Python, JavaScript, and other languages competently.