Quick verdict: which open-weight family fits your coding agent?
For multi-turn coding agents (Claude Code, Aider, Continue, Roo Code, Cline, Kilo Code, and OpenCode), deepseek-v4.1-flash-1017 is the lowest-cost default at $0.0329 per 40-turn cached session ($0.08 fresh input / $0.007 cached / $0.635 output per 1M tokens) with automatic prefix caching and reasoning_effort: "none" support. glm-5.3-flash ($0.0353 per cached session) is nearly tied on total spend while cutting output token pricing to $0.35/1M and adding video plus image input, and glm-5.3 ($0.1527 per session) brings a 943,718-token output ceiling for deep coding. moonshotai/kimi-k3.1-pro ($0.5694 per cached session) is the flagship Kimi pick for complex multi-file architecture and refactors, outperforming moonshotai/kimi-k3 ($0.6672) on multi-turn agent loops thanks to lower cached-read and output rates.
Live pricing, context, and capabilities comparison
Every model ID, context window, max output ceiling, modality, reasoning effort matrix, and per-1M-token rate below was verified directly from GET https://api.inference.net/v1/models on 2026-12-06 (multiply API per-token values by 1,000,000 for per-1M rates). All models in this table expose supports_tools: true and support OpenAI /v1/chat/completions, /v1/responses, and native Anthropic /v1/messages with one API key.
| Model ID | Family hub | Context / max output | Fresh input ($/1M) | Cached read ($/1M) | Output ($/1M) | Modalities & reasoning efforts | Hosting & ZDR scope |
|---|---|---|---|---|---|---|---|
deepseek-v4.1-flash-1017 | DeepSeek | 1,040,000 / 393,216 | $0.08 | $0.007 | $0.635 | Text + image; none, low, high, max | Inference.net-hosted (US, ZDR) |
deepseek-v4.1-flash | DeepSeek | 1,040,000 / 393,216 | $0.103 | $0.007 | $0.60 | Text + image; none, low, high, max | External route (upstream terms) |
deepseek-v4-pro-0813 | DeepSeek | 1,048,576 / 131,072 | $1.32 | $0.044 | $3.96 | Text; low, high, max | External route (upstream terms) |
glm-5.3-flash | GLM | 1,048,576 / 262,144 | $0.10 | $0.03 | $0.35 | Text + image + video; low, high, max | Inference.net-hosted (US, ZDR) |
glm-5.3 | GLM | 1,048,576 / 943,718 | $0.084 | $0.079 | $3.00 | Text; low, high, max | Inference.net-hosted (US, ZDR) |
moonshotai/kimi-k3.1-pro | Kimi | 1,048,576 / 1,048,576 | $1.80 | $0.198 | $9.00 | Text + image; none, low, high, max | Inference.net-hosted (US, ZDR) |
moonshotai/kimi-k3 | Kimi | 1,048,576 / 1,048,576 | $0.245 | $0.224 | $15.00 | Text + image; none, low, high, max | Inference.net-hosted (US, ZDR) |
Verify live rates at any time with curl -s https://api.inference.net/v1/models or browse head-to-head pages in the Comparison hub.
40-turn coding-agent cost math
Headline input rates can mislead coding-agent buyers because an agent replays your system prompt, tool definitions, and opened files dozens of times per task. Using our standard Coding Agent workload preset:
- Session shape: 40 turns per session, 14,000 average input tokens per turn (
560Ktotal input =84Kfresh +476Kcached reads at an 85% cache hit rate), and 900 average output tokens per turn (36Ktotal output). - Monthly scale: 750,000 requests/month (18,750 coding sessions).
| Model ID | Fresh input (84K) | Cached read (476K) | Output (36K) | 40-turn session (85% cache) | Session without cache | Cache savings | Monthly (750K reqs) |
|---|---|---|---|---|---|---|---|
deepseek-v4.1-flash-1017 | $0.0067 | $0.0033 | $0.0229 | $0.0329 | $0.0677 | 51.4% | $617.10 |
deepseek-v4.1-flash | $0.0087 | $0.0033 | $0.0216 | $0.0336 | $0.0793 | 57.6% | $629.70 |
glm-5.3-flash | $0.0084 | $0.0143 | $0.0126 | $0.0353 | $0.0686 | 48.6% | $661.50 |
glm-5.3 | $0.0071 | $0.0376 | $0.1080 | $0.1527 | $0.1550 | 1.5% | $2,862.38 |
deepseek-v4-pro-0813 | $0.1109 | $0.0209 | $0.1426 | $0.2744 | $0.8818 | 68.9% | $5,144.70 |
moonshotai/kimi-k3.1-pro | $0.1512 | $0.0942 | $0.3240 | $0.5694 | $1.3320 | 57.2% | $10,677.15 |
moonshotai/kimi-k3 | $0.0206 | $0.1066 | $0.5400 | $0.6672 | $0.6772 | 1.5% | $12,510.08 |
Four numbers that change how you route agents
- DeepSeek V4.1 Flash 1017 and GLM-5.3 Flash trade blows under
$0.04per session: On a 40-turn session with 85% cache hits,deepseek-v4.1-flash-1017($0.0329) edges outglm-5.3-flash($0.0353) because its cached input rate is 4.3x cheaper ($0.007vs$0.03/1M). Flip to an output-heavy code-generation loop andglm-5.3-flash's$0.35/1Moutput rate overtakes DeepSeek's$0.635/1M. - Output pricing dominates
glm-5.3andmoonshotai/kimi-k3: Onglm-5.3,$0.1080of the$0.1527session total (70.7%) comes from output tokens. Onmoonshotai/kimi-k3,$0.5400of the$0.6672total (80.9%) comes from output tokens. - Kimi K3.1 Pro beats Kimi K3 on coding loops, while Kimi K3 wins single-turn repo reads: Caching cuts
moonshotai/kimi-k3.1-prosession spend by 57.2% (from$1.3320to$0.5694), beatingmoonshotai/kimi-k3($0.6672) by 14.7%. On a single-turn 500K fresh input + 4K output repository audit with zero cache hits, the order flips:deepseek-v4.1-flash-1017costs$0.0425,glm-5.3-flashcosts$0.0514,glm-5.3costs$0.0540,moonshotai/kimi-k3costs$0.1825, andmoonshotai/kimi-k3.1-procosts$0.9360. - A two-tier Architect + Code split captures frontier planning at flash-tier unit economics: Routing 10% of turns (planning and architecture) to
moonshotai/kimi-k3.1-proorglm-5.3and 90% of turns (file reads, test iterations, diffs) todeepseek-v4.1-flash-1017keeps blended spend close to$0.05to$0.09per 40-turn session.
Model your exact prefix size, output ratio, and cache hit rate in the Prompt Cache Calculator or LLM Pricing Calculator.
Context, prompt caching, and reasoning differences
All three families provide 1M-class context windows (1,040,000 on DeepSeek V4.1 Flash; 1,048,576 on Kimi K3, Kimi K3.1 Pro, GLM-5.3, and GLM-5.3 Flash), but their caching contracts and reasoning controls differ in ways that directly affect agent configurations:
| Capability | DeepSeek V4.1 Flash (deepseek-v4.1-flash-1017) | Kimi K3 / K3.1 Pro (moonshotai/kimi-k3*) | GLM-5.3 / GLM-5.3 Flash (glm-5.3*) |
|---|---|---|---|
| Prompt caching mechanism | Automatic implicit prefix cache | Automatic implicit prefix cache | Explicit prompt_cache_key required for cache affinity |
Send prompt_cache_key? | No (omit; routes may reject it) | Not needed | Yes (pass a stable string per repo/session) |
| Cached read discount | 91.3% ($0.007 vs $0.08) | 89.0% on K3.1 Pro ($0.198 vs $1.80); 8.6% on K3 | 70.0% on Flash ($0.03 vs $0.10); 6.0% on 5.3 |
Disable thinking (reasoning_effort: "none") | Supported (none, low, high, max) | Supported (none, low, high, max) | Not supported (always-thinking: low, high, max) |
| Max output ceiling | 393,216 tokens | 1,048,576 tokens | 943,718 (glm-5.3) / 262,144 (glm-5.3-flash) |
Native Anthropic /v1/messages | Yes | Yes | Yes |
glm-5.3 and glm-5.3-flash rely on a stable prompt_cache_key string alongside byte-identical leading messages for cache affinity. deepseek-v4.1-flash-1017 and DeepSeek V4 Pro routes use implicit caching without a cache key and can reject requests containing prompt_cache_key. If one router or SDK calls multiple families, attach prompt_cache_key strictly on GLM (and OpenAI) requests.
Hosted vs. external Zero Data Retention (ZDR) scope
If your engineering organization enforces zero retention or US data residency on source code, verify the hosting scope of the exact model ID you configure:
- Inference.net-hosted US routes with default ZDR:
deepseek-v4.1-flash-1017,glm-5.3,glm-5.3-flash,moonshotai/kimi-k3,moonshotai/kimi-k3-fast,moonshotai/kimi-k3.1-pro, andmoonshotai/kimi-k3.1-pro-fast. New accounts start with Zero Data Retention enabled under SOC 2 Type II controls, and all seven routes accept traffic on the US-only hosthttps://us.api.inference.net/v1. - Externally routed models (upstream retention terms):
deepseek-v4.1-flash(without-1017),deepseek-v4-pro,deepseek-v4-pro-0813,glm-5.2,glm-5.2-fast,glm-5,kimi-k2.6, andkimi-k2.5route through external providers. They follow upstream provider retention policies rather than Inference.net-hosted ZDR and are not served onus.api.inference.net. - Ad-supported routes: Models with
-with-adssuffixes (deepseek-v4.1-flash-with-ads,glm-5.3-with-ads,moonshotai/kimi-k3.1-pro-with-ads) share sampled request and response payloads with our advertising partner regardless of your team's ZDR setting. Use the standard hosted model IDs for private repositories.
See Data retention for full policy details.
When to pick each model
- Pick
deepseek-v4.1-flash-1017when: You want the lowest-cost default for daily coding loops, subagents, autocomplete (reasoning_effort: "none"), and high-turn sessions where$0.007/1Mautomatic cached reads cut total spend in half without any client-sideprompt_cache_keywiring. - Pick
glm-5.3-flashwhen: Your agent writes large diffs or boilerplate (lowest output rate at$0.35/1M), inspects UI screenshots or screen recordings (image+video), and your client can passprompt_cache_key(such as ContinueextraBodyProperties, LiteLLM, or custom Python/TS agents). - Pick
glm-5.3when: You need stronger reasoning and massive single-pass code or spec generation (up to 943,718 output tokens) at 3.7x lower session cost than Kimi K3.1 Pro ($0.1527vs$0.5694), and you do not need image input orreasoning_effort: "none". - Pick
moonshotai/kimi-k3.1-prowhen: You want a high-capability 1M-context flagship with 1M max output, vision, automatic implicit prefix caching (89.0% cached-read discount), and native Claude Code/v1/messagessupport for hard architectural refactors. - Pick
moonshotai/kimi-k3when: Your workflow sends huge fresh codebases in 1 to 3 turns with short diagnostic outputs, where$0.245/1Mfresh input beatsmoonshotai/kimi-k3.1-pro($1.80/1M) by more than 5x per request.
Routing all three families cleanly in one Python helper
This snippet shows how to call DeepSeek, Kimi, and GLM over one Inference.net API key while applying prompt_cache_key only to GLM routes and checking cached token reads on every response:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://us.api.inference.net/v1",
api_key=os.environ["INFERENCE_API_KEY"],
)
def call_coding_model(
model: str,
system_prompt: str,
user_prompt: str,
repo_key: str = "monorepo-backend-v1",
) -> str:
extra_body: dict[str, object] = {}
# Pass prompt_cache_key only on GLM routes; omit on DeepSeek V4.1 Flash and Kimi K3.
if model.startswith("glm-"):
extra_body["prompt_cache_key"] = repo_key
stream = client.chat.completions.create(
model=model,
stream=True,
stream_options={"include_usage": True},
extra_body=extra_body or None,
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt},
],
)
chunks: list[str] = []
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
chunks.append(chunk.choices[0].delta.content)
if chunk.usage:
cached = getattr(chunk.usage.prompt_tokens_details, "cached_tokens", 0) or 0
print(
f"[{model}] prompt={chunk.usage.prompt_tokens} "
f"cached={cached} output={chunk.usage.completion_tokens}"
)
return "".join(chunks)To wire these models directly into your editor or terminal agent, see the setup guides for Claude Code, Aider, Continue, Roo Code, Kilo Code, Cline, and OpenCode.
Frequently asked questions
Which model is cheapest for a 40-turn coding-agent session?
At an 85% prompt cache hit rate (560K input, 36K output), deepseek-v4.1-flash-1017 is the lowest-cost hosted model at $0.0329 per session ($617.10/month at 750K requests), closely followed by glm-5.3-flash at $0.0353 per session ($661.50/month).
Can I run all three families inside Claude Code?
Yes. deepseek-v4.1-flash-1017, glm-5.3, glm-5.3-flash, moonshotai/kimi-k3, and moonshotai/kimi-k3.1-pro all support Inference.net's native Anthropic POST /v1/messages endpoint. You can map moonshotai/kimi-k3.1-pro or glm-5.3 to --opus / --main and deepseek-v4.1-flash-1017 to --haiku / --subagents in Claude Code.
Why does glm-5.3 need prompt_cache_key while DeepSeek V4.1 Flash does not?
GLM routes (glm-5.3, glm-5.3-flash, glm-5.2) use prompt_cache_key as a routing-affinity hint paired with byte-identical leading messages. DeepSeek V4.1 Flash and Kimi K3 / K3.1 Pro perform implicit prefix caching automatically with no key, and DeepSeek V4.1 Flash routes can reject requests that send prompt_cache_key.
Do deepseek-v4.1-flash and deepseek-v4.1-flash-1017 have the same ZDR coverage?
No. deepseek-v4.1-flash-1017 runs on Inference.net-hosted US infrastructure with default Zero Data Retention and supports https://us.api.inference.net/v1. Standard deepseek-v4.1-flash routes through an external provider under upstream retention terms.
Related resources
- Model family hubs: DeepSeek API · Kimi API · GLM API · Full Model Catalog
- Head-to-head comparisons: All Comparisons · Kimi K3 vs DeepSeek V4.1 Flash · Kimi K3 vs GLM-5.3 · DeepSeek V4.1 Flash vs GLM-5.3 Flash · GLM-5.3 vs GLM-5.3 Flash
- Calculators & pricing guides: Prompt Cache Calculator · LLM Pricing Calculator · DeepSeek API Pricing · Kimi K3 Pricing · GLM-5 Pricing
- Coding agent setups: Claude Code · Aider · Continue · Roo Code · Kilo Code · OpenCode
Run DeepSeek V4.1, Kimi K3.1 Pro, and GLM-5.3 with one API key
Create a free Inference.net account to call all three open-weight coding families over OpenAI and native Anthropic /v1/messages with 1M context, prompt caching, and hosted US Zero Data Retention.
Create API key