NewKimi K3.1 Pro is now availableTry it now
GuidePublished 9 min read

DeepSeek V4.1 vs Kimi K3 vs GLM-5.3 for Coding Agents

Compare DeepSeek V4.1 Flash, Kimi K3.1 Pro, Kimi K3, and GLM-5.3 for coding agents with live pricing, 1M context, 40-turn cache math, and ZDR rules.

Inference.net

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 IDFamily hubContext / max outputFresh input ($/1M)Cached read ($/1M)Output ($/1M)Modalities & reasoning effortsHosting & ZDR scope
deepseek-v4.1-flash-1017DeepSeek1,040,000 / 393,216$0.08$0.007$0.635Text + image; none, low, high, maxInference.net-hosted (US, ZDR)
deepseek-v4.1-flashDeepSeek1,040,000 / 393,216$0.103$0.007$0.60Text + image; none, low, high, maxExternal route (upstream terms)
deepseek-v4-pro-0813DeepSeek1,048,576 / 131,072$1.32$0.044$3.96Text; low, high, maxExternal route (upstream terms)
glm-5.3-flashGLM1,048,576 / 262,144$0.10$0.03$0.35Text + image + video; low, high, maxInference.net-hosted (US, ZDR)
glm-5.3GLM1,048,576 / 943,718$0.084$0.079$3.00Text; low, high, maxInference.net-hosted (US, ZDR)
moonshotai/kimi-k3.1-proKimi1,048,576 / 1,048,576$1.80$0.198$9.00Text + image; none, low, high, maxInference.net-hosted (US, ZDR)
moonshotai/kimi-k3Kimi1,048,576 / 1,048,576$0.245$0.224$15.00Text + image; none, low, high, maxInference.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 (560K total input = 84K fresh + 476K cached reads at an 85% cache hit rate), and 900 average output tokens per turn (36K total output).
  • Monthly scale: 750,000 requests/month (18,750 coding sessions).
Model IDFresh input (84K)Cached read (476K)Output (36K)40-turn session (85% cache)Session without cacheCache savingsMonthly (750K reqs)
deepseek-v4.1-flash-1017$0.0067$0.0033$0.0229$0.0329$0.067751.4%$617.10
deepseek-v4.1-flash$0.0087$0.0033$0.0216$0.0336$0.079357.6%$629.70
glm-5.3-flash$0.0084$0.0143$0.0126$0.0353$0.068648.6%$661.50
glm-5.3$0.0071$0.0376$0.1080$0.1527$0.15501.5%$2,862.38
deepseek-v4-pro-0813$0.1109$0.0209$0.1426$0.2744$0.881868.9%$5,144.70
moonshotai/kimi-k3.1-pro$0.1512$0.0942$0.3240$0.5694$1.332057.2%$10,677.15
moonshotai/kimi-k3$0.0206$0.1066$0.5400$0.6672$0.67721.5%$12,510.08

Four numbers that change how you route agents

  1. DeepSeek V4.1 Flash 1017 and GLM-5.3 Flash trade blows under $0.04 per session: On a 40-turn session with 85% cache hits, deepseek-v4.1-flash-1017 ($0.0329) edges out glm-5.3-flash ($0.0353) because its cached input rate is 4.3x cheaper ($0.007 vs $0.03/1M). Flip to an output-heavy code-generation loop and glm-5.3-flash's $0.35/1M output rate overtakes DeepSeek's $0.635/1M.
  2. Output pricing dominates glm-5.3 and moonshotai/kimi-k3: On glm-5.3, $0.1080 of the $0.1527 session total (70.7%) comes from output tokens. On moonshotai/kimi-k3, $0.5400 of the $0.6672 total (80.9%) comes from output tokens.
  3. Kimi K3.1 Pro beats Kimi K3 on coding loops, while Kimi K3 wins single-turn repo reads: Caching cuts moonshotai/kimi-k3.1-pro session spend by 57.2% (from $1.3320 to $0.5694), beating moonshotai/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-1017 costs $0.0425, glm-5.3-flash costs $0.0514, glm-5.3 costs $0.0540, moonshotai/kimi-k3 costs $0.1825, and moonshotai/kimi-k3.1-pro costs $0.9360.
  4. 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-pro or glm-5.3 and 90% of turns (file reads, test iterations, diffs) to deepseek-v4.1-flash-1017 keeps blended spend close to $0.05 to $0.09 per 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:

CapabilityDeepSeek 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 mechanismAutomatic implicit prefix cacheAutomatic implicit prefix cacheExplicit prompt_cache_key required for cache affinity
Send prompt_cache_key?No (omit; routes may reject it)Not neededYes (pass a stable string per repo/session)
Cached read discount91.3% ($0.007 vs $0.08)89.0% on K3.1 Pro ($0.198 vs $1.80); 8.6% on K370.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 ceiling393,216 tokens1,048,576 tokens943,718 (glm-5.3) / 262,144 (glm-5.3-flash)
Native Anthropic /v1/messagesYesYesYes

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, and moonshotai/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 host https://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, and kimi-k2.5 route through external providers. They follow upstream provider retention policies rather than Inference.net-hosted ZDR and are not served on us.api.inference.net.
  • Ad-supported routes: Models with -with-ads suffixes (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-1017 when: You want the lowest-cost default for daily coding loops, subagents, autocomplete (reasoning_effort: "none"), and high-turn sessions where $0.007/1M automatic cached reads cut total spend in half without any client-side prompt_cache_key wiring.
  • Pick glm-5.3-flash when: 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 pass prompt_cache_key (such as Continue extraBodyProperties, LiteLLM, or custom Python/TS agents).
  • Pick glm-5.3 when: 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.1527 vs $0.5694), and you do not need image input or reasoning_effort: "none".
  • Pick moonshotai/kimi-k3.1-pro when: 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/messages support for hard architectural refactors.
  • Pick moonshotai/kimi-k3 when: Your workflow sends huge fresh codebases in 1 to 3 turns with short diagnostic outputs, where $0.245/1M fresh input beats moonshotai/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:

python
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 reading & models

Back to all guides