Skip to content

Use case

The best API for coding agents

For coding agents the deciding cost is cached input, not output: an agent resends the same system prompt, tool schema and file context on every step, so a model with a cheap cached-input rate can cost several times less than a nominally cheaper one without it. GLM-5.2 at $0.82 per million input and $0.16 cached is the strongest fit in this catalogue.

A coding agent is a loop, not a conversation. Each step resends the system prompt, the tool definitions and a slab of file context, then asks for a small diff. The input-to-output ratio is often 50:1 or worse, which inverts the usual pricing intuition — output rate barely matters and input rate is almost the whole bill.

That is why cached-input pricing decides this workload. The repeated prefix is served from the model's KV cache at a fraction of the standard input rate, and for an agent that prefix is most of every request. A model with no published cached rate is not cheaper; it is a model whose largest line item is unpriced.

What actually matters here

Cached-input rate
The agent's repeated prefix is the bulk of its tokens. This number, not the headline input rate, is what the monthly bill is mostly made of.
Context window
Enough room for the system prompt, tool schemas and several files at once. Running out mid-task forces re-planning, which costs a full round trip.
Tool-calling reliability
An agent that returns malformed tool calls burns a retry every time. That failure is invisible in a price comparison and expensive in production.
Licence
Agents get embedded in products that ship. A permissive licence removes a question legal will otherwise ask late.

What it costs, at a working agent, ~2,000 steps/month

Worked from this catalogue’s published rates at 400M input and 8M output tokens a month. Your figure will differ; the arithmetic will not.

ModelInputOutputPer monthAt official rates
GLM-5.242%$0.82/M$2.55/M$348.40$595.20
Kimi K340%$1.85/M$9.00/M$812.00$1,320.00
DeepSeek V4 Pro37%$0.28/M$0.55/M$116.40$180.96

Excludes cached-input savings, which on a repeated-prefix workload typically reduce the input column substantially. Cached rates are published per model on the pricing page.

Questions

Does cached input really change the total that much?
On an agent workload it is usually the largest single factor. If 80% of your input is a repeated prefix billed at roughly a fifth of the standard rate, the effective input cost falls by about two thirds — a bigger swing than the difference between most models' headline rates.
Can I pin an agent to one model?
Yes. Send the exact model id and no substitution happens. Fallback only applies if you ask for it, which matters for an agent whose prompts were tuned against one model's behaviour.