Cheap model fallback for Claude Code 核验日期 2026-09-17

Most agent tokens don't need a frontier model. Plan-then-execute keeps the flagship for architecture and hands the grunt work — file edits, boilerplate, docstrings, test scaffolding — to a flash-tier model that costs1–3% as much. Here's how to wire a cheap second model into each agent.

Why fallback saves so much

Interactive coding agents burn a large share of tokens on mechanical steps. Claude Code in particular also runs a background "small fast" model for sub-tasks — and it happily inherits your expensive default if you don't override it. Verified price spread for the same "smart enough" work (per 1M tokens, in/out):

ProviderModelInput $/1MCache read $/1MOutput $/1MGood as
DeepSeekDeepSeek V4.1 Flash$0.3$0.006$1.2Fallback or heavy lifting
Z.ai (Zhipu GLM)GLM-5.3$1.4$0.26$4.4Fallback or heavy lifting
Z.ai (Zhipu GLM)GLM-5.3-Flash$0.15$0.03$0.5Primary daily driver / fallback
Z.ai (Zhipu GLM)GLM-4.7$0.6$0.11$2.2Fallback or heavy lifting
Z.ai (Zhipu GLM)GLM-4.7-FlashFreeFreeFreePrimary daily driver / fallback
Moonshot AI (Kimi)Kimi K2.6$0.95$0.16$4Fallback or heavy lifting
SiliconFlowDeepSeek-V4-Flash$0.13$0.028$0.28Primary daily driver / fallback
SiliconFlowGLM-5.3$1.4$0.26$4.4Fallback or heavy lifting
SiliconFlowGLM-5.3-Flash$0.15$0.03$0.5Primary daily driver / fallback
SiliconFlowKimi-K2.6$0.77$0.14$3.4Fallback or heavy lifting
SiliconFlowMiniMax-M2.5$0.3$0.03$1.2Fallback or heavy lifting
OpenRouterDeepSeek V4 Flash (deepseek-v4-flash)$0.07$0.014$0.14Primary daily driver / fallback
AnthropicClaude Sonnet 5 (baseline)$2.00$0.20$10.00Architecture, reviews, hard debugging

Pattern 1 — Claude Code: two shells, two models

Claude Code reads its endpoint from env vars at launch, so the simplest robust fallback is two profiles:

# ~/.bashrc — flagship profile (default)
alias cc-max='ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic" \
  ANTHROPIC_AUTH_TOKEN="YOUR_ZAI_KEY" ANTHROPIC_MODEL="glm-5.3" claude'

# ~/.bashrc — cheap fallback profile
alias cc-cheap='ANTHROPIC_BASE_URL="https://api.siliconflow.com/" \
  ANTHROPIC_AUTH_TOKEN="YOUR_SF_KEY" ANTHROPIC_MODEL="DeepSeek-V4-Flash" \
  ANTHROPIC_SMALL_FAST_MODEL="GLM-5.3-Flash" claude'

Within one session you can also steer manually: keep the cheap endpoint as default and promote hard problems to the flagship profile only when the first attempt stalls. The split typically lands 70–90% of tokens on the cheap model.

Pattern 2 — Codex CLI: provider profiles in config.toml

# ~/.codex/config.toml — switch with: codex --profile cheap
[profiles.cheap]
model = "DeepSeek-V4-Flash"
model_provider = "siliconflow"

[profiles.max]
model = "glm-5.3"
model_provider = "zai"

model_catalog_json = "~/.codex/models.json"   # GLM metadata, see Z.ai Codex guide

[model_providers.siliconflow]
name = "SiliconFlow"
base_url = "https://api.siliconflow.com/v1"
env_key = "SILICONFLOW_API_KEY"
wire_api = "responses"

[model_providers.zai]
name = "Z.ai GLM"
base_url = "https://api.z.ai/api/v1"
env_key = "ZAI_API_KEY"
wire_api = "responses"

Pattern 3 — Cline: per-task model override

Cline lets you switch the model in the settings panel between tasks. Keep two saved configurations — SiliconFlow DeepSeek-V4-Flash for “Act” mode bulk edits, GLM-5.3 for “Plan” mode reasoning (values in /configs).

Verdict

FAQ

Does Claude Code have a native "fallback model" setting?
Not a cost-based one. It exposes ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL (plus per-tier defaults like ANTHROPIC_DEFAULT_SONNET_MODEL) — which is enough to run flagship + cheap in parallel via profiles.
Will a flash model break tool calling?
No — GLM-5.3-Flash and DeepSeek-V4-Flash both support function/tool calls on their official endpoints. Quality on complex multi-step tool chains is where you'll notice the difference, not single calls.
How do I know which share of tokens went to the cheap model?
Check each provider's usage dashboard; if you split by profile alias, the per-key usage makes the split obvious.
Are these numbers first-party?
Yes — all prices on this page were read from official provider pricing pages on 2026-09-17. Unverifiable ones are marked 待核验.