Routing / Sep 1, 2026

DeepSeek GLM Kimi Fallback Matrix for Production Agents

Build a production-agent fallback matrix across DeepSeek, GLM, and Kimi with dated prices, semantic-risk checks, cache behavior, and rollback rules.

Keyword report: 2026-08-31Tier 1/2 developer focusSources checked Sep 1, 2026

This guide uses source checks from Sep 1, 2026. Provider and gateway prices can change; preserve the checked date with every forecast.

Why This Topic Matters Now

The Aug 31 keyword report includes a compact but telling model-family signal: `glm deepseek kimi` and `deepseek vs glm vs kimi`. Searchers using those phrases are not asking for a launch announcement. They are deciding how to route production agents when one model is strong at planning, another is strong at execution, and another may carry long context or different tool behavior.

This article is written for Tier 1 and Tier 2 platform engineers building coding agents, support copilots, RAG workflows, or internal automation. It uses AIWave live prices checked on Sep 1, 2026 and current provider docs checked the same day. The goal is a fallback matrix that prevents silent behavior drift while still giving the team a practical way to survive capacity errors, context overflows, and model-specific failures.

Source Facts Checked Today

AIWave /api/pricing checked on Sep 1, 2026 returned success=true, 63 records, pricing_version a42d372ccf0b5dd13ecf71203521f9d2, default group ratio 3, and VIP group ratio 1. Parsed gateway examples before account-group math included DeepSeek V4 Pro at $1.914 input, $5.742 output, and $0.063736 cache-hit input per 1M tokens; DeepSeek V4 Flash at $0.638 input, $1.914 output, and $0.020288 cache-hit input; GLM-5.1 at $2.10 input, $6.60 output, and about $0.680001 cache-hit input; and Kimi K3 at $4.50 input, $22.50 output, and $0.90 cache-hit input.

DeepSeek pricing checked on Sep 1, 2026 lists V4 Flash and V4 Pro with OpenAI-format base URL support, 1M context, 384K maximum output, cache-hit input, cache-miss input, output billing, and concurrency limits of 2500 for Flash and 500 for Pro. Z.AI pricing checked today lists GLM-5.3 and GLM-5.2 at $1.40 input, $0.26 cached input, and $4.40 output, plus tool and media rows. Kimi's billing guide checked today describes token billing, web-search add-on billing at CNY 0.03 per call, and context caching for repeated prompts and reference documents.

Those facts create a practical routing problem. A DeepSeek fallback to GLM or Kimi is not just a price change. It can change output length, tool support, context behavior, cache economics, search behavior, and reviewer expectations. A production fallback policy should therefore store both economic fields and semantic fields: task type, model family, acceptance set, failure class, route priority, fallback reason, and rollback owner.

Planning Matrix

A source-dated planning matrix keeps the page useful for engineers and procurement reviewers. It turns a search query into an auditable route decision instead of a loose model preference.

Primary routeAllowed fallbackRequired guardrail
DeepSeek V4 Pro planningDeepSeek V4 Flash only for short executionBlock if task requires deep planning evidence
DeepSeek V4 Flash executionGLM-5.1 for structured reviewRe-run acceptance prompts before promotion
GLM-5.1 reasoningDeepSeek V4 Pro for high-stakes planningCompare output style and token cap
Kimi K3 long contextDeepSeek V4 Pro only after context reductionRecord lost context and cache assumptions
Any route with searchNo automatic fallbackRequire tool policy and search-call cap
Any failed requestRetry once by classStore failure_class and attempt_number

Implementation Pattern

The implementation pattern keeps credentials as placeholders, pins the AIWave base URL, records the model, and leaves room for route-specific controls. Production applications should move credentials into environment or secret storage.

from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY_HERE", base_url="https://aiwave.live/v1")

FALLBACKS = {
    "planning": ["deepseek-v4-pro", "glm-5.1"],
    "short_execution": ["deepseek-v4-flash", "glm-5"],
    "long_context_review": ["kimi-k3", "deepseek-v4-pro"],
}

def run_agent_step(task_type: str, prompt: str):
    last_error = None
    for attempt, model in enumerate(FALLBACKS[task_type], start=1):
        try:
            response = client.chat.completions.create(
                model=model,
                messages=[{"role": "user", "content": prompt}],
                max_tokens=700,
                temperature=0.15,
            )
            return {"model": model, "attempt": attempt, "usage": response.usage}
        except Exception as exc:
            last_error = str(exc)
    return {"failed": True, "last_error": last_error}

Define the Task Before the Model

A fallback matrix should start with task type, not provider preference. Planning, short execution, long-context review, tool-supported research, extraction, and customer-facing support all have different tolerance for behavior drift. A fallback that is acceptable for short execution may be unacceptable for a planning step that needs careful uncertainty handling. Write the task class into configuration before setting route priority.

Block Silent Semantic Swaps

The most dangerous fallback is one that succeeds technically while changing behavior invisibly. If a support workflow shifts from a concise model to a verbose model, users may see longer answers and finance may see higher output spend. If a repository agent shifts from Kimi K3 to a reduced-context DeepSeek prompt, the model may miss files that the original task depended on. Store the fallback reason and changed assumptions beside the result.

Classify Failure Before Routing

Do not route every exception to the next model. Authentication errors, account-group errors, context overflow, rate limits, content-policy rejections, and provider generation failures need different behavior. Some should stop immediately. Some should reduce prompt size. Some can retry once. Some can use a fallback only when the fallback preserves task semantics. A controlled enum makes the policy reviewable.

Tie Prices to a Workload Ledger

The gateway rows checked today show materially different output and cache-hit prices across DeepSeek, GLM, and Kimi routes. That does not mean the first row should always win. A workload with high output share behaves differently from a workload with repeated context. Store input tokens, output tokens, cache-hit tokens when visible, account group, pricing_version, route, and fallback reason per attempt.

Protect Cache Assumptions

Fallback can destroy cache behavior. A Kimi K3 trial may assume repeated repository preambles; a DeepSeek or GLM fallback may use a shortened prompt or a different stable prefix. If the cache basis changes, mark the row as a new pricing assumption. Otherwise a month-end review may falsely blame the model price when the real change was a cache pattern reset.

Canary the Matrix

Run the same redacted prompts against every allowed route in the matrix before production. The canary should capture status, output length, evidence quality, refusal behavior, tool-call behavior, token fields, and reviewer notes. If a route cannot pass the canary for a task type, it should not appear as an automatic fallback for that task type.

Procurement Review

Procurement should ask for the live AIWave pricing_version, provider source URLs, checked date, account group, token fields, failure taxonomy, and fallback matrix. Engineering should explain which fallbacks preserve user-visible behavior and which only support emergency degradation. Security should confirm that fallback routes do not expand data exposure beyond the original route policy.

Final Checklist

A DeepSeek GLM Kimi fallback matrix is ready when tasks are classified, silent semantic swaps are blocked, failures have a controlled enum, prices are tied to attempts, cache assumptions are preserved, and every automatic fallback has passed a canary. If any of those fields are missing, keep the fallback manual until the evidence catches up.

Source Links

Related AIWave Links