{
  "slug": "deshevyi-claude-code-kytaiski-llm",
  "url": "https://neurodrift.org/en/blog/deshevyi-claude-code-kytaiski-llm/",
  "title": "Claude Code on Chinese Fuel: cheap LLMs via an API key",
  "description": "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.",
  "author": "Дністер",
  "language": "en-US",
  "published": "2026-07-02T03:02:20.000Z",
  "updated": null,
  "tags": [
    "AI",
    "Claude Code",
    "LLM",
    "DeepSeek",
    "tools"
  ],
  "translationOf": "https://neurodrift.org/blog/deshevyi-claude-code-kytaiski-llm/",
  "sourceUrl": null,
  "body": "<style>\n  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}\n  figure.schema svg{display:block;width:100%;height:auto}\n  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}\n  @media(max-width:720px){figure.schema{width:100%;margin-left:0;transform:none}}\n  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}\n  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}\n  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}\n</style>\n\n<p>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 <em>volume</em>: reading, drafts, the housekeeping calls of agents. The good news: that volume can be offloaded onto Chinese models that cost 10–50× less, <strong>without changing a single familiar step in Claude Code</strong>. The bad: there's a precisely drawn line here, and if you don't know it, the savings turn into rework.</p>\n\n<p>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 <strong>must not</strong> save.</p>\n\n<aside class=\"pullquote\"><p>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.\"</p></aside>\n\n<h2>01 · How it works: two variables</h2>\n\n<p>Claude Code isn't bolted to Anthropic's servers forever. It reads the backend address from the environment: <code>ANTHROPIC_BASE_URL</code> (where to send requests) and <code>ANTHROPIC_AUTH_TOKEN</code> (what to authenticate with). If a provider exposes an <strong>Anthropic-compatible endpoint</strong> — usually an address with a <code>/anthropic</code> 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.</p>\n\n<figure class=\"schema\"><svg viewBox=\"0 0 920 300\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" font-family=\"system-ui,-apple-system,Segoe UI,Roboto,sans-serif\">\n<title>Як Claude Code перемикається на китайський бекенд через дві змінні</title>\n<rect x=\"24\" y=\"60\" width=\"200\" height=\"92\" rx=\"12\" fill=\"#11161d\" stroke=\"#2b3340\"/>\n<text x=\"124\" y=\"98\" fill=\"#e6e9ef\" font-size=\"16\" font-weight=\"700\" text-anchor=\"middle\">Claude Code</text>\n<text x=\"124\" y=\"120\" fill=\"#8a93a3\" font-size=\"12\" text-anchor=\"middle\">твій звичний CLI</text>\n<text x=\"124\" y=\"138\" fill=\"#8a93a3\" font-size=\"12\" text-anchor=\"middle\">агенти · скіли · tool-use</text>\n<path d=\"M232 106 L372 106\" stroke=\"#6ee7ff\" stroke-width=\"2\" fill=\"none\" marker-end=\"url(#ar)\"/>\n<text x=\"302\" y=\"74\" fill=\"#6ee7ff\" font-size=\"11\" text-anchor=\"middle\" font-weight=\"700\">2 ENV-змінні</text>\n<text x=\"302\" y=\"92\" fill=\"#aeb6c2\" font-size=\"10.5\" text-anchor=\"middle\">ANTHROPIC_BASE_URL</text>\n<text x=\"302\" y=\"128\" fill=\"#aeb6c2\" font-size=\"10.5\" text-anchor=\"middle\">ANTHROPIC_AUTH_TOKEN</text>\n<rect x=\"380\" y=\"56\" width=\"220\" height=\"100\" rx=\"12\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"490\" y=\"92\" fill=\"#6ee7ff\" font-size=\"15\" font-weight=\"700\" text-anchor=\"middle\">Китайський /anthropic</text>\n<text x=\"490\" y=\"113\" fill=\"#aeb6c2\" font-size=\"11.5\" text-anchor=\"middle\">DeepSeek · GLM · Kimi</text>\n<text x=\"490\" y=\"131\" fill=\"#aeb6c2\" font-size=\"11.5\" text-anchor=\"middle\">MiniMax · Qwen · MiMo</text>\n<path d=\"M608 106 L748 106\" stroke=\"#5ad19a\" stroke-width=\"2\" fill=\"none\" marker-end=\"url(#ag)\"/>\n<rect x=\"756\" y=\"68\" width=\"140\" height=\"76\" rx=\"12\" fill=\"#101a16\" stroke=\"#1f3a2e\"/>\n<text x=\"826\" y=\"100\" fill=\"#5ad19a\" font-size=\"14\" font-weight=\"700\" text-anchor=\"middle\">Відповідь</text>\n<text x=\"826\" y=\"120\" fill=\"#8a93a3\" font-size=\"11\" text-anchor=\"middle\">×10–50 дешевше</text>\n<rect x=\"24\" y=\"196\" width=\"872\" height=\"78\" rx=\"12\" fill=\"#1a1410\" stroke=\"#3a2a1c\"/>\n<text x=\"44\" y=\"222\" fill=\"#ff9764\" font-size=\"11\" font-weight=\"700\" letter-spacing=\"1.5\">МЕЖА: через /anthropic НЕ проходить — лишай на нативному Claude</text>\n<text x=\"44\" y=\"246\" fill=\"#f0d9cb\" font-size=\"12.5\">MCP-сервери (Notion · GitHub · Postgres · Figma)   ·   web_search   ·   images / скріншоти / PDF</text>\n<text x=\"44\" y=\"265\" fill=\"#f0d9cb\" font-size=\"12.5\">anthropic-beta   ·   фінальна якість української   ·   чутливі геополітичні теми (цензура)</text>\n<defs>\n<marker id=\"ar\" markerWidth=\"10\" markerHeight=\"10\" refX=\"6\" refY=\"5\" orient=\"auto\"><path d=\"M1 1 L8 5 L1 9\" fill=\"none\" stroke=\"#6ee7ff\" stroke-width=\"2\"/></marker>\n<marker id=\"ag\" markerWidth=\"10\" markerHeight=\"10\" refX=\"6\" refY=\"5\" orient=\"auto\"><path d=\"M1 1 L8 5 L1 9\" fill=\"none\" stroke=\"#5ad19a\" stroke-width=\"2\"/></marker>\n</defs>\n</svg><figcaption>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, web_search, images, or the sensitive stuff.</figcaption></figure>\n\n<p>The key watershed of the entire comparison is this: <strong>DeepSeek, Zhipu GLM, Moonshot Kimi, MiniMax, Alibaba Qwen, and even Xiaomi MiMo already have an official <code>/anthropic</code></strong> — they plug in within thirty seconds. But that endpoint is \"trimmed\" in all of them: <strong>it does not carry</strong> MCP servers, Claude Code's native web_search, images/PDF, and features behind <code>anthropic-beta</code>. 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.</p>\n\n<h2>02 · Who actually connects and how much it costs</h2>\n\n<p>Below are the providers with a working <code>/anthropic</code>, ordered from the cheapest-and-effective. Prices verified from official documentation (June 2026), in dollars per 1M tokens.</p>\n\n<table><thead><tr><th>Model</th><th>Endpoint</th><th>Input</th><th>Output</th><th>Cache-hit</th><th>Context</th><th>Strength</th></tr></thead><tbody>\n<tr><td>DeepSeek v4-flash</td><td>api.deepseek.com/anthropic</td><td>$0.14</td><td>$0.28</td><td>$0.0028</td><td>1M</td><td>cheapest usable default</td></tr>\n<tr><td>DeepSeek v4-pro</td><td>same one</td><td>$0.435</td><td>$0.87</td><td>$0.0036</td><td>1M</td><td>strong reasoner (→ opus)</td></tr>\n<tr><td>GLM-4.7-FlashX</td><td>api.z.ai/api/anthropic</td><td>$0.07</td><td>$0.40</td><td>$0.01</td><td>~200K</td><td>ultra-cheap bulk content</td></tr>\n<tr><td>GLM-4.6 / 4.7</td><td>same one</td><td>$0.60</td><td>$2.20</td><td>$0.11</td><td>200K</td><td>multilingual (UK) + tool-use</td></tr>\n<tr><td>GLM-5.2</td><td>same one</td><td>$1.40</td><td>$4.40</td><td>$0.26</td><td>1M (opt-in)</td><td>flagship-quality coding</td></tr>\n<tr><td>Kimi k2.7-code</td><td>api.moonshot.ai/anthropic</td><td>$0.95</td><td>$4.00</td><td>$0.19</td><td>262K</td><td>long-horizon agentic coding</td></tr>\n<tr><td>MiniMax M2.7</td><td>api.minimax.io/anthropic</td><td>$0.30</td><td>$1.20</td><td>$0.06</td><td>200K</td><td>cheap agentic coding</td></tr>\n<tr><td>Qwen3-Coder-Next</td><td>dashscope…/apps/anthropic</td><td>$0.30–0.80</td><td>$1.50–4.00</td><td>~10–20%</td><td>262K</td><td>multilingual coding</td></tr>\n<tr><td>Xiaomi MiMo v2.5</td><td>api.xiaomimimo.com/anthropic</td><td>~$0.15</td><td>~$0.29</td><td>~$0.003</td><td>1M</td><td>cheap 1M agent</td></tr>\n<tr><td>Claude Opus / Sonnet</td><td>native</td><td>$5+</td><td>$25+</td><td>cache_control</td><td>200K+</td><td>reference + MCP / web / images</td></tr>\n</tbody></table>\n\n<p>Separately — <strong>subscriptions</strong> with a fixed price instead of a meter, if your load is predictable:</p>\n\n<table><thead><tr><th>Subscription</th><th>Price / mo</th><th>Model</th><th>For whom</th></tr></thead><tbody>\n<tr><td>GLM Coding Plan</td><td>Lite $18 · Pro $72 · Max $160 (promo −30% until September 2026)</td><td>glm-5.2</td><td>daily coding / landing pages</td></tr>\n<tr><td>MiniMax Token Plan</td><td>Plus $20 · Max $50 · Ultra $120</td><td>M2.x</td><td>agentic sessions</td></tr>\n<tr><td>Qwen Coding Plan</td><td>Pro $50 (Lite discontinued)</td><td>qwen3.7-plus</td><td>multilingual coding</td></tr>\n</tbody></table>\n\n<h2>03 · Which model for which task</h2>\n\n<p>The main mistake is hunting for \"one model for everything.\" The right way is to route by task type.</p>\n\n<figure class=\"schema\"><svg viewBox=\"0 0 920 430\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" font-family=\"system-ui,-apple-system,Segoe UI,Roboto,sans-serif\">\n<title>Яку дешеву модель під яку задачу, і що завжди лишати на Claude</title>\n<text x=\"24\" y=\"30\" fill=\"#e6e9ef\" font-size=\"14\" font-weight=\"700\">Маршрут за задачею</text>\n<g>\n<rect x=\"24\"  y=\"48\" width=\"210\" height=\"50\" rx=\"9\" fill=\"#161b22\" stroke=\"#2b3340\"/>\n<text x=\"40\" y=\"72\" fill=\"#e6e9ef\" font-size=\"13\" font-weight=\"700\">Великі дослідження</text>\n<text x=\"40\" y=\"89\" fill=\"#8a93a3\" font-size=\"11\">deep research · fan-out</text>\n<rect x=\"246\" y=\"48\" width=\"210\" height=\"50\" rx=\"9\" fill=\"#161b22\" stroke=\"#2b3340\"/>\n<text x=\"262\" y=\"72\" fill=\"#e6e9ef\" font-size=\"13\" font-weight=\"700\">Лендінги</text>\n<text x=\"262\" y=\"89\" fill=\"#8a93a3\" font-size=\"11\">ітеративний front-end</text>\n<rect x=\"468\" y=\"48\" width=\"210\" height=\"50\" rx=\"9\" fill=\"#161b22\" stroke=\"#2b3340\"/>\n<text x=\"484\" y=\"72\" fill=\"#e6e9ef\" font-size=\"13\" font-weight=\"700\">Масовий контент</text>\n<text x=\"484\" y=\"89\" fill=\"#8a93a3\" font-size=\"11\">EN / UK обсяги</text>\n<rect x=\"690\" y=\"48\" width=\"206\" height=\"50\" rx=\"9\" fill=\"#161b22\" stroke=\"#2b3340\"/>\n<text x=\"706\" y=\"72\" fill=\"#e6e9ef\" font-size=\"13\" font-weight=\"700\">Агентний кодинг</text>\n<text x=\"706\" y=\"89\" fill=\"#8a93a3\" font-size=\"11\">tool-use loops</text>\n</g>\n<g stroke=\"#6ee7ff\" stroke-width=\"1.5\" fill=\"none\">\n<path d=\"M129 98 L129 140\" marker-end=\"url(#a2)\"/><path d=\"M351 98 L351 140\" marker-end=\"url(#a2)\"/>\n<path d=\"M573 98 L573 140\" marker-end=\"url(#a2)\"/><path d=\"M793 98 L793 140\" marker-end=\"url(#a2)\"/>\n</g>\n<g>\n<rect x=\"24\"  y=\"142\" width=\"210\" height=\"60\" rx=\"9\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"40\" y=\"165\" fill=\"#6ee7ff\" font-size=\"13\" font-weight=\"700\">DeepSeek v4-flash</text>\n<text x=\"40\" y=\"182\" fill=\"#aeb6c2\" font-size=\"11\">$0.14 / $0.28 · 1M ctx</text>\n<text x=\"40\" y=\"197\" fill=\"#aeb6c2\" font-size=\"11\">cache-hit $0.0028 (×50)</text>\n<rect x=\"246\" y=\"142\" width=\"210\" height=\"60\" rx=\"9\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"262\" y=\"165\" fill=\"#6ee7ff\" font-size=\"13\" font-weight=\"700\">GLM Coding Plan</text>\n<text x=\"262\" y=\"182\" fill=\"#aeb6c2\" font-size=\"11\">glm-5.2 · підписка</text>\n<text x=\"262\" y=\"197\" fill=\"#aeb6c2\" font-size=\"11\">$12–72/міс фікс</text>\n<rect x=\"468\" y=\"142\" width=\"210\" height=\"60\" rx=\"9\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"484\" y=\"165\" fill=\"#6ee7ff\" font-size=\"13\" font-weight=\"700\">GLM-4.7-FlashX</text>\n<text x=\"484\" y=\"182\" fill=\"#aeb6c2\" font-size=\"11\">$0.07 / $0.40</text>\n<text x=\"484\" y=\"197\" fill=\"#aeb6c2\" font-size=\"11\">UK краще за DeepSeek</text>\n<rect x=\"690\" y=\"142\" width=\"206\" height=\"60\" rx=\"9\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"706\" y=\"165\" fill=\"#6ee7ff\" font-size=\"13\" font-weight=\"700\">GLM Coding Plan</text>\n<text x=\"706\" y=\"182\" fill=\"#aeb6c2\" font-size=\"11\">фолбек: MiniMax M2.7</text>\n<text x=\"706\" y=\"197\" fill=\"#aeb6c2\" font-size=\"11\">$0.30 / $1.20</text>\n</g>\n<rect x=\"24\" y=\"224\" width=\"872\" height=\"40\" rx=\"9\" fill=\"#161b22\" stroke=\"#2b3340\"/>\n<text x=\"40\" y=\"249\" fill=\"#e6e9ef\" font-size=\"12.5\"><tspan fill=\"#6ee7ff\" font-weight=\"700\">Патерн NeuroDrift: </tspan>масовий обсяг / чернетка → дешева модель    ·    фінальний прохід (факт-чек, укр-полір) → Claude</text>\n<path d=\"M460 264 L460 296\" stroke=\"#ff9764\" stroke-width=\"1.5\" fill=\"none\" marker-end=\"url(#a3)\"/>\n<rect x=\"24\" y=\"298\" width=\"872\" height=\"104\" rx=\"9\" fill=\"#1a1410\" stroke=\"#3a2a1c\"/>\n<text x=\"44\" y=\"324\" fill=\"#ff9764\" font-size=\"11.5\" font-weight=\"700\" letter-spacing=\"1.2\">ЗАВЖДИ НА CLAUDE (китайський /anthropic цього не тягне)</text>\n<text x=\"44\" y=\"349\" fill=\"#f0d9cb\" font-size=\"12.5\">MCP-стек: Notion · GitHub · Postgres · Figma · Gmail        ·        нативний web_search</text>\n<text x=\"44\" y=\"370\" fill=\"#f0d9cb\" font-size=\"12.5\">images / скріншоти / PDF        ·        фінальна якість української        ·        чутливі теми</text>\n<text x=\"44\" y=\"391\" fill=\"#f0d9cb\" font-size=\"12.5\">приватні дані клієнтів (китайські сервери = GDPR / compliance-ризик)</text>\n<defs>\n<marker id=\"a2\" markerWidth=\"9\" markerHeight=\"9\" refX=\"5\" refY=\"4.5\" orient=\"auto\"><path d=\"M1 1 L7 4.5 L1 8\" fill=\"none\" stroke=\"#6ee7ff\" stroke-width=\"1.5\"/></marker>\n<marker id=\"a3\" markerWidth=\"9\" markerHeight=\"9\" refX=\"5\" refY=\"4.5\" orient=\"auto\"><path d=\"M1 1 L7 4.5 L1 8\" fill=\"none\" stroke=\"#ff9764\" stroke-width=\"1.5\"/></marker>\n</defs>\n</svg><figcaption>Diagram 2. The cheap model covers the volume; Claude stays the irreducible minimum for MCP, web_search, images, final Ukrainian, and the sensitive stuff.</figcaption></figure>\n\n<table><thead><tr><th>Task</th><th>Primary model</th><th>Why / caveat</th></tr></thead><tbody>\n<tr><td>Large research</td><td>DeepSeek v4-flash (gathering/reading) → v4-pro or Claude (synthesis)</td><td>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.</td></tr>\n<tr><td>Landing pages</td><td>GLM Coding Plan (glm-5.2); fallback DeepSeek v4-pro</td><td>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.</td></tr>\n<tr><td>Bulk content</td><td>EN: DeepSeek v4-flash / GLM-4.7-FlashX. UK: GLM-4.6/4.7, final — Claude</td><td>DeepSeek is trained on EN/ZH — its Ukrainian is noticeably weaker. GLM is better multilingually. Cheap draft + Claude polish = optimum.</td></tr>\n<tr><td>Agentic coding</td><td>GLM Coding Plan; fallback DeepSeek v4-pro</td><td>Both hold parallel tool-use well. MCP (Notion / GitHub / Postgres / Figma) does NOT work through Chinese endpoints — keep such workflows on Claude.</td></tr>\n<tr><td>Ukrainian quality</td><td>Claude (final); GLM draft; avoid DeepSeek for UK output</td><td>DeepSeek's Ukrainian quality is lower (EN/ZH corpus). The Ukrainian reference is Claude. Don't cut corners here blindly.</td></tr>\n</tbody></table>\n\n<h2>04 · Ready-made configs (Windows / PowerShell)</h2>\n\n<p>Run them in a <strong>separate terminal</strong> — environment variables override <code>settings.json</code>, so your current native Claude session stays untouched. The \"budget\" profile for volume and research:</p>\n\n<pre class=\"cb\" data-lang=\"powershell\"><code># ПРОФІЛЬ «БЮДЖЕТ» — DeepSeek (дослідження, масовий текст, scaffold)\n$env:ANTHROPIC_BASE_URL             = \"https://api.deepseek.com/anthropic\"\n$env:ANTHROPIC_AUTH_TOKEN           = \"sk-&lt;твій_deepseek_key&gt;\"\n$env:ANTHROPIC_API_KEY              = \"\"        # ОБОВ’ЯЗКОВО порожній, не unset\n$env:ANTHROPIC_DEFAULT_OPUS_MODEL   = \"deepseek-v4-pro\"\n$env:ANTHROPIC_DEFAULT_SONNET_MODEL = \"deepseek-v4-flash\"\n$env:ANTHROPIC_DEFAULT_HAIKU_MODEL  = \"deepseek-v4-flash\"\n$env:CLAUDE_CODE_SUBAGENT_MODEL     = \"deepseek-v4-flash\"   # субагенти на найдешевшому\nclaude</code></pre>\n\n<p>The \"coding / landing pages\" profile on the fixed GLM subscription:</p>\n\n<pre class=\"cb\" data-lang=\"powershell\"><code># ПРОФІЛЬ «КОДИНГ / ЛЕНДІНГИ» — GLM Coding Plan (фіксована підписка)\n$env:ANTHROPIC_BASE_URL             = \"https://api.z.ai/api/coding/paas/v4\"\n$env:ANTHROPIC_AUTH_TOKEN           = \"&lt;твій_zai_key&gt;\"\n$env:ANTHROPIC_API_KEY              = \"\"\n$env:ANTHROPIC_DEFAULT_OPUS_MODEL   = \"glm-5.2\"\n$env:ANTHROPIC_DEFAULT_SONNET_MODEL = \"glm-5.2\"\n$env:ANTHROPIC_DEFAULT_HAIKU_MODEL  = \"glm-4.7\"\nclaude</code></pre>\n\n<p>If you want <strong>automatic routing within a single session</strong> (housekeeping calls and reading — to the cheapest, the main reasoning — to a pricier one), set up <code>claude-code-router</code> (<code>npm i -g @musistudio/claude-code-router</code>, launch with <code>ccr code</code>):</p>\n\n<pre class=\"cb\" data-lang=\"json\"><code>// %APPDATA%\\Claude Code Router\\config.json — авто-роутинг в одній сесії\n&#123;\n  \"Providers\": [\n    &#123; \"name\": \"deepseek\",\n      \"api_base_url\": \"https://api.deepseek.com/chat/completions\",\n      \"api_key\": \"sk-...\", \"models\": [\"deepseek-v4-flash\", \"deepseek-v4-pro\"] &#125;,\n    &#123; \"name\": \"zai\",\n      \"api_base_url\": \"https://api.z.ai/api/anthropic\",\n      \"api_key\": \"...\", \"models\": [\"glm-5.2\", \"glm-4.7\"] &#125;\n  ],\n  \"Router\": &#123;\n    \"default\":     \"zai,glm-5.2\",          // головний reasoning\n    \"background\":  \"deepseek,deepseek-v4-flash\",  // службові виклики\n    \"think\":       \"deepseek,deepseek-v4-pro\",    // складні кроки\n    \"longContext\": \"deepseek,deepseek-v4-flash\"   // читання великих обсягів\n  &#125;\n&#125;</code></pre>\n\n<aside class=\"pullquote\"><p>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.</p></aside>\n\n<h2>05 · The two tactics that cut the bill the hardest</h2>\n\n<figure class=\"schema\"><svg viewBox=\"0 0 920 330\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" font-family=\"system-ui,-apple-system,Segoe UI,Roboto,sans-serif\">\n<title>Дві тактики економії: кеш-префікс і конвеєр чернетка-полір</title>\n<text x=\"24\" y=\"28\" fill=\"#e6e9ef\" font-size=\"14\" font-weight=\"700\">Тактика 1 · Кеш-префікс (тримай незмінне зверху)</text>\n<rect x=\"24\" y=\"44\" width=\"430\" height=\"40\" rx=\"8\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"38\" y=\"69\" fill=\"#6ee7ff\" font-size=\"12\">system prompt · tool schema · великі незмінні файли</text>\n<rect x=\"462\" y=\"44\" width=\"180\" height=\"40\" rx=\"8\" fill=\"#161b22\" stroke=\"#2b3340\"/>\n<text x=\"476\" y=\"69\" fill=\"#e6e9ef\" font-size=\"12\">мінливий запит</text>\n<text x=\"24\" y=\"104\" fill=\"#5ad19a\" font-size=\"11.5\">◀ кешується: cache-hit ×50 дешевше ($0.0028 vs $0.14)</text>\n<text x=\"462\" y=\"104\" fill=\"#8a93a3\" font-size=\"11.5\">рахується щоразу</text>\n<text x=\"24\" y=\"126\" fill=\"#ff9764\" font-size=\"11.5\">⚠ будь-яка зміна ВГОРІ ламає весь кеш-хвіст → незмінне на початок, мінливе вниз</text>\n<line x1=\"24\" y1=\"150\" x2=\"896\" y2=\"150\" stroke=\"#222a33\" stroke-width=\"1\"/>\n<text x=\"24\" y=\"182\" fill=\"#e6e9ef\" font-size=\"14\" font-weight=\"700\">Тактика 2 · Конвеєр «чернетка → полір» (твій NeuroDrift-флоу)</text>\n<rect x=\"24\" y=\"200\" width=\"360\" height=\"74\" rx=\"10\" fill=\"#0e1b1b\" stroke=\"#1f6f6f\"/>\n<text x=\"44\" y=\"228\" fill=\"#6ee7ff\" font-size=\"14\" font-weight=\"700\">1. ОБСЯГ дешево</text>\n<text x=\"44\" y=\"250\" fill=\"#aeb6c2\" font-size=\"12\">чернетки лонгрідів · boilerplate-лендінг</text>\n<text x=\"44\" y=\"268\" fill=\"#aeb6c2\" font-size=\"12\">читання джерел · масовий EN-текст</text>\n<path d=\"M392 237 L470 237\" stroke=\"#aeb6c2\" stroke-width=\"2\" fill=\"none\" marker-end=\"url(#a4)\"/>\n<rect x=\"478\" y=\"200\" width=\"418\" height=\"74\" rx=\"10\" fill=\"#101a16\" stroke=\"#1f3a2e\"/>\n<text x=\"498\" y=\"228\" fill=\"#5ad19a\" font-size=\"14\" font-weight=\"700\">2. ФІНАЛ на Claude</text>\n<text x=\"498\" y=\"250\" fill=\"#aeb6c2\" font-size=\"12\">факт-чек · верифікація claims · українська</text>\n<text x=\"498\" y=\"268\" fill=\"#aeb6c2\" font-size=\"12\">дорога модель б’є лише по high-leverage кроках</text>\n<text x=\"24\" y=\"300\" fill=\"#8a93a3\" font-size=\"11.5\">Економія: 90% токенів проходять дешевою моделлю, Claude торкається ~10% — там, де якість справді вирішує.</text>\n<defs><marker id=\"a4\" markerWidth=\"10\" markerHeight=\"10\" refX=\"6\" refY=\"5\" orient=\"auto\"><path d=\"M1 1 L8 5 L1 9\" fill=\"none\" stroke=\"#aeb6c2\" stroke-width=\"2\"/></marker></defs>\n</svg><figcaption>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.</figcaption></figure>\n\n<p><strong>Cache prefix.</strong> Don't turn caching off. Automatic caching keeps the stable <em>beginning</em> 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 <code>/anthropic</code> the <code>cache_control</code> headers are ignored, but caching still kicks in automatically on the provider's side — nothing extra to do.</p>\n\n<p><strong>Draft → polish.</strong> Generate the bulk volume — drafts, boilerplate, source reading — with a cheap model, and send Claude or v4-pro <em>only</em> 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.</p>\n\n<h2>06 · Where you must NOT save</h2>\n\n<p>Here savings turn into rework, because the Chinese <code>/anthropic</code> endpoints physically can't carry this. Switch to native Claude deliberately when the task involves:</p>\n\n<ul>\n<li><strong>MCP servers</strong> — Notion, GitHub, Postgres, Figma, Gmail. No Chinese endpoint supports them.</li>\n<li><strong>Native web_search</strong> in Claude Code.</li>\n<li><strong>Images, screenshots, PDF</strong> — \"from-mockup\" design, image analysis.</li>\n<li><strong>Final Ukrainian quality</strong> — flagship texts.</li>\n<li><strong>Sensitive geopolitical topics</strong> — DeepSeek / GLM / Kimi censor or refuse (Taiwan, Tiananmen, criticism of the CCP).</li>\n<li><strong>Private client data</strong> — DeepSeek and GLM store data on servers in the PRC. For GDPR / client projects this is a separate risk; split your profiles by sensitivity.</li>\n</ul>\n\n<h2>07 · Pitfalls (as of June 2026)</h2>\n\n<ul>\n<li><strong>DeepSeek:</strong> the old names <code>deepseek-chat</code> / <code>deepseek-reasoner</code> are aliases for v4-flash, and they <strong>disappear on July 24, 2026</strong>. Migrate your model names before that date.</li>\n<li><strong>Kimi k2.7-code:</strong> always in \"thinking\" mode (thinking tokens are billed as output), plus an unresolved bug with the <code>document</code> block type breaks file work in Claude Code.</li>\n<li><strong>MiniMax M3:</strong> through <code>/anthropic</code> it returns 200K of context instead of 1M — Claude Code compacts too early; fixed with the variable <code>CLAUDE_CODE_MAX_CONTEXT_TOKENS=1000000</code>. The M2.x models don't accept images.</li>\n<li><strong>Qwen:</strong> Alibaba is under an Anthropic lawsuit for distilling Claude — the long-term stability of the endpoints is in question.</li>\n</ul>\n\n<h2>08 · And what about \"OpenCode Zen\" and OpenRouter</h2>\n\n<p>If you run into these names: <strong>OpenCode Zen</strong> isn't a model but a curated model gateway from the CLI agent <em>OpenCode</em> (a Claude Code competitor). It's attached to Claude Code only through a Cloudflare proxy — an extra layer you don't need. <strong>OpenRouter</strong> 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 <code>/anthropic</code> is more reliable.</p>\n\n<h2>Summary</h2>\n\n<p>The formula is simple. <strong>DeepSeek v4-flash</strong> is the workhorse for volume and reading. <strong>GLM</strong> is for when you need Ukrainian and tool-use. <strong>Claude</strong> stays on the final polish, MCP, and the sensitive stuff. Keep two or three profiles, switch by task (or hand that off to <code>claude-code-router</code>), 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.</p>\n\n<aside class=\"sources\">\n<h3>Sources (official)</h3>\n<ol>\n<li>DeepSeek — integration with Claude Code and the Anthropic API: api-docs.deepseek.com/quick_start/agent_integrations/claude_code</li>\n<li>Z.ai (Zhipu GLM) — Claude Code and pricing: docs.z.ai/devpack/tool/claude · docs.z.ai/guides/overview/pricing</li>\n<li>Moonshot Kimi — agent support: platform.kimi.ai/docs/guide/agent-support</li>\n<li>MiniMax — Anthropic-compatible API and caching: platform.minimax.io/docs/api-reference/text-anthropic-api</li>\n<li>Alibaba Cloud — Claude Code with Qwen: alibabacloud.com/help/en/model-studio/claude-code</li>\n<li>Xiaomi MiMo — Anthropic API: mimo.mi.com/docs/en-US/api/chat/anthropic-api</li>\n<li>claude-code-router: github.com/musistudio/claude-code-router · OpenRouter + Claude Code: openrouter.ai/docs/cookbook/coding-agents/claude-code-integration</li>\n</ol>\n<p style=\"font-size:0.82em;color:var(--text-dim);margin-top:1em;\">Prices verified against official documentation as of June 2026; rates and model names at Chinese providers change frequently — check before configuring.</p>\n</aside>"
}