Best LLM for Coding: Models for Coding Agents
Start with the model each vendor recommends for coding, then move cheaper work to a smaller model wherever your own tests still pass.
A coding agent calls the model once per step, often hundreds of times per task, and resends the conversation each time. Price per token, cached-input price and the context window decide what a task costs. This page compares the current models from Anthropic, OpenAI and Google with the leading open-weight models. All figures come from each vendor's official model and pricing pages, checked on December 4, 2026.
Quick Answer
- Default for agentic coding: Claude Opus 5.5. Anthropic tells you to start with it for most workloads, and it is the
opusmodel in Claude Code. GPT-6.2 Sol is OpenAI's everyday coding model at half the price. - Hardest long-running tasks: Claude Fable 5.2 or GPT-6.2 Astra, both at $8 input and $40 output per million tokens. Gemini 4 Carbon is Google's pick for complex software engineering at $4 and $20.
- Subagents and bulk work: Claude Haiku 5.5 or GPT-6 Luna, both at $0.10 input and $0.50 output.
- Open weights: DeepSeek-V4-Pro-0813 under the MIT license, or GLM-5.3.
No single model wins every repository. Vendor benchmarks use different agent setups, so the last section shows how to test candidates on your own code.
Decision Table
Prices are standard API list prices in US dollars per million tokens, input then output, as of December 4, 2026.
| Model | Best for | Context window | Price in / out | Where it's available |
|---|---|---|---|---|
| Claude Fable 5.2 | Demanding reasoning and long-horizon agent work | 1M | $8 / $40 | Claude Code, Cursor, GitHub Copilot |
| Claude Opus 5.5 | Long-running agentic coding. Anthropic's default | 1M | $4 / $20 | Claude Code, Cursor, GitHub Copilot |
| Claude Sonnet 5.5 | Speed and intelligence at a lower price | 1M | $2 / $10 | Claude Code, Cursor, GitHub Copilot |
| Claude Haiku 5.5 | High-volume, latency-sensitive tasks | 1M | $0.10 / $0.50 | Claude Code, Cursor, GitHub Copilot |
| GPT-6.2 Astra | Complex reasoning and coding. OpenAI's flagship | 1.05M | $8 / $40 | Codex, Cursor, GitHub Copilot |
| GPT-6.2 Sol | Everyday coding and agents at scale | 1.05M | $2 / $10 | Codex, Cursor, GitHub Copilot |
| GPT-6 Luna | Focused, high-volume tasks | 1.05M | $0.10 / $0.50 | Codex, Cursor, GitHub Copilot |
| Gemini 4 Carbon | Complex software engineering | 1M | $4 / $20 | Cursor, GitHub Copilot |
| Gemini 4 Neon | Fast completion of complex software tasks | 1M | $3 / $15 | Cursor, GitHub Copilot |
| Gemini 4 Hydrogen | Everyday coding and agentic workflows | 1M | $1.50 / $7.50 | Cursor, GitHub Copilot |
| DeepSeek-V4-Pro-0813 | Open weights under MIT | 1M | $1.32 / $3.96 | DeepSeek API, Claude Code through its Anthropic-compatible API |
| DeepSeek-V4.1-Flash-1017 | Cheapest hosted open-weight option | 1M | $0.30 / $1.20 | DeepSeek API |
| GLM-5.3 | Open weights, Z.ai's coding model | 1M | $1.40 / $4.40 | Z.ai API |
The "Best for" column paraphrases each vendor's own description of the model. Claude Code runs Claude models only. Its opus, sonnet, haiku and fable aliases resolve to Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2 on the Anthropic API. Codex runs OpenAI models only. Cursor, which now goes by Grok Build, offers third-party models on its Premium plan and above at API list price. GitHub Copilot lists every closed model above as generally available, though an administrator must enable Fable 5.2.
Conditions Behind the Prices
Several prices change with prompt size. OpenAI bills a request above 272K input tokens at long-context rates: GPT-6.2 Astra rises to $16 and $60, and GPT-6.2 Sol to $4 and $15. Claude Haiku 5.5 costs $0.50 and $2.50 once a prompt passes 100,000 tokens. The other Claude models bill the full 1M window at the standard price. Google lists no prompt-size tiers for Gemini 4.
Codex uses a smaller window than the API by default: 272,000 tokens for GPT-6.2 Astra and 500,000 for GPT-6.2 Sol. Gemini 4 Argon is deprecated, and from December 15, 2026 its requests route to Carbon at Carbon's rates. DeepSeek prices above are peak rates, and off-peak rates are half.
Cached Input Decides the Bill
An agent's request repeats everything from earlier turns: the system prompt, tool definitions, files it read and its own past tool calls. Providers bill a repeated prefix at a cache rate far below the normal input price. On a long session the cached-input price matters as much as the headline input price.
| Model | Cached input per 1M tokens |
|---|---|
| Claude Fable 5.2 | $0.20 |
| Claude Opus 5.5 | $0.20 |
| Claude Sonnet 5.5 | $0.10 |
| Claude Haiku 5.5 | $0.01 |
| GPT-6.2 Astra | $0.40 |
| GPT-6.2 Sol | $0.10 |
| GPT-6 Luna | $0.01 |
| Gemini 4 Carbon | $0.20 |
| Gemini 4 Neon | $0.15 |
| Gemini 4 Hydrogen | $0.075 |
| DeepSeek-V4-Pro-0813 | $0.044 peak |
| GLM-5.3 | $0.26 |
Anthropic charges 1.25x the input price for a 5-minute cache write and 2x for a 1-hour write. Gemini 4 Carbon supports only implicit caching, so you cannot pin a prefix in the cache yourself.
How to Choose
Pick the coding tool first, because it limits the models you can run. If your team already uses Claude Code, the choice is between Claude tiers, and a subscription often costs less than the API. Claude Code pricing compares the plans. Codex works the same way for OpenAI models, and the Codex pricing guide covers ChatGPT plans against API billing. Cursor and GitHub Copilot let you switch vendors per task.
Then match the tier to the work:
- Hard, multi-hour tasks such as a cross-module refactor or a bug no one has pinned down: Claude Fable 5.2, GPT-6.2 Astra or Gemini 4 Carbon. Anthropic's docs tell you to move to Fable 5.2 only when evals on Opus 5.5 at higher effort still fall short.
- Everyday agent loops such as features, fixes and test writing: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2 Sol or Gemini 4 Hydrogen.
- Subagents for search, log summaries and simple edits: Claude Haiku 5.5, GPT-6 Luna or DeepSeek-V4.1-Flash-1017.
- Self-hosting or strict data control: an open-weight model whose license fits your business. Best Open-Weight Coding Models covers licenses and sizes for Kimi, Qwen, MiniMax and Mistral too.
Set reasoning effort explicitly, because defaults differ. Claude Fable 5.2 and Sonnet 5.5 default to high, while Opus 5.5 and Haiku 5.5 default to medium. Compare models at matched effort, or the cheaper model can look worse only because of its default.
Running several agents at once multiplies every price on this page. Best Parallel Agent Tools compares the tools that give each agent its own worktree. A cheaper model on most of those agents keeps the bill down.
Test on Your Own Code
Vendor benchmark tables use different agent setups and effort settings, so they do not rank models for your repository. Build a small eval instead: 20 to 50 closed issues from your own codebase, each with a test that fails before the fix. Run every candidate at matched effort and compare cost per passing task, not cost per token.
Sources
Checked December 4, 2026:
- Anthropic: models overview and pricing
- Claude Code: model configuration
- OpenAI: models, pricing and Codex models
- Google: Gemini models and Gemini pricing
- DeepSeek: pricing, Anthropic API guide and the DeepSeek-V4-Pro-0813 model card
- Z.ai: pricing, GLM-5.3 overview and the GLM-5.3 model card
- Cursor: models and pricing
- GitHub Copilot: supported models
Related Concepts
If you are new to agent workflows, start with what coding agents are and how quality gates decide whether an agent's change passes. Running coding agents in parallel multiplies model cost, so price per task matters more as you scale.
Next Steps
- Claude vs GPT for Coding: the two flagships side by side
- Claude vs Gemini for Coding: pricing, caching and output limits compared
- Best Open-Weight Coding Models: licenses, sizes and hosted prices
- Agent Orchestration: splitting work across a lead agent and cheaper subagents