Claude Code on Chinese Fuel: cheap LLMs via an API key
A practical How-To: which Chinese LLMs (DeepSeek, GLM, Kimi, MiniMax, Qwen, Xiaomi MiMo) actually plug into Claude Code via an Anthropic-compatible endpoint, verified pricing (June 2026), a task→model matrix, ready-made PowerShell configs, claude-code-router, and the honest line — where to keep native Claude.
Claude Code counts tokens at Anthropic's rate. On a large research run that reads hundreds of sources, or on an iterative landing page rewritten twenty times, the bill grows fast — and the lion's share is eaten not by "thinking" but by volume: reading, drafts, the housekeeping calls of agents. The good news: that volume can be offloaded onto Chinese models that cost 10–50× less, without changing a single familiar step in Claude Code. The bad: there's a precisely drawn line here, and if you don't know it, the savings turn into rework.
This guide is practical. Below: how it works mechanically, which providers actually plug in (with verified pricing as of June 2026), which model to take for which task, ready-made configs for Windows, the two tactics that cut the bill the hardest, and an honest list of where you must not save.
01 · How it works: two variables
Claude Code isn't bolted to Anthropic's servers forever. It reads the backend address from the environment: ANTHROPIC_BASE_URL (where to send requests) and ANTHROPIC_AUTH_TOKEN (what to authenticate with). If a provider exposes an Anthropic-compatible endpoint — usually an address with a /anthropic suffix — you redirect the CLI to someone else's server with a single variable, and your entire workflow (agents, skills, parallel tool-use) runs without a single change in code.
The key watershed of the entire comparison is this: DeepSeek, Zhipu GLM, Moonshot Kimi, MiniMax, Alibaba Qwen, and even Xiaomi MiMo already have an official /anthropic — they plug in within thirty seconds. But that endpoint is "trimmed" in all of them: it does not carry MCP servers, Claude Code's native web_search, images/PDF, and features behind anthropic-beta. This isn't a bug of a particular provider but a shared property — and it's exactly what determines what can be offloaded onto the cheap option and what must stay on Claude.
02 · Who actually connects and how much it costs
Below are the providers with a working /anthropic, ordered from the cheapest-and-effective. Prices verified from official documentation (June 2026), in dollars per 1M tokens.
| Model | Endpoint | Input | Output | Cache-hit | Context | Strength |
|---|---|---|---|---|---|---|
| DeepSeek v4-flash | api.deepseek.com/anthropic | $0.14 | $0.28 | $0.0028 | 1M | cheapest usable default |
| DeepSeek v4-pro | same one | $0.435 | $0.87 | $0.0036 | 1M | strong reasoner (→ opus) |
| GLM-4.7-FlashX | api.z.ai/api/anthropic | $0.07 | $0.40 | $0.01 | ~200K | ultra-cheap bulk content |
| GLM-4.6 / 4.7 | same one | $0.60 | $2.20 | $0.11 | 200K | multilingual (UK) + tool-use |
| GLM-5.2 | same one | $1.40 | $4.40 | $0.26 | 1M (opt-in) | flagship-quality coding |
| Kimi k2.7-code | api.moonshot.ai/anthropic | $0.95 | $4.00 | $0.19 | 262K | long-horizon agentic coding |
| MiniMax M2.7 | api.minimax.io/anthropic | $0.30 | $1.20 | $0.06 | 200K | cheap agentic coding |
| Qwen3-Coder-Next | dashscope…/apps/anthropic | $0.30–0.80 | $1.50–4.00 | ~10–20% | 262K | multilingual coding |
| Xiaomi MiMo v2.5 | api.xiaomimimo.com/anthropic | ~$0.15 | ~$0.29 | ~$0.003 | 1M | cheap 1M agent |
| Claude Opus / Sonnet | native | $5+ | $25+ | cache_control | 200K+ | reference + MCP / web / images |
Separately — subscriptions with a fixed price instead of a meter, if your load is predictable:
| Subscription | Price / mo | Model | For whom |
|---|---|---|---|
| GLM Coding Plan | Lite $18 · Pro $72 · Max $160 (promo −30% until September 2026) | glm-5.2 | daily coding / landing pages |
| MiniMax Token Plan | Plus $20 · Max $50 · Ultra $120 | M2.x | agentic sessions |
| Qwen Coding Plan | Pro $50 (Lite discontinued) | qwen3.7-plus | multilingual coding |
03 · Which model for which task
The main mistake is hunting for "one model for everything." The right way is to route by task type.
| Task | Primary model | Why / caveat |
|---|---|---|
| Large research | DeepSeek v4-flash (gathering/reading) → v4-pro or Claude (synthesis) | 1M context + cache-hit $0.0028 make bulk reading almost free. But web_search through DeepSeek doesn't work — feed sources as files / via WebFetch, keep the web phase on Claude. |
| Landing pages | GLM Coding Plan (glm-5.2); fallback DeepSeek v4-pro | A fixed subscription removes the meter anxiety while iterating. Images don't go through the endpoint → keep Figma MCP and screen-driven design on Claude. |
| Bulk content | EN: DeepSeek v4-flash / GLM-4.7-FlashX. UK: GLM-4.6/4.7, final — Claude | DeepSeek is trained on EN/ZH — its Ukrainian is noticeably weaker. GLM is better multilingually. Cheap draft + Claude polish = optimum. |
| Agentic coding | GLM Coding Plan; fallback DeepSeek v4-pro | Both hold parallel tool-use well. MCP (Notion / GitHub / Postgres / Figma) does NOT work through Chinese endpoints — keep such workflows on Claude. |
| Ukrainian quality | Claude (final); GLM draft; avoid DeepSeek for UK output | DeepSeek's Ukrainian quality is lower (EN/ZH corpus). The Ukrainian reference is Claude. Don't cut corners here blindly. |
04 · Ready-made configs (Windows / PowerShell)
Run them in a separate terminal — environment variables override settings.json, so your current native Claude session stays untouched. The "budget" profile for volume and research:
# ПРОФІЛЬ «БЮДЖЕТ» — DeepSeek (дослідження, масовий текст, scaffold)
$env:ANTHROPIC_BASE_URL = "https://api.deepseek.com/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "sk-<твій_deepseek_key>"
$env:ANTHROPIC_API_KEY = "" # ОБОВ’ЯЗКОВО порожній, не unset
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "deepseek-v4-pro"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "deepseek-v4-flash"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "deepseek-v4-flash"
$env:CLAUDE_CODE_SUBAGENT_MODEL = "deepseek-v4-flash" # субагенти на найдешевшому
claude
The "coding / landing pages" profile on the fixed GLM subscription:
# ПРОФІЛЬ «КОДИНГ / ЛЕНДІНГИ» — GLM Coding Plan (фіксована підписка)
$env:ANTHROPIC_BASE_URL = "https://api.z.ai/api/coding/paas/v4"
$env:ANTHROPIC_AUTH_TOKEN = "<твій_zai_key>"
$env:ANTHROPIC_API_KEY = ""
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "glm-5.2"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "glm-5.2"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "glm-4.7"
claude
If you want automatic routing within a single session (housekeeping calls and reading — to the cheapest, the main reasoning — to a pricier one), set up claude-code-router (npm i -g @musistudio/claude-code-router, launch with ccr code):
// %APPDATA%\Claude Code Router\config.json — авто-роутинг в одній сесії
{
"Providers": [
{ "name": "deepseek",
"api_base_url": "https://api.deepseek.com/chat/completions",
"api_key": "sk-...", "models": ["deepseek-v4-flash", "deepseek-v4-pro"] },
{ "name": "zai",
"api_base_url": "https://api.z.ai/api/anthropic",
"api_key": "...", "models": ["glm-5.2", "glm-4.7"] }
],
"Router": {
"default": "zai,glm-5.2", // головний reasoning
"background": "deepseek,deepseek-v4-flash", // службові виклики
"think": "deepseek,deepseek-v4-pro", // складні кроки
"longContext": "deepseek,deepseek-v4-flash" // читання великих обсягів
}
}
05 · The two tactics that cut the bill the hardest
Cache prefix. Don't turn caching off. Automatic caching keeps the stable beginning of the prompt — the system prompt, the tool schema, large unchanging files — and serves it at a cache-hit price dozens of times cheaper. The practical consequence: keep the unchanging part on top, the variable part at the bottom. Any change at the start breaks the whole cache tail. Through /anthropic the cache_control headers are ignored, but caching still kicks in automatically on the provider's side — nothing extra to do.
Draft → polish. Generate the bulk volume — drafts, boilerplate, source reading — with a cheap model, and send Claude or v4-pro only on the final pass: fact-checking, claim verification, Ukrainian editing. This is classic batch economics: the expensive model strikes precisely at the steps where its quality actually changes the result.
06 · Where you must NOT save
Here savings turn into rework, because the Chinese /anthropic endpoints physically can't carry this. Switch to native Claude deliberately when the task involves:
- MCP servers — Notion, GitHub, Postgres, Figma, Gmail. No Chinese endpoint supports them.
- Native web_search in Claude Code.
- Images, screenshots, PDF — "from-mockup" design, image analysis.
- Final Ukrainian quality — flagship texts.
- Sensitive geopolitical topics — DeepSeek / GLM / Kimi censor or refuse (Taiwan, Tiananmen, criticism of the CCP).
- Private client data — DeepSeek and GLM store data on servers in the PRC. For GDPR / client projects this is a separate risk; split your profiles by sensitivity.
07 · Pitfalls (as of June 2026)
- DeepSeek: the old names
deepseek-chat/deepseek-reasonerare aliases for v4-flash, and they disappear on July 24, 2026. Migrate your model names before that date. - Kimi k2.7-code: always in "thinking" mode (thinking tokens are billed as output), plus an unresolved bug with the
documentblock type breaks file work in Claude Code. - MiniMax M3: through
/anthropicit returns 200K of context instead of 1M — Claude Code compacts too early; fixed with the variableCLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000. The M2.x models don't accept images. - Qwen: Alibaba is under an Anthropic lawsuit for distilling Claude — the long-term stability of the endpoints is in question.
08 · And what about "OpenCode Zen" and OpenRouter
If you run into these names: OpenCode Zen isn't a model but a curated model gateway from the CLI agent OpenCode (a Claude Code competitor). It's attached to Claude Code only through a Cloudflare proxy — an extra layer you don't need. OpenRouter is a gateway to 300+ models with a single key (handy for A/B), but it officially guarantees Claude Code compatibility only for Anthropic models; for the Chinese ones it's another point of failure, so for working sessions a provider's direct /anthropic is more reliable.
Summary
The formula is simple. DeepSeek v4-flash is the workhorse for volume and reading. GLM is for when you need Ukrainian and tool-use. Claude stays on the final polish, MCP, and the sensitive stuff. Keep two or three profiles, switch by task (or hand that off to claude-code-router), don't turn off the cache, and don't skimp on the final pass. The savings on the bulk phase are dozens of times over; the risk is exactly where you deliberately keep Claude.
Comments
Signed-in readers only — to keep it human, not a bot swamp.