Which model should I use for a coding agent?
Start with the cheapest model that passes your evals, and escalate individual tasks rather than the whole workload. Coding agents spend most of their tokens on reading files, tool results and retries — work where a frontier model buys you very little — so the model choice that matters is per step, not per project.
What agent loops actually spend
A coding agent’s token bill is dominated by input: the system prompt, the files it opened, the output of every tool call, and the whole conversation resent on each turn. The generated code is a small fraction. That is why a model’s input price and its ability to follow a tool protocol matter more than its score on a reasoning benchmark.
A workable split
- Bulk steps — reading, searching, summarising, routine edits: the cheapest model that holds the tool protocol. On our catalogue that is DeepSeek-V4-Flash, which does tool calls and costs about a third of MiniMax-M2.7.
- Hard steps — a design decision, a stubborn bug, an unfamiliar codebase: a stronger model, invoked deliberately. MiniMax-M2.7 here.
- Anything unattended: whatever you have measured, on an account with failover. An overnight run that dies at 3am on a saturated free network costs more than the model ever did.
Published scores, with the caveat
| Model | Benchmark | Score | Source |
|---|---|---|---|
| DeepSeek V4 Flash | Terminal-Bench 2.1 | 82.7 | DeepSeek model card |
| MiniMax M2.7 | SWE-bench Pro | 56.2 | MiniMax model card |
Those numbers come from two vendors running their own harnesses on different benchmarks. They are separate claims, not one comparison — useful for ruling models out, not for ranking them. Your own repository is the only benchmark that decides this.
How to actually decide
- 1.Take ten tasks you have already done, where you know what good looks like.
- 2.Run them on the cheap model. Count how many need a second attempt.
- 3.Run the failures on the expensive one. If it does not fix them either, the problem is the prompt or the harness, not the model.
- 4.Price the mix, not the model. A cheap model that retries once is still usually cheaper than a frontier model that does not.
FAQ
▸Is an open-weight model good enough for real coding work?
On published benchmarks the gap to frontier models is small — DeepSeek V4 Flash reports 82.7 on Terminal-Bench 2.1 against 85.0 for Claude Opus 4.8, under the like-for-like harness DeepSeek publishes. The gap that remains is on the hardest repo-scale tasks. For agent loops, which are mostly mechanical, the trade is usually worth it.
▸Can I switch models per request?
Yes — the model id is a per-request field, so an agent can escalate mid-run. Most tools expose this as a "model for this task" setting.
▸Which model works in Cursor / Cline / Aider?
All of them: those tools take an OpenAI-compatible base URL and pass the model id straight through. The setup guides have the exact fields for each.