Claude Code on Chinese Fuel: cheap LLMs via an API key Author: Дністер Published: 2026-07-02T03:02:20.000Z Language: en URL: https://neurodrift.org/en/blog/deshevyi-claude-code-kytaiski-llm/ Original (Ukrainian): https://neurodrift.org/blog/deshevyi-claude-code-kytaiski-llm/ Tags: AI, Claude Code, LLM, DeepSeek, tools 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. ----- figure.schema{width:min(1000px,92vw);margin:1.9em 0 2.1em;margin-left:50%;transform:translateX(-50%);background:#0e1116;border:1px solid #262b34;border-radius:14px;padding:18px 16px 12px;overflow:hidden} figure.schema svg{display:block;width:100%;height:auto} figure.schema figcaption{font-family:var(--font-mono,ui-monospace,monospace);font-size:.76em;color:#8a93a3;margin-top:10px;line-height:1.5;text-align:center} @media(max-width:720px){figure.schema{width:100%;margin-left:0;transform:none}} pre.cb{position:relative;background:#0d1117;border:1px solid #232a33;border-left:3px solid #6ee7ff;border-radius:10px;padding:30px 16px 14px;margin:1.5em 0;overflow-x:auto} pre.cb code{font-family:var(--font-mono,ui-monospace,monospace);font-size:.85em;line-height:1.55;color:#d6deeb;background:none;border:none;padding:0;white-space:pre} pre.cb::before{content:attr(data-lang);position:absolute;top:8px;left:16px;font-family:var(--font-mono,ui-monospace,monospace);font-size:.64em;letter-spacing:.16em;text-transform:uppercase;color:#5b6371} 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. The question isn't "which Chinese model is smarter," but "who actually exposes an Anthropic-compatible endpoint that doesn't break on Claude Code's system prompt." 01 · How it works: two variables Claude Code isn't bolted to Anthropic's servers forever. It reads the backend address from the environment: ANTHROPICBASEURL (where to send requests) and ANTHROPICAUTHTOKEN (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. Як Claude Code перемикається на китайський бекенд через дві змінні Claude Code твій звичний CLI агенти · скіли · tool-use 2 ENV-змінні ANTHROPICBASEURL ANTHROPICAUTHTOKEN Китайський /anthropic DeepSeek · GLM · Kimi MiniMax · Qwen · MiMo Відповідь ×10–50 дешевше МЕЖА: через /anthropic НЕ проходить — лишай на нативному Claude MCP-сервери (Notion · GitHub · Postgres · Figma) · websearch · images / скріншоти / PDF anthropic-beta · фінальна якість української · чутливі геополітичні теми (цензура) Diagram 1. The whole trick is to redirect the CLI with two variables. The same line applies across all Chinese providers: the "trimmed" Anthropic endpoint doesn't carry MCP, websearch, images, or the sensitive stuff. 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 websearch, 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. ModelEndpointInputOutputCache-hitContextStrength DeepSeek v4-flashapi.deepseek.com/anthropic$0.14$0.28$0.00281Mcheapest usable default DeepSeek v4-prosame one$0.435$0.87$0.00361Mstrong reasoner (→ opus) GLM-4.7-FlashXapi.z.ai/api/anthropic$0.07$0.40$0.01~200Kultra-cheap bulk content GLM-4.6 / 4.7same one$0.60$2.20$0.11200Kmultilingual (UK) + tool-use GLM-5.2same one$1.40$4.40$0.261M (opt-in)flagship-quality coding Kimi k2.7-codeapi.moonshot.ai/anthropic$0.95$4.00$0.19262Klong-horizon agentic coding MiniMax M2.7api.minimax.io/anthropic$0.30$1.20$0.06200Kcheap agentic coding Qwen3-Coder-Nextdashscope…/apps/anthropic$0.30–0.80$1.50–4.00~10–20%262Kmultilingual coding Xiaomi MiMo v2.5api.xiaomimimo.com/anthropic~$0.15~$0.29~$0.0031Mcheap 1M agent Claude Opus / Sonnetnative$5+$25+cachecontrol200K+reference + MCP / web / images Separately — subscriptions with a fixed price instead of a meter, if your load is predictable: SubscriptionPrice / moModelFor whom GLM Coding PlanLite $18 · Pro $72 · Max $160 (promo −30% until September 2026)glm-5.2daily coding / landing pages MiniMax Token PlanPlus $20 · Max $50 · Ultra $120M2.xagentic sessions Qwen Coding PlanPro $50 (Lite discontinued)qwen3.7-plusmultilingual 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. Яку дешеву модель під яку задачу, і що завжди лишати на Claude Маршрут за задачею Великі дослідження deep research · fan-out Лендінги ітеративний front-end Масовий контент EN / UK обсяги Агентний кодинг tool-use loops DeepSeek v4-flash $0.14 / $0.28 · 1M ctx cache-hit $0.0028 (×50) GLM Coding Plan glm-5.2 · підписка $12–72/міс фікс GLM-4.7-FlashX $0.07 / $0.40 UK краще за DeepSeek GLM Coding Plan фолбек: MiniMax M2.7 $0.30 / $1.20 Патерн NeuroDrift: масовий обсяг / чернетка → дешева модель · фінальний прохід (факт-чек, укр-полір) → Claude ЗАВЖДИ НА CLAUDE (китайський /anthropic цього не тягне) MCP-стек: Notion · GitHub · Postgres · Figma · Gmail · нативний websearch images / скріншоти / PDF · фінальна якість української · чутливі теми приватні дані клієнтів (китайські сервери = GDPR / compliance-ризик) Diagram 2. The cheap model covers the volume; Claude stays the irreducible minimum for MCP, websearch, images, final Ukrainian, and the sensitive stuff. TaskPrimary modelWhy / caveat Large researchDeepSeek v4-flash (gathering/reading) → v4-pro or Claude (synthesis)1M context + cache-hit $0.0028 make bulk reading almost free. But websearch through DeepSeek doesn't work — feed sources as files / via WebFetch, keep the web phase on Claude. Landing pagesGLM Coding Plan (glm-5.2); fallback DeepSeek v4-proA 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 contentEN: DeepSeek v4-flash / GLM-4.7-FlashX. UK: GLM-4.6/4.7, final — ClaudeDeepSeek is trained on EN/ZH — its Ukrainian is noticeably weaker. GLM is better multilingually. Cheap draft + Claude polish = optimum. Agentic codingGLM Coding Plan; fallback DeepSeek v4-proBoth hold parallel tool-use well. MCP (Notion / GitHub / Postgres / Figma) does NOT work through Chinese endpoints — keep such workflows on Claude. Ukrainian qualityClaude (final); GLM draft; avoid DeepSeek for UK outputDeepSeek'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:ANTHROPICBASEURL = "https://api.deepseek.com/anthropic" $env:ANTHROPICAUTHTOKEN = "sk-<твійdeepseekkey>" $env:ANTHROPICAPIKEY = "" # ОБОВ’ЯЗКОВО порожній, не unset $env:ANTHROPICDEFAULTOPUSMODEL = "deepseek-v4-pro" $env:ANTHROPICDEFAULTSONNETMODEL = "deepseek-v4-flash" $env:ANTHROPICDEFAULTHAIKUMODEL = "deepseek-v4-flash" $env:CLAUDECODESUBAGENTMODEL = "deepseek-v4-flash" # субагенти на найдешевшому claude The "coding / landing pages" profile on the fixed GLM subscription: ПРОФІЛЬ «КОДИНГ / ЛЕНДІНГИ» — GLM Coding Plan (фіксована підписка) $env:ANTHROPICBASEURL = "https://api.z.ai/api/coding/paas/v4" $env:ANTHROPICAUTHTOKEN = "<твійzaikey>" $env:ANTHROPICAPIKEY = "" $env:ANTHROPICDEFAULTOPUSMODEL = "glm-5.2" $env:ANTHROPICDEFAULTSONNETMODEL = "glm-5.2" $env:ANTHROPICDEFAULTHAIKUMODEL = "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", "apibaseurl": "https://api.deepseek.com/chat/completions", "apikey": "sk-...", "models": ["deepseek-v4-flash", "deepseek-v4-pro"] }, { "name": "zai", "apibaseurl": "https://api.z.ai/api/anthropic", "apikey": "...", "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" // читання великих обсягів } } The cheap model covers 90% of the volume. Pricey Claude touches the remaining 10% — where quality truly decides. This isn't a compromise, it's a division of labor. 05 · The two tactics that cut the bill the hardest Дві тактики економії: кеш-префікс і конвеєр чернетка-полір Тактика 1 · Кеш-префікс (тримай незмінне зверху) system prompt · tool schema · великі незмінні файли мінливий запит ◀ кешується: cache-hit ×50 дешевше ($0.0028 vs $0.14) рахується щоразу ⚠ будь-яка зміна ВГОРІ ламає весь кеш-хвіст → незмінне на початок, мінливе вниз Тактика 2 · Конвеєр «чернетка → полір» (твій NeuroDrift-флоу) ОБСЯГ дешево чернетки лонгрідів · boilerplate-лендінг читання джерел · масовий EN-текст ФІНАЛ на Claude факт-чек · верифікація claims · українська дорога модель б’є лише по high-leverage кроках Економія: 90% токенів проходять дешевою моделлю, Claude торкається ~10% — там, де якість справді вирішує. Diagram 3. The two tactics with the biggest payoff: the right prompt order (cache) and the division of labor between a cheap draft and an expensive final. 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 cachecontrol 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 websearch 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-reasoner are 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 document block type breaks file work in Claude Code. MiniMax M3: through /anthropic it returns 200K of context instead of 1M — Claude Code compacts too early; fixed with the variable CLAUDECODEMAXCONTEXTTOKENS=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. Sources (official) DeepSeek — integration with Claude Code and the Anthropic API: api-docs.deepseek.com/quickstart/agentintegrations/claude_code Z.ai (Zhipu GLM) — Claude Code and pricing: docs.z.ai/devpack/tool/claude · docs.z.ai/guides/overview/pricing Moonshot Kimi — agent support: platform.kimi.ai/docs/guide/agent-support MiniMax — Anthropic-compatible API and caching: platform.minimax.io/docs/api-reference/text-anthropic-api Alibaba Cloud — Claude Code with Qwen: alibabacloud.com/help/en/model-studio/claude-code Xiaomi MiMo — Anthropic API: mimo.mi.com/docs/en-US/api/chat/anthropic-api claude-code-router: github.com/musistudio/claude-code-router · OpenRouter + Claude Code: openrouter.ai/docs/cookbook/coding-agents/claude-code-integration Prices verified against official documentation as of June 2026; rates and model names at Chinese providers change frequently — check before configuring.