Cheapest LLM API for Coding (2026): Cost-per-Task Table
If you count what a full coding task costs, the cheapest LLM API for coding in October 2026 is Claude Haiku 5.5 when your prompts stay under 100K tokens. DeepSeek's deepseek-flash is cheapest once your repo context goes past that, and in off-peak hours it is close to Haiku on small tasks too. Both rankings assume prompt caching is turned on. Without caching, the per-token tables most sites publish overstate what agent loops cost by roughly 3-4x and can put the models in the wrong order. For better code quality at moderate cost, Gemini 3.8 Flash and GPT-5.4 mini come out at about $0.25 per example task. Claude Sonnet 5.5 costs about $0.60 for the same task.
Which option is right for you?
Pick based on how big your prompts get and whether your data has to stay in the EU, not on the headline price per token.
| Your situation | What to pick first | First page to open |
|---|---|---|
| Beginner or student, no budget | Gemini free tier, or OpenRouter :free models | Gemini API pricing |
| Daily coding agent, prompts under 100K tokens | Claude Haiku 5.5 with prompt caching | Claude pricing |
| Large repos (100K+ token context), tight budget | DeepSeek deepseek-flash, scheduled off-peak where you can | DeepSeek pricing |
| Hard refactors where quality matters more than cents | Claude Sonnet 5.5 or GPT-5.4 mini | OpenAI pricing |
| EU data residency required | Mistral API (Devstral 2 / Codestral) or OVHcloud AI Endpoints | Mistral models |
| Localizing UI strings, not writing code | A cheap LLM for mixed code+text; DeepL or Google for plain text | Google Cloud Translation pricing |
Why each pick: Gemini's free tier costs nothing to start, but your prompts may be used to improve Google's products. Haiku 5.5 has the lowest cache-read price for short prompts. deepseek-flash doesn't get more expensive as prompts grow. Sonnet 5.5 is Anthropic's mid-tier model, and Anthropic says it offers "the best combination of speed and intelligence" (Claude models overview). Mistral keeps data in the EU by default (Mistral Help Center).
How cost per coding task is calculated here
A coding task is costed as a whole agent session: a large repeated context, a little new input on each turn, and some output. A single prompt is the wrong unit. That's why caching rates and long-context surcharges matter more than list price.
Coding agents send the same system prompt, tool definitions and file contents on every turn. Tool use also adds hidden tokens. For example, Claude adds 286 system-prompt tokens per request on Haiku 5.5 and Sonnet 5.5 when tools are enabled with tool_choice: auto. On top of that you pay for your tool schemas and every tool_use and tool_result block (Claude tool use docs). On a 20-turn session, all of that is re-sent 20 times.
These are the two example workloads used below. They are illustrations, not measurements:
- Task A (typical feature fix): 20 turns. A 40K-token prefix (system prompt, tools, relevant files) is cached after turn 1. Each turn adds 3K new input tokens and 1.5K output tokens. Totals: 40K cache write, 760K cache reads, 60K uncached input, 30K output.
- Task B (large-repo work): Same 20 turns, but with a 150K-token prefix. Totals: 150K cache write, 2.85M cache reads, 60K uncached input, 30K output.
Formula: cost = write_tokens × write_price + read_tokens × read_price + fresh_input × input_price + output × output_price. If you want to run this on your own logs, see how to build an LLM cost calculator in Python. The general caching math is in Prompt Caching Cost 2026: Discount Table + Savings Formula.
Two simplifications apply. Real conversations grow every turn, which favors caching even more. And a cheaper model that needs more turns to finish can end up costing more per task, which no price table can capture.
The 7 models ranked by cost per coding task
Claude Haiku 5.5 and DeepSeek deepseek-flash are cheapest per task. Gemini 3.8 Flash, GPT-5.4 mini and DeepSeek V4-Pro form a middle group at about $0.25-$0.30. Prices are as of October 2026; check each official page before you budget.
The price inputs (per 1M tokens, USD)
| Model | Input | Cache write | Cache read | Output | Notes |
|---|---|---|---|---|---|
DeepSeek deepseek-flash | $0.15–$0.30 | (miss price) | $0.003–$0.006 | $0.60–$1.20 | Off-peak is half price; 1M context (DeepSeek) |
DeepSeek deepseek-v4-pro | $0.66–$1.32 | (miss price) | $0.022–$0.044 | $1.98–$3.96 | Same peak/off-peak split (DeepSeek) |
| Claude Haiku 5.5 (≤100K prompt) | $0.10 | $0.125 | $0.01 | $0.50 | Rises to $0.50 / $0.625 / $0.05 / $2.50 above 100K (Claude pricing) |
| Gemini 3.8 Flash | $0.75 | n/a (implicit) | $0.075 | $3.75 | Doubles to $1.50 / $0.15 / $7.50 on (Gemini pricing) |
| GPT-5.4 mini | $0.75 | n/a (automatic) | $0.075 | $4.50 | Over 272K input, billed at 2x (OpenAI pricing) |
| Mistral Devstral 2 | $0.40 | — | not modeled | $2.00 | Agentic coding model (Mistral announcement) |
| Claude Sonnet 5.5 | $2.00 | $2.50 | $0.10 | $10.00 | Cache reads at 5% of input (Claude models overview) |
DeepSeek's peak hours are 01:00–04:00 and 06:00–10:00 UTC, Monday to Friday. Every other hour is billed at the lower rate (DeepSeek pricing).
Cost per task (example workloads, peak DeepSeek pricing)
| Rank (Task A) | Model | Task A cached | Task A uncached | Task B cached |
|---|---|---|---|---|
| 1 | Claude Haiku 5.5 | $0.034 | $0.10 | $0.34 (crosses 100K tier) |
| 2 | DeepSeek deepseek-flash | $0.071 (≈$0.035 off-peak) | $0.29 | $0.12 |
| 3 | Gemini 3.8 Flash | $0.24 | $0.76 | $0.48 |
| 4 | GPT-5.4 mini | $0.27 | $0.78 | $0.51 |
| 5 | DeepSeek deepseek-v4-pro | $0.28 | $1.25 | $0.52 |
| 6 | Mistral Devstral 2 | $0.40 (no cache modeled) | $0.40 | $1.28 |
| 7 | Claude Sonnet 5.5 | $0.60 | $2.02 | $1.08* |
\*The Sonnet figure for Task B uses base rates. Check the Claude pricing page for long-context rules before you rely on it.
To turn that into a monthly bill, multiply by your task count. For example, at 1,000 Task-A sessions a month: Haiku 5.5 is about $34, deepseek-flash about $71, and Sonnet 5.5 about $600.
What the table hides
Haiku 5.5 is the cheapest for short prompts, but the 100K-token threshold works like a cliff. In Task B, every price goes up 5x, and Haiku drops behind deepseek-flash. Not for: whole-repo agents that routinely send 100K+ tokens. Anthropic also positions Haiku for "classification, extraction, and routing" rather than long agentic coding (Claude models overview).
deepseek-flash has the flattest cost curve as context grows, plus a 1M context window. Not for: teams that need EU or US data residency, or predictable latency during peak hours. Limitation: the same request costs twice as much depending on the time of day, which makes forecasting harder.
Gemini 3.8 Flash prices are promotional. If you model your budget on October 2026 rates, your January 2027 invoice will roughly double (Gemini pricing).
GPT-5.4 mini is priced close to Gemini 3.8 Flash. Its 2x surcharge applies only above 272K input tokens, so most coding prompts never reach it (OpenAI pricing).
Devstral 2 ranks low here only because no caching discount was modeled. Its value is EU hosting (see the EU sections below). For autocomplete, Mistral's Codestral costs $0.30/$0.90 with a 128K context and a dedicated /v1/fim/completions endpoint (Codestral model card).
For the same models on a plain per-1M-token basis, see Cheapest LLM API in 2026: Real Cost per 1M Tokens Table.
How to get the cached price in practice
You only get the cached prices if your prompt prefix stays byte-identical between turns and you check the usage fields to confirm cache hits.
- Put stable content first. Order the prompt as system prompt → tool definitions → repo files → conversation. Anything that changes (timestamps, random IDs, the user's new message) goes last.
- Turn caching on where it's explicit. On Claude, add
"cache_control": {"type": "ephemeral"}to the last stable block. A 5-minute cache write costs 1.25x input and a 1-hour write costs 2x for most models (Claude pricing). OpenAI, DeepSeek and Gemini's implicit caching apply automatically. - Check hits in the response. Read
usage.cache_read_input_tokens(Claude),usage.prompt_tokens_details.cached_tokens(OpenAI),prompt_cache_hit_tokens(DeepSeek) orusage_metadata.cached_content_token_count(Gemini). If the number is 0 after turn 2, your prefix is changing. - Set a spend cap per key. OpenRouter supports per-key credit limits and budgets that reset daily, weekly or monthly (OpenRouter limits). On Mistral, check Admin Console → Limits.
- Send non-urgent jobs through Batch. Claude, OpenAI and Gemini all take 50% off batch requests (sources above). See Batch API Discount 2026: OpenAI vs Claude vs Gemini Table.
Common mistakes and fixes
- Mistake: Putting the current date or git status at the top of the system prompt. Fix: Move it to the latest user message so the cached prefix stays the same.
- Mistake: Reordering tools between requests. Fix: Serialize tool definitions in a fixed order.
- Mistake: Paying 1-hour cache-write prices for sessions that end in two minutes. Fix: Use the 5-minute TTL unless the gaps between turns are longer.
- Mistake: Budgeting with Haiku's ≤100K price while your agent sends 120K. Fix: Log prompt sizes and trim retrieved files, or route big prompts to
deepseek-flash. - Mistake: Building a budget on Gemini 3.8 Flash's 2026 promotional price. Fix: Use the 2027 price in your forecast.
What Is the Cheapest Translation API for a Coding Project?
For plain UI strings, Google's 500K free characters cost nothing, but past the free tier a cheap LLM usually costs less per 1M characters. LLMs are clearly better when the text contains placeholders, markup or code.
| Option | Free allowance | Paid price | Best for |
|---|---|---|---|
| Google Cloud Translation (NMT) | 500K chars/month (Basic + Advanced) | $20 per 1M chars | Plain strings, high volume (Google pricing) |
| Google Translation LLM | Not in free tier | $10 input + $10 output per 1M chars | Context-aware text (Google pricing) |
| DeepL API Free | 500K chars/month | — | Small apps (DeepL support) |
| DeepL API Growth | — | Reported at $32.50/month for 1M chars, $27.50 per extra 1M (third-party summary) | Teams that want DeepL quality |
| Gemini 3.1 Flash-Lite | Free tier available | $0.25 in / $1.50 out per 1M tokens | Strings mixed with code (Gemini pricing) |
DeepL's older "API Pro" plan can no longer be bought. New sign-ups get a one-time 1M-character Developer allowance, then move to Growth (DeepL support). Check the DeepL pricing page for current rates.
Worked example: Anthropic estimates 1M tokens at about 2.5M Unicode characters on its tokenizer (Claude models overview). Using that ratio, 1M characters is roughly 400K tokens in and 400K out. On Gemini 3.1 Flash-Lite that comes to about $0.10 + $0.60 = $0.70, compared with $20 on Google NMT after the free tier. Tokenizers differ by provider and language, so treat this as a rough estimate.
Pitfalls: LLMs sometimes translate {count} placeholders, ICU plural keys or variable names. Fix this by asking for JSON output with keys unchanged and checking placeholders in CI. Dedicated APIs handle markup more predictably and offer glossaries.
Cheapest LLM for International Students Coding Assignments
For coding assignments, free tiers are cheapest. Gemini's free tier, OpenRouter's :free models and Groq's free plan cover most homework without paying anything.
| Free option | Limits (as of October 2026) | Catch |
|---|---|---|
| Gemini API free tier (e.g., 3.8 Flash) | Per-model limits shown in AI Studio (rate limits) | Free-tier prompts are used to improve Google products (Gemini terms) |
OpenRouter :free models | 20 requests/min. 50/day, or 1,000/day after a one-time $10 credit purchase (summary; official limits) | Model list changes often |
Groq free plan, openai/gpt-oss-20b | 30 RPM, 1K requests/day, 8K tokens/min, 200K tokens/day (Groq) | 8K TPM is too small for whole-repo prompts |
| Mistral free mode | Exact limits only in Admin Console → Limits (summary) | Phone verification required |
Example: a student who sends 30 requests a day while debugging stays inside OpenRouter's 50/day cap. Someone running an agent that makes 200 calls an hour will not. In that case, $5 of deepseek-flash at the off-peak rates above covers dozens of Task-A-sized sessions.
Pitfalls: Google's terms say "Do not submit sensitive, confidential, or personal information to the Unpaid Services" (Gemini terms). Check that your university's academic-integrity rules allow AI help. Never commit API keys to a public GitHub repo. For Gemini's limits and cost math, see Gemini API Pricing Free Tier 2026.
Is a Coding Bootcamp Cheaper Than Learning to Code with an LLM API?
Yes, by a wide margin on cash cost. A $5–$50 monthly API budget compares with average bootcamp tuition of $14,142, but bootcamps also sell structure, feedback and career services.
| Path | Cash cost | What you get | What you don't get |
|---|---|---|---|
| Bootcamp | $3,500–$30,000, average $14,142 (Course Report) | Curriculum, instructors, cohort, career support | Flexibility on pace |
| Free tiers only | $0 | Code explanations, debugging help | Accountability, someone reviewing your code |
Paid API, e.g., 1,000 Task-A sessions/month on deepseek-flash | About $35–$71 per month (example above) | Unlimited practice at your own pace | Credentials, job placement |
Example: twelve months at $50/month is $600, about 4% of the average tuition. The risk on the self-taught side is not cost. It's spending months without anyone reviewing your work. One middle path is free curricula (Course Report lists free programs alongside paid ones) combined with a capped API key.
Pitfalls: if the AI writes all the code, you won't learn to write it. Ask it to explain errors instead of writing the solution, and set a monthly spend cap before you start.
Cheapest LLM in Europe for International Students
For EU-based students, Mistral's API is the cheapest low-friction option: it has a free mode, and data is hosted in the EU by default. Scaleway's 1M free tokens in Paris are a second option.
| Option | Price (as of October 2026) | Data location |
|---|---|---|
| Mistral API, free mode | Free with rate limits; Codestral $0.30/$0.90 when paid | EU by default; the US endpoint is opt-in (Mistral Help) |
| Scaleway Generative APIs | First 1M tokens free, then e.g. mistral-small-3.2-24b-instruct at €0.15/€0.35 (Scaleway) | Paris region |
| OVHcloud AI Endpoints | gpt-oss-20b at €0.04/€0.15 (OVHcloud catalog) | OVHcloud (France) |
| Azure OpenAI, EU Data Zone | Reported at +20% over Global since (third-party analysis) | EU Azure regions (Azure pricing) |
Pitfalls: EU residency costs more on Azure; it doesn't save you anything. Mistral notes that some features may temporarily transfer data outside the EU to listed subprocessors (Mistral Help). Displayed prices usually exclude VAT. Anthropic, for example, states its prices exclude taxes (Claude pricing). Also note that Google's terms let you use only Paid Services if you make an app available to users in the EEA, Switzerland or the UK (Gemini terms).
Cheapest LLM in Europe for Production Coding Use
For a production coding product that needs EU residency, the cheapest paths are open-weight models on EU clouds (OVHcloud, Scaleway) and Mistral's own API. OpenRouter's EU routing gives you a way to compare prices across them.
| Option | Example price | Limitation |
|---|---|---|
OVHcloud gpt-oss-120b | €0.08 in / €0.40 out (OVHcloud) | Weaker at agentic coding than frontier models (judge on your own evals) |
Scaleway deepseek-v4.1-flash | €0.60 in / €0.12 cached / €1.80 out; batch −50% (Scaleway) | Costs several times DeepSeek's own API |
| Mistral Devstral 2 | $0.40 / $2.00 (Mistral) | Fewer third-party tools tuned for it than for Claude/OpenAI |
| Scaleway dedicated L40S | €1.72/hour, about €1,255/month (Scaleway) | Pays off only at sustained high volume |
OpenRouter eu.openrouter.ai | Same model prices; Business plan, no monthly minimum (OpenRouter) | No Batch API in the EU region; unsupported models return an error rather than routing elsewhere |
Example decision: if Task A runs 1,000 times a month on Scaleway's deepseek-v4.1-flash with caching, the cost is roughly €0.40 per task by the same formula, about €400 a month. A dedicated L40S at about €1,255 a month is worth considering only above about 3,000 such tasks a month, and only if one GPU can handle your concurrency.
Pitfalls: OpenRouter's EU routing keeps prompts in Europe, but account and billing records may still be processed in the US (OpenRouter). Ask your DPO whether that is acceptable.
Next steps
Start with today's prices and your own prompt sizes. A single afternoon is enough to see what your coding agent will cost per month.
Do it yourself today:
- Log prompt token counts from 20 real coding sessions. Find your median and see whether it is over or under 100K. That tells you whether Haiku 5.5 or
deepseek-flashshould be your default. - Turn on caching and confirm cache hits using the usage fields listed in "How to get the cached price in practice."
- Put a monthly spend cap on every API key before sharing it with teammates or an agent.
If you'd rather not run it yourself: Anthropic's Max plan bundles Claude usage for a flat monthly fee. It suits heavy individual users who want a predictable bill. It doesn't suit teams that need per-key spend caps or backend automation. Compare it with API usage in Claude API Pricing vs Max Plan: Break-Even Table for 2026. Check claude.com/pricing for the current price (as of October 2026). For EU teams, OpenRouter's Business plan handles routing and residency without a contract, but it does not support the Batch API in the EU region.
Related guides on Per Million:
- LLM API Pricing Comparison 2026: 5 Providers, Real Costs
- OpenAI API Pricing Calculator: 2026 Formula + Cost Table
- Prompt Caching Cost 2026: Discount Table + Savings Formula
FAQ
What is the cheapest translation API?
For small volumes, DeepL API Free and Google Cloud Translation both give you 500K free characters a month. Above that, a cheap LLM such as Gemini 3.1 Flash-Lite costs roughly $0.70 per 1M characters in the example above, compared with $20 on Google NMT. Dedicated APIs are still easier for glossaries and markup.
What is the cheapest LLM for international students?
Free tiers come first: the Gemini API free tier, OpenRouter :free models (50 requests a day, or 1,000 after a one-time $10 purchase) and Groq's free plan. Don't put personal data into Gemini's free tier, because Google may use it to improve its products.
What is the cheapest coding bootcamp?
Course Report lists tuition from $3,500 to $30,000, with an average of $14,142, and some programs are free. A capped LLM API budget of $5–$50 a month costs far less, but it doesn't give you mentors or career services.
What is the cheapest LLM in Europe?
For EU-hosted inference, OVHcloud's gpt-oss-20b at €0.04/€0.15 per 1M tokens is among the lowest list prices. Mistral's API offers a free mode with EU hosting by default. Azure's EU Data Zone costs more than Global deployments, not less.
Sources
- Claude pricing (claude.com)
- Claude API pricing docs
- Claude models overview
- Claude tool use overview
- OpenAI API pricing
- Gemini API pricing
- Gemini API rate limits
- Gemini API additional terms
- DeepSeek models and pricing
- Mistral models overview
- Mistral Medium 3.5 model card
- Codestral model card
- Devstral 2 announcement
- Mistral data storage location
- Mistral free tier summary (aifreeapi)
- OpenRouter limits
- OpenRouter in-region routing
- OpenRouter free tier limits summary (klymentiev.com)
- Groq rate limits
- Google Cloud Translation pricing
- DeepL API plans (support)
- DeepL API pricing comparison (langbly)
- Course Report coding bootcamp guide
- Scaleway Generative APIs pricing
- OVHcloud AI Endpoints catalog
- Azure OpenAI pricing
- Azure EU Data Zone premium analysis (technspire)
Spotted something out of date or wrong? Tell us at shigoto.ai.note@gmail.com. We check every guide against its official sources.