docs: Claude Code's Code Mode needs a direct Anthropic connection (#7025)

lst016 (#7025) and DylanH_L on X asked for Code Mode through magpie.
Claude Code 2.1.327 decides it in its own start-up check, read in its
bundle: Code Mode is refused with "provider" unless the provider is
firstParty and ANTHROPIC_BASE_URL is unset or its host is exactly
api.anthropic.com (nc()/fd()); then with "credentials" for an
apiKeyHelper or a custom Authorization/X-Api-Key header, "no_flags"
when DISABLE_TELEMETRY, DO_NOT_TRACK or
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC stops the feature-flag
download, and "gate" unless Anthropic's tengu_rustling_blossom flag is
on for the account. Nothing magpie sends or answers can change it: the
base-URL check runs before any request.

So every routed Claude Code (any upstream, a Claude subscription's or an
Anthropic key's model included) starts without it. The subscription
bridge's own runs can't have it either: --tools leaves REPL out, it reads
no user settings, and Code Mode needs an interactive opt-in and restart.
Faking a first-party address would misrepresent the client to Anthropic,
so it isn't done. The docs page says so in en, zh and ja, with the way to
use it: Claude Code on its own model, straight to Anthropic, with
Claude Code's telemetry left on (magpie's switch sets DISABLE_TELEMETRY).

Run:
- real Claude Code 2.1.327 in tmux, sandbox HOME and CLAUDE_CONFIG_DIR,
  ANTHROPIC_BASE_URL=http://127.0.0.1:59998,
  CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1: "Code Mode (experimental) isn't
  available: for now it only works directly with the Anthropic API".
- node docs-index.mjs (search indexes, llms-full.txt, docs-index.sums).
- on mica: node --test site/search.test.mjs site/worker.test.mjs
  site/docker-tags.test.mjs, 50 pass 0 fail; go test ./internal/testenv ok.
Not tried: a direct Code Mode session on a real account (it needs
Anthropic's account gate; nothing in magpie is on that path).
This commit is contained in:
yetone
2026-11-18 16:15:36 +08:00
parent 67f24d7422
commit de5fc6700e
8 changed files with 40 additions and 6 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ df52e204796613ec8131ceb890f452dd73da66c673f306b89eb94844268e3b54 docs/baidu-qia
2f13c96d72e80bd1413c2d64c59c9eb840021e43ea5d46078fdce9a84b3645a8 docs/cherry-studio.html
b2d8f741a00a5ba5a7ae43cf63c80f1881b59713759e0bd7f70c13b45361918a docs/cindy.html
cd3d7fa6c2da42719a8466c91184b28a6e6a4eff0710c7c8e15d939a60d51617 docs/claude-code-chatgpt.html
1eda8b1700bfc7925c7508bd9de2de0e4d340f2fd55afb36e521d7728a40729b docs/claude-code-models.html
ced85cc36172de2d1ffd753796acdbb4f7cc1c98899007b41ed9223b5a6fc878 docs/claude-code-models.html
c07cc8896fdd6dfa0730f8cf334ff86fcdf935b1810c4c4a2f1855b0c7122078 docs/claude-desktop.html
38f2ca46999ab5a384ae637de79b64c8685f0cb0cacbab12270142ed2dc26adc docs/claude-science.html
af369191133b664ef0d8943f7eb49f3441cc3cc4d4b4b7a42e55a108c733c4f5 docs/cline.html
@@ -66,7 +66,7 @@ a59591b145e3758096406a95ea9be2365e2ef2c97743d3cf6225b3c7b7ee469b docs/ja/aside.
478a49427ae8d6f7a19c75eb630d87b61ae3645ba3af280c3c337c2d6b386ecf docs/ja/cherry-studio.html
6c7fbdc106e895ffda95113821d0c043f8fbbd239c80e512ac80fb2139d1c3a9 docs/ja/cindy.html
b11bca0d8dda37edbd5d7bf7b17822634168916d3544eb6fc633947c53dfdc09 docs/ja/claude-code-chatgpt.html
e4501a3018d2df95ee162e5240670cbc7897c56b8fd73ffe89d909cd985a64f6 docs/ja/claude-code-models.html
d0f0d97330f8519e4ed082c2ef1f3f6cdb0c428c862ca345a10ada708d7ab670 docs/ja/claude-code-models.html
70a5c1da750698391f38ae9078123c300e7b7f94d9049a1656671c4ef170ddd1 docs/ja/claude-desktop.html
340a2efef621922fe180c72504ba773521614dbc9ba6f1e10abdc67e21a5df6e docs/ja/claude-science.html
3ea9c9c75770642d7e955ae411b72fea5fee3b736ee265092de712ddbee6c0e3 docs/ja/cline.html
@@ -265,7 +265,7 @@ ce89dc57e624b3a6074a466b229562757aefba85d6e53c8c7befb53eebf7e211 docs/zh/azure.
69f05976998e7fef6e4956e5d582ada80eabe6af1fa40aedecdb89004c4a0f2d docs/zh/cherry-studio.html
4c2c3935ec37fbd2980fbbc09618383a34ccb167736ea23a3a9bb480e38bc7b6 docs/zh/cindy.html
e68c87a169c685a761aae4c897a682dda9462fb5db9f46cac019baa15d743c80 docs/zh/claude-code-chatgpt.html
10e22645cb72c3645cea60628e452c1a993e1cb00634749b7e40329f6ff62707 docs/zh/claude-code-models.html
85b5644b83cc91f7205636201e61b19ed85c87e08e43d3f922f8543e08cabefb docs/zh/claude-code-models.html
64b9613677e4c851737b50e51d27936e6c2ce40ded728c9c38ad978132cca1b3 docs/zh/claude-desktop.html
be83170c5e14d05f6af0ae379e9cebdc567ef750bb61d91c64aa658458d2b9b0 docs/zh/claude-science.html
e23fba9adafb074a572c7f339e7a1cf0d5ff0e57c4b2994d4b326398cc698525 docs/zh/cline.html
+10
View File
@@ -104,6 +104,14 @@
"text": "The Claude Code row has a sign-in setting. With magpie’s key, the default, Claude Code is signed out of claude.ai while it runs through magpie, so the plan limits in /usage, connectors, voice and /teleport are off. With claude.ai it keeps its sign-in, which magpie never passes on. Remote Control and ultrareview stay off either way."
}
},
{
"@type": "Question",
"name": "Does Claude Code’s Code Mode work through magpie?",
"acceptedAnswer": {
"@type": "Answer",
"text": "No. Claude Code turns Code Mode on only when it talks to Anthropic’s API directly: with ANTHROPIC_BASE_URL pointing anywhere but api.anthropic.com, or with ANTHROPIC_AUTH_TOKEN set, it starts with the ordinary tools and says “it only works directly with the Anthropic API”. That is a check in Claude Code, and it holds for every model magpie serves, a Claude subscription’s or an Anthropic API key’s included. To use Code Mode, pick one of Claude Code’s own models in magpie so it goes straight to Anthropic, then start claude with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1. Code Mode also needs the feature flags Claude Code downloads, so leave Claude Code’s telemetry on in magpie’s Agents page."
}
},
{
"@type": "Question",
"name": "Can I use my Claude subscription and DeepSeek side by side?",
@@ -287,6 +295,8 @@ magpie claude codex/gpt-5.5</pre></div>
<p>Yes, while Claude Code is on a model through magpie: the gateway runs with the app. <code>magpie daemon install</code> keeps it running as a service with no window.</p>
<h3>Can I keep my claude.ai sign-in?</h3>
<p>The Claude Code row has a sign-in setting. With <span class="ui">magpie’s key</span>, the default, Claude Code is signed out of claude.ai while it runs through magpie, so the plan limits in <code>/usage</code>, connectors, voice and <code>/teleport</code> are off. With <span class="ui">claude.ai</span> it keeps its sign-in, which magpie never passes on. Remote Control and ultrareview stay off either way.</p>
<h3>Does Claude Code’s Code Mode work through magpie?</h3>
<p>No. Claude Code turns Code Mode on only when it talks to Anthropic’s API directly: with <code>ANTHROPIC_BASE_URL</code> pointing anywhere but <code>api.anthropic.com</code>, or with <code>ANTHROPIC_AUTH_TOKEN</code> set, it starts with the ordinary tools and says “it only works directly with the Anthropic API”. That is a check in Claude Code, and it holds for every model magpie serves, a Claude subscription’s or an Anthropic API key’s included. To use Code Mode, pick one of Claude Code’s own models in magpie so it goes straight to Anthropic, then start <code>claude</code> with <code>CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1</code>. Code Mode also needs the feature flags Claude Code downloads, so leave Claude Code’s telemetry on in magpie’s Agents page.</p>
<h3>Can I use my Claude subscription and DeepSeek side by side?</h3>
<p>Yes. Sign in to Claude in magpie and its models are <code>claude/…</code> in the same picker. Requests on a Claude subscription run through the Claude Code installed on your computer.</p>
<h3>How do I undo it?</h3>
@@ -104,6 +104,14 @@
"text": "Claude Code の行にサインインの設定があります。デフォルトの magpie’s key では、Claude Code が magpie 経由で動いている間は claude.ai からサインアウトされるため、/usage のプラン上限、コネクタ、音声、/teleport は使えません。claude.ai にするとサインインは保たれ、magpie がそれを外に渡すことはありません。Remote Control と ultrareview はどちらの場合も使えません。"
}
},
{
"@type": "Question",
"name": "Claude Code の Code Mode は magpie 経由で使えますか?",
"acceptedAnswer": {
"@type": "Answer",
"text": "使えません。Claude Code が Code Mode を有効にするのは Anthropic の API に直接つなぐときだけです。ANTHROPIC_BASE_URL が api.anthropic.com 以外を指しているか、ANTHROPIC_AUTH_TOKEN が設定されていると、通常のツールで起動し “it only works directly with the Anthropic API” と表示します。これは Claude Code 自身のチェックで、Claude サブスクリプションや Anthropic API キーのモデルも含め、magpie が提供するすべてのモデルで同じです。Code Mode を使うには、magpie で Claude Code 自身のモデルを選んで Anthropic に直接つながるようにし、CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 で claude を起動します。Code Mode は Claude Code がダウンロードする機能フラグも必要とするため、magpie の Agents ページで Claude Code のテレメトリーをオフにしないでください。"
}
},
{
"@type": "Question",
"name": "Claude のサブスクリプションと DeepSeek を併用できますか?",
@@ -287,6 +295,8 @@ magpie claude codex/gpt-5.5</pre></div>
<p>はい。Claude Code が magpie 経由のモデルを使っている間は必要です。ゲートウェイはアプリと一緒に動きます。<code>magpie daemon install</code> を使うと、ウィンドウなしのサービスとして動き続けます。</p>
<h3>claude.ai のサインインはそのままにできますか?</h3>
<p>Claude Code の行にサインインの設定があります。デフォルトの <span class="ui">magpie’s key</span> では、Claude Code が magpie 経由で動いている間は claude.ai からサインアウトされるため、<code>/usage</code> のプラン上限、コネクタ、音声、<code>/teleport</code> は使えません。<span class="ui">claude.ai</span> にするとサインインは保たれ、magpie がそれを外に渡すことはありません。Remote Control と ultrareview はどちらの場合も使えません。</p>
<h3>Claude Code の Code Mode は magpie 経由で使えますか?</h3>
<p>使えません。Claude Code が Code Mode を有効にするのは Anthropic の API に直接つなぐときだけです。<code>ANTHROPIC_BASE_URL</code> が <code>api.anthropic.com</code> 以外を指しているか、<code>ANTHROPIC_AUTH_TOKEN</code> が設定されていると、通常のツールで起動し “it only works directly with the Anthropic API” と表示します。これは Claude Code 自身のチェックで、Claude サブスクリプションや Anthropic API キーのモデルも含め、magpie が提供するすべてのモデルで同じです。Code Mode を使うには、magpie で Claude Code 自身のモデルを選んで Anthropic に直接つながるようにし、<code>CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1</code> で <code>claude</code> を起動します。Code Mode は Claude Code がダウンロードする機能フラグも必要とするため、magpie の Agents ページで Claude Code のテレメトリーをオフにしないでください。</p>
<h3>Claude のサブスクリプションと DeepSeek を併用できますか?</h3>
<p>はい。magpie で Claude にサインインすると、そのモデルが同じピッカーに <code>claude/…</code> として並びます。Claude サブスクリプションでのリクエストは、コンピューターにインストールされた Claude Code を通じて送られます。</p>
<h3>元に戻すには?</h3>
@@ -104,6 +104,14 @@
"text": "Claude Code 那一行有个登录方式设置。默认的 magpie 的密钥 下,Claude Code 接入 magpie 期间会退出 claude.ai,所以 /usage 里的套餐额度、connectors、语音和 /teleport 不可用。选 claude.ai 则保留登录,magpie 不会把它转发出去。两种方式下 Remote Control 和 ultrareview 都不可用。"
}
},
{
"@type": "Question",
"name": "Claude Code 的 Code Mode 能通过 magpie 用吗?",
"acceptedAnswer": {
"@type": "Answer",
"text": "不能。Claude Code 只在直连 Anthropic API 时才开启 Code Mode:ANTHROPIC_BASE_URL 指向 api.anthropic.com 以外的地址,或设置了 ANTHROPIC_AUTH_TOKEN 时,它会用普通工具启动,并提示 “it only works directly with the Anthropic API”。这是 Claude Code 自己的检查,对 magpie 提供的所有模型都一样,包括 Claude 订阅和 Anthropic API key 的模型。要用 Code Mode,在 magpie 里给 Claude Code 选它自己的模型,让它直连 Anthropic,再用 CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 启动 claude。Code Mode 还需要 Claude Code 下载的功能开关,所以别在 magpie 的 Agents 页面关掉 Claude Code 的遥测。"
}
},
{
"@type": "Question",
"name": "Claude 订阅和 DeepSeek 能一起用吗?",
@@ -287,6 +295,8 @@ magpie claude codex/gpt-5.5</pre></div>
<p>Claude Code 用的是经过 magpie 的模型时,需要:网关跟着应用运行。<code>magpie daemon install</code> 可以把它装成后台服务,不开窗口。</p>
<h3>能保留 claude.ai 的登录吗?</h3>
<p>Claude Code 那一行有个登录方式设置。默认的 <span class="ui">magpie 的密钥</span> 下,Claude Code 接入 magpie 期间会退出 claude.ai,所以 <code>/usage</code> 里的套餐额度、connectors、语音和 <code>/teleport</code> 不可用。选 <span class="ui">claude.ai</span> 则保留登录,magpie 不会把它转发出去。两种方式下 Remote Control 和 ultrareview 都不可用。</p>
<h3>Claude Code 的 Code Mode 能通过 magpie 用吗?</h3>
<p>不能。Claude Code 只在直连 Anthropic API 时才开启 Code Mode:<code>ANTHROPIC_BASE_URL</code> 指向 <code>api.anthropic.com</code> 以外的地址,或设置了 <code>ANTHROPIC_AUTH_TOKEN</code> 时,它会用普通工具启动,并提示 “it only works directly with the Anthropic API”。这是 Claude Code 自己的检查,对 magpie 提供的所有模型都一样,包括 Claude 订阅和 Anthropic API key 的模型。要用 Code Mode,在 magpie 里给 Claude Code 选它自己的模型,让它直连 Anthropic,再用 <code>CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1</code> 启动 <code>claude</code>。Code Mode 还需要 Claude Code 下载的功能开关,所以别在 magpie 的 Agents 页面关掉 Claude Code 的遥测。</p>
<h3>Claude 订阅和 DeepSeek 能一起用吗?</h3>
<p>能。在 magpie 里登录 Claude,它的模型以 <code>claude/…</code> 出现在同一个列表里。Claude 订阅的请求通过你电脑上安装的 Claude Code 发出。</p>
<h3>怎么撤销?</h3>
+4
View File
@@ -448,6 +448,10 @@ Yes, while Claude Code is on a model through magpie: the gateway runs with the a
The Claude Code row has a sign-in setting. With magpie’s key, the default, Claude Code is signed out of claude.ai while it runs through magpie, so the plan limits in `/usage`, connectors, voice and `/teleport` are off. With claude.ai it keeps its sign-in, which magpie never passes on. Remote Control and ultrareview stay off either way.
### Does Claude Code’s Code Mode work through magpie?
No. Claude Code turns Code Mode on only when it talks to Anthropic’s API directly: with `ANTHROPIC_BASE_URL` pointing anywhere but `api.anthropic.com`, or with `ANTHROPIC_AUTH_TOKEN` set, it starts with the ordinary tools and says “it only works directly with the Anthropic API”. That is a check in Claude Code, and it holds for every model magpie serves, a Claude subscription’s or an Anthropic API key’s included. To use Code Mode, pick one of Claude Code’s own models in magpie so it goes straight to Anthropic, then start `claude` with `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1`. Code Mode also needs the feature flags Claude Code downloads, so leave Claude Code’s telemetry on in magpie’s Agents page.
### Can I use my Claude subscription and DeepSeek side by side?
Yes. Sign in to Claude in magpie and its models are `claude/…` in the same picker. Requests on a Claude subscription run through the Claude Code installed on your computer.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long