CodePilot icon indicating copy to clipboard operation
CodePilot copied to clipboard

使用 cc-switch 后一直报错无法使用

Open Alpstx opened this issue 7 months ago • 6 comments

由于 CodePilot 不支持 Copilot 服务商,所以使用 cc-switch 做了代理,代理后 在终端 ClaudeCode可以正常使用。但是在 CodePilot 使用时一直提示以下错误:

**Error:** Claude Code process exited with an error. Common causes:
• Invalid or missing API Key
• Incorrect Base URL configuration
• Network connectivity issues
• Thinking mode may not be supported

**What to do:** Check your API key and provider settings. Run Provider Doctor in Settings for detailed diagnostics.

[Open Settings](/settings#providers)

截图: CodePilot

Image

ClaudeCode

Image

Alpstx avatar Apr 14 '26 08:04 Alpstx

安装 0.46.0 版本,不要更新。

patgdut avatar Apr 14 '26 10:04 patgdut

安装 0.46.0 版本,不要更新。

神医啊,可以用了

Alpstx avatar Apr 15 '26 09:04 Alpstx

修复在 v0.50.2 发布:https://github.com/op7418/CodePilot/releases/tag/v0.50.2

根因:之前 CodePilot 对 cc-switch 写入 ~/.claude/settings.json 的凭据归属判定有问题。简单说,当你在 CodePilot 里显式选了一个 provider 时,cc-switch 设置的 ANTHROPIC_* 环境变量不应该混进去,否则 auth 和 base URL 会走错。

这版的修法(详见 cc-switch-credential-bridge 执行计划):

  • env group(即内建的 "Claude Code" 组)继续完整尊重 ~/.claude/settings.json,cc-switch 路径不变
  • 显式 DB provider 的请求走 shadow HOME 隔离:临时复制 ~/.claude/settings.json 并剥掉 13 个 auth/routing 相关的 key(保留 mcpServers / hooks / enabledPlugins / permissions 等非认证配置)
  • 其余 ~/.claude/ 目录通过 symlink(Unix)/ junction(Windows 目录)/ copy(Windows 文件 fallback)镜像保留,不破坏你已有的 skills、agents、commands

这样你用 cc-switch 做代理、同时在 CodePilot 里选了 provider,两边不再打架。

升级后再试一下,如果还报错麻烦贴截图。

op7418 avatar Apr 15 '26 11:04 op7418

v0.50.3 发布:https://github.com/op7418/CodePilot/releases/tag/v0.50.3

延续 v0.50.2 的 cc-switch 凭据隔离修复,这版从根上简化了引擎选择逻辑——去掉了"自动"模式里的凭据推断,改成只看 CLI 装没装。cc-switch 写入 settings.json 的凭据归 CLI 自己管,CodePilot 不再试图猜。

升级后首次发消息可能会被引导去"设置 → 服务商"添加一个 CodePilot 服务商(如果之前只靠 cc-switch 没在 CodePilot 里配过)。添加一次后后续不受影响。

v0.46.0 回退的用户可以升回来了。

op7418 avatar Apr 16 '26 02:04 op7418

我是openAi风格的第三方api,cc switch里边直接配置http://xxxxx.com/v1就行,在codePilot要怎么配置呢

fallendx avatar Apr 16 '26 14:04 fallendx

v0.50.3 发布:https://github.com/op7418/CodePilot/releases/tag/v0.50.3

延续 v0.50.2 的 cc-switch 凭据隔离修复,这版从根上简化了引擎选择逻辑——去掉了"自动"模式里的凭据推断,改成只看 CLI 装没装。cc-switch 写入 settings.json 的凭据归 CLI 自己管,CodePilot 不再试图猜。

升级后首次发消息可能会被引导去"设置 → 服务商"添加一个 CodePilot 服务商(如果之前只靠 cc-switch 没在 CodePilot 里配过)。添加一次后后续不受影响。

v0.46.0 回退的用户可以升回来了。

Image Image Image

你好,我这边还是不行,不知道什么原因

Alpstx avatar Jun 02 '26 09:06 Alpstx