语言
November 2, 2026阅读约 3 分钟

Claude Code Remote Control 与 ANTHROPIC_BASE_URL 报错(2026)

当 ANTHROPIC_BASE_URL 指向 api.anthropic.com 以外的任何主机时,Claude Code Remote Control 就无法启动。取消设置该变量,或者在没有该变量的 shell 中运行 claude remote-control,报错就会消失。

即使你是用 claude.ai 登录的,也会遇到这个问题。如果常规会话需要自定义端点,可以用 Macky 把 Mac 的终端搬到 iPhone 上,继续在手机上工作。

报错信息及其原因

这条报错会指出是哪个设置让你的会话脱离了 Anthropic API。使用自定义基础 URL 时,报错内容如下:

Error: Remote Control is only available when using Claude via api.anthropic.com. ANTHROPIC_BASE_URL is set and does not point at api.anthropic.com, so this session is using a custom endpoint

完整报错还会提示你取消该变量,或在没有它的 shell 中运行。官方文档说明,网关或代理会触发此问题。兼容 Anthropic 的第三方代理也属于同一类情况。

解决方法

先检查当前 shell 中是否设置了该变量:

echo $ANTHROPIC_BASE_URL

如果输出了 URL,就取消设置,然后启动 Remote Control:

unset ANTHROPIC_BASE_URL claude remote-control

如果只想临时运行,不影响当前 shell,可以使用 env:

env -u ANTHROPIC_BASE_URL claude remote-control

如果每个新终端都还会报错,说明有东西在启动时设置了该变量。搜索你的 shell 配置文件:

grep -n ANTHROPIC_BASE_URL ~/.zshrc ~/.zprofile ~/.bash_profile

把 export 语句从配置文件中移出,只在需要代理的会话中设置。封装工具也可能覆盖该变量。有文档记录的一个例子是 caveman 工具。它的维护者表示,caveman claude remote-control 现在会识别该子命令,并在启动时不带覆盖设置。

不必理会 _CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL。报错文本说明它不适用于 Remote Control。

保留代理配置,同时仍能连到 Mac

Remote Control 绑定 api.anthropic.com,所以基于代理的配置无法使用它。Macky 可以让你在 iPhone 上使用 Mac 的终端。

iPhone 上的 Macky 终端截图,显示 Mac 上的 shell。

在手机上打开 Mac 的 shell,然后用你平时的环境运行 claude。连接为端到端加密,不需要开放任何端口。合盖后也能访问,所以 Mac 可以放在包里或架子上。

其他会阻止 Remote Control 的设置

自定义基础 URL 并不是唯一会阻止 Remote Control 的因素。根据文档,以下设置同样无法使用:

  • 其他服务商:Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 不可用。
  • API 密钥:不支持。你需要使用 claude.ai 账号登录。
  • 套餐:Pro、Max 或 Ultra。
  • Team 和 Enterprise:所有者(Owner)在管理设置中开启 Remote Control 开关后即可使用。
  • 网络:Remote Control 需要能通过 443 端口访问 Anthropic API。

退出登录时,你会看到“Remote Control requires a claude.ai subscription.”。使用 API 密钥或令牌时,也会出现同样的提示。

相关修复

其他报错请参阅 Claude Code Remote Control 无法使用?每种报错及修复方法。如果想用其他方式在手机上使用 Claude Code,请阅读 iPhone 与移动端上的 Claude Code。

常见问题

如何设置 Claude Code Remote Control?

在未设置 claude remote-control 的 shell 中运行 ANTHROPIC_BASE_URL。你需要使用 claude.ai 账号登录,并且套餐需受支持。完整设置说明见 Claude Code Remote Control:设置、限制与修复。

_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL 能解决报错吗?

不能。报错文本说明 _CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URL 不适用于 Remote Control。请改为取消设置 ANTHROPIC_BASE_URL。

能用 API 密钥使用 Remote Control 吗?

不能。文档说明不支持 API 密钥。Remote Control 需要使用支持的套餐并通过 claude.ai 登录。使用 API 密钥或令牌时,提示会显示“Remote Control requires a claude.ai subscription.”。

Remote Control 能和 Bedrock 或 Foundry 一起用吗?

不能。文档列出 Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 均不适用于 Remote Control。

试用 Macky

用你的 iPhone 连接 Mac 上的终端。