Best LLM API for Coding Agents by Workload (November 2026): Cost per Task, Speed and When to Tier
Pick by workload. Opus 5.5 or GPT-6.2 Sol for hard multi-file work, DeepSeek V4 Pro or GLM-5.2 for routine edits, gpt-oss-120b on Cerebras or Groq for inner loops, and off-peak or batch rates for high-volume runs.
There is no single best LLM API for coding agents on both cost and speed; the right choice depends on the workload. As of November 17, 2026, hard multi-file work belongs on Claude Opus 5.5 ($4 / $20 per million tokens) or OpenAI's GPT-6.2 Sol ($2 / $10). Routine edits run for a fraction of that on DeepSeek V4 Pro ($1.32 / $3.96 at peak, half off-peak) or Z.ai's GLM-5.2 ($1.40 / $4.40), and latency-bound inner loops suit gpt-oss-120b on Cerebras (about 3,000 tokens per second) or Groq (500). With any of them, prompt caching changes the bill more than the choice of model, and each switch between models restarts the cache.
The one number to compare
Compare cost per solved task, not price per token. An agent re-sends its whole context on every turn. Claude Code's documentation lists the system prompt, project context and "every prior message and tool result" going out each time. So a 40-turn task with a 50,000-token context bills about 2 million input tokens, while the model writes perhaps 30,000.
Databricks showed what that does to rankings in a benchmark on its own codebase, published July 8, 2026. Sonnet 5 was about 1.7 times cheaper per token than Opus 4.8, but cost $2.09 per task against $1.94 because it used 1.9 times as many tokens, and it completed 81% of tasks to Opus's 87%. GLM 5.2 was "statistically tied with Opus 4.8 on quality" at $1.28 per task. Those models are now a generation old, and Databricks does not give time per task in its text, but the lesson holds: the model that reads less and fails less is often the cheaper one.
Options by workload
| Workload | First choice | Alternative | List price, in / out per 1M |
|---|---|---|---|
| Hard multi-file work | Claude Opus 5.5 | GPT-6.2 Sol | $4 / $20; $2 / $10 |
| Routine edits | DeepSeek V4 Pro | GLM-5.2 | $1.32 / $3.96 peak; $1.40 / $4.40 |
| Latency-bound inner loops | gpt-oss-120b on Cerebras | gpt-oss-120b on Groq | $0.35 / $0.75; $0.15 / $0.60 |
| High-volume repeated runs | DeepSeek V4 Pro off-peak | Anthropic Batch API | $0.66 / $1.98; 50% off list |
Prices are as each provider's own pricing page lists them on November 17, 2026.
Hard multi-file work
This is where pass rate dominates, because a failed attempt costs the tokens plus an engineer's review. Anthropic describes Opus 5.5 as built "for long-running agentic coding" and tells unsure buyers to "start with Claude Opus 5.5 for most workloads." OpenAI calls GPT-6.2 Sol its "go-to model for everyday work, from coding to powering agents at scale," and reserves GPT-6.2 Astra ($8 / $40) for its "hardest projects." Both labs discount cached input steeply: $0.20 per million on Opus 5.5 and $0.10 on GPT-6.2 Sol. Claude Code's own guidance is that Sonnet "handles most coding tasks well and costs less than Opus," with Opus kept for "complex architectural decisions or multi-step reasoning." Sonnet 5.5 lists at $2 / $10, the same as GPT-6.2 Sol. Google's Gemini 4 Argon also lists at $2 / $10 today, but its AI Studio pricing page says input, output and caching prices double to $4 / $20 on December 1, 2026, which puts it level with Opus 5.5 on list price.
Routine edits
For well-specified edits, renames, test fixes and boilerplate, a cheaper model is usually enough. DeepSeek V4 Pro is the cheapest of the routine-edit options here, with caching on by default and a peak cache-hit rate of $0.044 per million. Its peak hours are 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays. GLM-5.2 is the model Databricks found statistically tied with Opus 4.8 on quality on its own tasks. Z.ai's own claim is that it delivers "state-of-the-art long-horizon coding performance among open-source models." Its cached rate of $0.26 is a smaller discount than its rivals', so its advantage shrinks in long agent sessions.
Latency-bound inner loops
Fast hosts matter for many short calls, such as file search, small edits and test triage, where waiting adds up. Cerebras lists gpt-oss-120b at about 3,000 tokens per second, with a 131,000-token context on paid plans. Groq lists it at 500 tokens per second, and gpt-oss-20b at 1,000. Neither lists a Kimi model, and Kimi plans to retire its K2 series by the end of December 2026. If you need frontier quality at speed, Anthropic's fast mode offers "up to 2.5x higher output tokens per second" on Opus 5.5 at double the price, $8 / $40. OpenAI's fast mode on GPT-6.2 Sol costs $4 / $20. Tokens-per-second figures cover generation only, and wall-clock time per solved task across these hosts has not been measured in any published comparison.
High-volume repeated agent tasks
CI bots, migration sweeps and nightly triage can wait for cheaper capacity. DeepSeek's off-peak rates are half of peak: V4 Pro at $0.66 input, $1.98 output and $0.022 for a cache hit. Anthropic's Batch API takes 50% off input and output and stacks with cache discounts, although its fast mode cannot be combined with batch. For a fleet of agents sharing the same system prompt and tools, keep those prefixes identical. Anthropic's docs say cache hits need "100 percent identical prompt segments," and changing tool definitions "invalidates the entire cache."
Worked example: one task, five setups
The assumptions below are illustrative, not measured. A 40-turn agent task has an average context of 50,000 tokens, so 2 million input tokens in all. With caching on, 95% of input is read from cache and 5% is new content written to it. The model produces 750 output tokens per turn, 30,000 in all, thinking included. Cache writes are billed at Anthropic's published five-minute rate (1.25 times input) and at OpenAI's rate for its default 30-minute cache (also 1.25 times). On DeepSeek and Z.ai, new tokens bill at the uncached input rate.
- Opus 5.5 alone: 1.9M cache reads × $0.20 = $0.38; 0.1M writes × $5 = $0.50; 30K output × $20 = $0.60. Total $1.48 per attempt (uncached: $8.60).
- GPT-6.2 Sol alone: $0.19 + $0.25 + $0.30 = $0.74 (uncached: $4.30).
- DeepSeek V4 Pro alone, peak: $0.08 + $0.13 + $0.12 = $0.33 (off-peak: $0.17).
- Tiered, three switches: Opus for eight turns (planning, then one hard edit mid-task), DeepSeek for 32, switching Opus to DeepSeek, back to Opus and back to DeepSeek. Opus turns cost about $0.037 each ($0.30) and DeepSeek turns about $0.0084 ($0.27). After each switch the new model processes the full 50,000-token context with no cache hits (on Opus it is written to cache at $5 per million), about $0.23 extra on Opus and $0.06 on DeepSeek, so $0.35 for three. Total about $0.91, with 38% of it spent on switching.
- Tiered, one switch: Opus plans, DeepSeek finishes. $0.30 + $0.27 + $0.06 = about $0.62.
Two conclusions follow. Caching matters more than model choice: it cuts the frontier bills by more than 80%, and once it is on, output becomes a large share of what is left ($0.60 of Opus 5.5's $1.48). Tiering saves money only when switches are rare, because Claude Code's docs say "each model has its own cache" and a switch "reads the entire conversation history with no cache hits." No provider describes moving a cache between models.
Divide by pass rate to get cost per solved task. Taking Databricks' 87% for Opus 4.8 as a stand-in, Opus 5.5's $1.48 becomes $1.70 per solved task. At $0.33 an attempt, DeepSeek would have to solve only about one task in five to match it on API spend, before counting review time. Whether a tiered setup keeps the frontier model's pass rate has not been measured in any published benchmark.
Reducing context
Pruning shrinks what caching discounts. Databricks found that changing only the harness changed cost per task "more than 2x in some cases, while quality remained the same," and its Pi harness sent about three times less context per turn. Claude Code's docs recommend clearing between unrelated tasks, delegating verbose test and log work to subagents, and filtering tool output with hooks. Compaction rewrites history, so it rebuilds the cache once.
Parsec offers a context-trimming layer for Claude Code, Codex and opencode, free to start according to its site. In Parsec's own SWE-bench Verified benchmark (100 tasks, Claude Sonnet 4.6, only the trimming layer changed), total cost fell from $147.30 to $89.65. Parsec ran that test itself; the benchmark repo can be re-run, and no independent re-run has been published. Parsec also markets per-turn routing, and its routers page says a shared K/V cache avoids losing the cache when switching models. That page does not name the models it routes to and gives no price.
How to test before you buy
Pick 20 to 50 recent, test-backed tasks from your own repository. Strip the solution from each prompt, as Databricks did, and cut the agent off from git history. Grade with your tests, not a model. Run two or three candidates through your actual harness and record cache reads, cache writes, output tokens, pass rate and wall-clock time. SWE-bench Verified's 500 human-validated tasks, graded in Docker, are a public cross-check, but your own repository is the better guide.
Bottom line
For hard multi-file work, choose Claude Opus 5.5, or GPT-6.2 Sol at half Opus 5.5's list price. For routine edits, choose DeepSeek V4 Pro, off-peak where you can, or GLM-5.2. For inner loops where latency dominates, run gpt-oss-120b on Cerebras or Groq. For high-volume runs that can wait, use off-peak or batch pricing. If you tier, switch models at phase boundaries rather than per turn, and keep caching on everywhere.
Sources
- Anthropic, Pricing: https://platform.claude.com/docs/en/about-claude/pricing
- Anthropic, Models overview: https://platform.claude.com/docs/en/about-claude/models/overview
- Anthropic, Prompt caching: https://platform.claude.com/docs/en/build-with-claude/prompt-caching
- Claude Code, How Claude Code uses prompt caching: https://code.claude.com/docs/en/prompt-caching
- Claude Code, Manage costs effectively: https://code.claude.com/docs/en/costs
- OpenAI, API pricing: https://developers.openai.com/api/docs/pricing
- OpenAI, Models: https://developers.openai.com/api/docs/models
- Google AI Studio, Gemini API pricing: https://aistudio.google.com/docs/pricing
- OpenAI, Prompt caching: https://developers.openai.com/api/docs/guides/prompt-caching
- DeepSeek, Models and pricing: https://api-docs.deepseek.com/quick_start/pricing
- DeepSeek, Context caching: https://api-docs.deepseek.com/guides/kv_cache
- Z.ai, Pricing: https://docs.z.ai/guides/overview/pricing
- Z.ai, GLM-5.2: https://docs.z.ai/guides/llm/glm-5.2
- Cerebras, OpenAI GPT OSS model page: https://inference-docs.cerebras.ai/models/openai-oss
- Groq, Supported models: https://console.groq.com/docs/models
- Kimi, Model inference pricing: https://platform.kimi.ai/docs/pricing/chat
- Databricks, Benchmarking Coding Agents on Databricks' Multi-Million Line Codebase: https://www.databricks.com/blog/benchmarking-coding-agents-databricks-multi-million-line-codebase
- SWE-bench, GitHub repository: https://github.com/SWE-bench/SWE-bench
- Parsec, Parsec for coding agents: https://parseclab.ai/parsec/
- Parsec, Code compression benchmark: https://github.com/daseinlabs/code-compression-bench
- Parsec vs routers: https://parseclab.ai/compare/routers/