On this page
The cheapest LLM API for coding in 2026 is DeepSeek V4.1 Flash on DeepInfra’s 1017 build, at $0.098 per million input tokens, $0.0029 for cached input and $0.294 for output. A daily agent month costs about $3 there, against $78 on Claude Sonnet 5.5. For Claude Code, use DeepSeek’s Anthropic-format API. Off Grid AI Boost is a flat pre-order from $4.99.
Three coding workloads
Coding tools don’t use tokens the same way. These example months match the three tools in the title. Your own numbers are on your provider’s usage page.
| Workload | Like | Input tokens | Cache hits | Output tokens |
|---|---|---|---|---|
| Editor chat and edits | Cursor-style inline edits and questions | 20M | 50% | 2M |
| Agent tasks | Cline running a few tasks a day | 100M | 80% | 3M |
| Long agent sessions | Claude Code working for hours | 300M | 90% | 6M |
Each workload priced
Each price links to the host’s own page. Hosts with a published cached-input price are billed with it; the rest bill every input token at full price.
| Model and host | In / cached / out per 1M | Editor chat | Agent tasks | Long sessions |
|---|---|---|---|---|
| DeepSeek V4.1 Flash, DeepInfra 1017 build | $0.098 / $0.0029 / $0.294 | $1.60 | $3.07 | $5.49 |
| DeepSeek V4.1 Flash, NanoGPT | $0.039 / not listed / $0.40 | $1.58 | $5.10 | $14.10 |
| Qwen3.8 Flash, DeepInfra | $0.113 / $0.0141 / $0.382 | $2.04 | $4.53 | $9.49 |
| DeepSeek V4.1 Flash, DeepSeek API off-peak | $0.15 / $0.003 / $0.60 | $2.73 | $5.04 | $8.91 |
| Qwen3.8-27B, OpenRouter lowest route, fee included | $0.041 / not listed / $1.32 | $3.46 | $8.07 | $20.26 |
| GLM-5.3, Hugging Face Wafer route | $0.07 / not listed / $1.40 | $4.20 | $11.20 | $29.40 |
| DeepSeek V4.1 Flash, DeepSeek API peak | $0.30 / $0.006 / $1.20 | $5.46 | $10.08 | $17.82 |
| Claude Sonnet 5.5, Anthropic API | $2 / $0.10 / $10 | $41.00 | $78.00 | $147.00 |
| Claude Opus 5.5, Anthropic API | $4 / $0.20 / $20 | $82.00 | $156.00 | $294.00 |
| Off Grid AI Boost | Flat plan, usage worth 2x the price | $4.99, $9.99 or $49.99 a month (cohort 1) |
How the long-session row works on DeepInfra’s 1017 build: 270M cache hits × $0.0029 = $0.78, plus 30M uncached × $0.098 = $2.94, plus 6M output × $0.294 = $1.76, for $5.49. Claude rows count cache reads only; Anthropic also charges 1.25x the input price for cache writes.
NanoGPT wins light editor work because its input price is the lowest. Once an agent resends the same context, DeepInfra’s cached price takes over. The full breakdown of why agents use so many input tokens is in how much an AI coding agent costs per month.
The cheapest setup for each tool
Cline
Cline takes any OpenAI-compatible host. In its settings, set API Provider to OpenAI Compatible, then fill in Base URL, API Key and Model, per Cline’s docs. You pay the host directly.
- Cheapest: DeepInfra’s DeepSeek-V4.1-Flash-1017.
- Cheaper for light use: NanoGPT.
- Step-by-step: DeepSeek and Qwen in Cline and Roo Code.
Claude Code
Claude Code talks the Anthropic API format, and the ANTHROPIC_BASE_URL variable points it somewhere else. DeepSeek publishes an Anthropic-format endpoint at https://api.deepseek.com/anthropic, so DeepSeek’s own API, off-peak at $0.15 / $0.60, is the direct cheap route.
Two things to know first. Anthropic’s gateway docs say it doesn’t support routing Claude Code to non-Claude models, so you’re on your own if something breaks. And while a gateway credential is active, your Claude subscription’s limits don’t apply and that traffic bills per token to whoever owns the key.
If you’d rather stay on Claude models, the subscription is far cheaper than the API. Claude Pro is $20 a month and Max is $100, both with Claude Code included and usage limits; Max gives five times Pro’s usage. The long-session month above costs $147 on Sonnet 5.5 API tokens.
Cursor
Cursor’s pricing page lists Free, Plus at $8, Premium at $30, Super at $100 and Ultra at $200 a month. Third-party models are billed at API list price from Premium up. Setting up DeepSeek in Cursor is covered in how to use DeepSeek in Cursor.
Where the expensive options win
Cheapest isn’t always best for code. Claude Sonnet 5.5 and Opus 5.5 cost 20 to 70 times more per token than DeepSeek V4.1 Flash on DeepInfra, and they can still earn it on hard refactors. You don’t have to pick one. Run routine agent steps on a cheap open model and switch to a premium model for the hard ones; in Cline that’s a change to the Model setting.
A flat bill for open-model coding
Per-token coding bills move with every busy week. Off Grid AI Boost charges one flat price: Starter $4.99, Pro $9.99 or Max $49.99 a month for cohort 1, half the regular $9.99, $19.99 and $99.99, held for as long as you stay. Each plan includes usage worth its full regular price every month, counted at each model’s token rate, with top-ups any time.
Boost runs DeepSeek V4.1 Flash, Qwen 3.8 and more, with one OpenAI-compatible key. In Cline that means the same three fields: Boost’s base URL, which comes with your key, your key and the model. We don’t keep your prompts or train on them, and the serving code will be open source.
Boost is a pre-order. Your API key arrives by email in January 2027 and your plan starts that day; if it misses January, you get all your money back. For coding today, use DeepInfra’s 1017 build in Cline, or DeepSeek’s own API in Claude Code.
Coding bill too high? Symptom, check, fix
| Symptom | Check | Fix |
|---|---|---|
| Input is almost all of your tokens | The agent resends files and history each step | Use a host with a cached-input price, such as DeepInfra or DeepSeek |
| Cline says the model isn’t found | The Model field must match the host’s model ID exactly | Copy the ID from the host’s model page |
| Claude Code still uses your Claude subscription | Only ANTHROPIC_BASE_URL is set |
Set the credential too, per Anthropic’s gateway docs |
| DeepSeek bills double on some days | Peak is 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays | Run long sessions off-peak, or use DeepInfra |
| Premium models eat the budget | Every step goes to Sonnet or Opus | Send routine steps to DeepSeek V4.1 Flash and keep Claude for hard ones |
| The bill is different every month | Per-token pricing | Move to a flat plan once spend passes its price |
More on API prices
- Every model and host in one place: the API price index.
- DeepSeek on every host: cheapest DeepSeek API.
- Fixed monthly plans compared: OpenRouter alternatives with a monthly subscription.
FAQ
What is the cheapest LLM API for coding? DeepSeek V4.1 Flash on DeepInfra’s 1017 build, at $0.098 per million input tokens, $0.0029 for cached input and $0.294 for output. Agent work repeats context, so the cheap cached price matters most. NanoGPT is slightly cheaper for light editor chat.
What is the cheapest API to use with Claude Code? Claude Code speaks the Anthropic API format. DeepSeek publishes an Anthropic-format endpoint at https://api.deepseek.com/anthropic, priced at $0.15 in and $0.60 out off-peak. Anthropic says it doesn’t support routing Claude Code to non-Claude models, so that setup is unsupported by Anthropic.
Can Cline use DeepSeek or Qwen? Yes. Set API Provider to OpenAI Compatible in Cline’s settings, then enter the host’s Base URL, your API Key and the Model. Any OpenAI-compatible host works, including DeepInfra, DeepSeek, NanoGPT and OpenRouter.
Is Claude cheaper through a subscription than the API for coding? Usually. Claude Pro is $20 a month and Max is $100, both with Claude Code included and usage limits. The same Claude Sonnet 5.5 tokens on the API cost $78 for a typical daily agent month in our example.