If you’re optimizing purely for cost, 2026 is a great year — a cluster of capable models compete to be the cheapest way to drive a coding agent. But “cheapest” splits three ways: lowest pay-per-token rate, lowest flat plan, and best price once context/caching are included. This compares the main options with the actual rates you need before spending money.
For setup, follow the per-model guides linked throughout. For the billing-model decision, see coding plans vs pay-per-token.
The price snapshot below was checked against official provider pages on June 9, 2026.
The contenders
Cheapest coding API snapshot
| DeepSeek V4 Flash | $0.0028 hit / $0.14 miss / $0.28 output per 1M; 1M context; Anthropic endpoint |
|---|---|
| Xiaomi MiMo V2.5 | $0.0028 hit / $0.14 miss / $0.28 output per 1M overseas PAYG |
| Z.AI GLM | GLM-4.7-Flash and GLM-4.5-Flash listed free; FlashX $0.07 input / $0.01 cached / $0.40 output |
| Alibaba Qwen Flash | qwen3.5-flash International $0.10 input / $0.40 output per 1M up to 1M tokens |
| MiniMax M3 | $0.30 input / $1.20 output / $0.06 cache read per 1M up to 512K |
| Kimi K2.5 / K2.6 | K2.5 is $0.10 hit / $0.60 miss / $3.00 output; K2.6 is $0.16 / $0.95 / $4.00 |
| OpenRouter | Free or cheap routed models; convenient but availability changes |
Direct pricing links
Pricing links
Where to verify the cheapest routes
7 providers
DeepSeek
deepseek-v4-flash is $0.0028 cache-hit input, $0.14 cache-miss input, and $0.28 output per 1M tokens. deepseek-v4-pro is $0.003625 / $0.435 / $0.87, with 1M context and an Anthropic-format endpoint.
Official page
Why it is on the list: It is the cleanest cheap direct route for Claude Code-style tools because the Anthropic endpoint avoids an extra proxy.
Z.AI GLM
GLM-4.7-Flash and GLM-4.5-Flash are listed free. GLM-4.7-FlashX is $0.07 input, $0.01 cached input, and $0.40 output per 1M. GLM-5.1 is $1.40 / $0.26 / $4.40.
Official page
Why it is on the list: It is on the list because it combines free/very cheap Flash rows with the GLM Coding Plan for heavier coding-tool use.
Alibaba Qwen
qwen3.5-flash International is $0.10 input and $0.40 output per 1M up to 1M tokens. The Coding Plan Pro is $50/month with 6,000 requests per 5 hours, 45,000/week, and 90,000/month.
Official page
Why it is on the list: It belongs because Qwen Flash is cheap as API usage, while the coding plan is a serious flat-rate route for heavy Qwen-Coder workflows.
MiniMax
MiniMax-M3 standard PAYG is $0.30 input, $1.20 output, and $0.06 cache read per 1M tokens up to 512K input. Token Plan tiers are $20, $50, and $120/month.
Official page
Why it is on the list: It fits agent-heavy workflows where MiniMax is already the model you prefer and a token plan may beat pure metered usage.
Kimi / Moonshot
kimi-k2.5 is $0.10 cache-hit input, $0.60 cache-miss input, and $3.00 output per 1M. kimi-k2.6 is $0.16 / $0.95 / $4.00, with a 262,144-token context window.
Official page
Why it is on the list: It is not the cheapest baseline, but it is a strong reasoning PAYG option when harder agent tasks justify the higher output rate.
Xiaomi MiMo
mimo-v2.5 overseas PAYG is $0.0028 cache-hit input, $0.14 cache-miss input, and $0.28 output per 1M. mimo-v2.5-pro is $0.0036 / $0.435 / $0.87.
Official page
Why it is on the list: It now sits in the same ultra-low price band as DeepSeek Flash while also offering token-plan discounts for heavier usage.
OpenRouter
Free and ultra-cheap routed models, with availability and rate-limit caveats.
Official page
Why it is on the list: It is the easiest place to find no-cash backup models or cheap routes while you compare direct providers.
Cheapest pay-per-token
For pure pay-per-token cost, DeepSeek V4 Flash and Xiaomi MiMo V2.5 are the lowest rows in this snapshot: $0.0028 cache-hit input, $0.14 cache-miss input, and $0.28 output per 1M tokens. DeepSeek has the simpler Claude Code path because it publishes an Anthropic-compatible base URL. MiMo is equally low on the listed overseas PAYG rates and also has an Anthropic API page for tool integrations.
For hosted free or nearly free rows, Z.AI is the next stop: GLM-4.7-Flash and GLM-4.5-Flash are listed free, and GLM-4.7-FlashX is $0.07 input / $0.01 cached input / $0.40 output per 1M. For Qwen, Alibaba’s qwen3.5-flash International row is $0.10 input / $0.40 output per 1M up to 1M tokens.
- DeepSeek: pricing explained
- MiMo: pricing and free tiers
- MiniMax: M2 + OpenCode
- Kimi: pricing explained
Cheapest flat-rate
For heavy daily use, a flat or quota plan can beat metered tokens. GLM’s Coding Plan starts at $18/month and is the cheapest subscription entry here. Alibaba’s Coding Plan Pro is $50/month with 6,000 requests per 5 hours, 45,000 per week, and 90,000 per month. MiniMax Token Plan gives another quota route at $20 / $50 / $120 per month.
That makes the order simple: use PAYG while your usage is light, move to GLM when you want the lowest flat plan, and compare Alibaba or MiniMax when you are making heavy daily agent calls. See GLM Coding Plan setup and Alibaba Coding Plan vs pay-per-token.
Cheapest for big context
If you feed large chunks of a repo into the model, watch four details, not just the headline rate: context length, cache-hit price, output price, and whether a token plan resets or throttles. DeepSeek lists 1M context plus very low cache-hit pricing. Kimi lists 262,144-token context on K2.5 and K2.6, but higher output prices. MiMo’s V2.5 PAYG rates match DeepSeek’s low price band, while its token-plan page advertises off-peak and renewal discounts.
The levers that cut any bill
Whatever you pick, these keep costs at the floor:
- Default cheap, escalate rarely — use the cheapest model for everyday work; reserve a stronger one for hard tasks.
- Exploit cache discounts — agent sessions resend context; cache hits cut that automatically.
- Use off-peak windows — MiMo advertises 20% off off-peak token-plan calls, and Z.AI charges advanced GLM models differently in peak and off-peak windows.
- Keep prompts focused — output tokens cost more than input; concise requests cost less.
- Route by task — Claude Code Router sends background work to the cheapest model and hard work to a stronger one.
The bottom line
- Lowest cost, light use: Start with DeepSeek V4 Flash or MiMo V2.5 PAYG.
- Lowest cost, free hosted rows: Check Z.AI’s GLM Flash rows and OpenRouter’s free-model filter.
- Lowest cost, heavy use: Compare GLM Coding Plan, Alibaba Coding Plan, and MiniMax Token Plan.
- Lowest cost, big context: Compare DeepSeek cache/context, Kimi variant pricing, Qwen context pricing, and MiMo token-plan math.
- Lowest cost, free/backup: Check OpenRouter’s free-model filter.
A safe default for most people: DeepSeek pay-per-token, switching to a plan only once usage is consistently heavy enough to justify it.
Getting the cheapest setup
- Estimate your monthly token volume
- Light/bursty → DeepSeek or MiMo PAYG first
- Heavy/daily → compare GLM, Alibaba, and MiniMax plans
- Big context → compare cache/context/plan math, not just headline rate
- Open the official pricing page before buying credits or subscribing
Wrapping up
The cheapest AI coding API in 2026 depends on how you pay. DeepSeek V4 Flash and MiMo V2.5 are the lowest PAYG baselines in this snapshot; Z.AI has free and very cheap Flash rows; GLM and Alibaba are the first coding-plan routes to compare; MiniMax and Kimi can make sense depending on agent workload, context, caching, and output volume. Across all of them, defaulting to a cheap model, exploiting discounts, and routing by task keep your bill at the floor.
For the decision framework, see coding plans vs pay-per-token; for the model head-to-head, MiniMax vs DeepSeek vs GLM.