1. Claude Code 工具安装
https://code.claude.com/docs/en/overview
MacOS(推荐)
brew install --cask claude-code
MacOS, Linux, WSL
# 原生安装,需要科学上网
curl -fsSL https://claude.ai/install.sh | bash
2. Copliot API 工具安装
把Github Copilot 模型代理到本地端口, 方便 Claude Code 的模型配置
安装 copilot-api 命令
# node 版本建议 24 以上,版本太低会安装失败
npm install -g copilot-api
对于 claude code 2.1.15 版本社区 copilot-api 存在 bug,请使用以下二进制

image.png
MacOS:
二进制
启动代理
copilot-api start &
登陆 github copilot 账号后,显示以下内容表示代理已配置完成
1280X1280.PNG
3. Claude Code 基础配置
在 ~/.claude/settings.json 添加以下配置,文件若不存在需自行创建
{
"env": {
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"ANTHROPIC_BASE_URL": "http://localhost:4141",
"ANTHROPIC_AUTH_TOKEN": "dummy",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"ANTHROPIC_MODEL": "claude-opus-4.5"
},
"alwaysThinkingEnabled": true
}
在 ~/.zshrc 中添加以下环境变量,token 内容可以随便填,目的是为了跳过 claude 账号检测
export ANTHROPIC_AUTH_TOKEN="dummy"
4. 启动 Claude Code
进入项目根目录,执行命令 claude,第一次会进入初始化引导页面进行用户个性化的配置,配置后,在对话中执行 /model,输出当前模型为 claude-opus-4.5(settings.json中配置),则表示启动成功,如下图。

decf4d11-cefb-4501-9dbe-b896cd6aa807.png
附
- 如想在使用claude-code中切换copilot的模型,当前配置形式做不到,同时copilot-api不支持gpt-5.4模型,会报
API Error: 400
{"error":{"message":"{\"error\":{\"message\":\"model
\\\"gpt-5.4\\\" is not accessible via the
/chat/completions endpoint\",\"code\":\"unsupported_ap
i_for_model\"}}\n","type":"error"}}
可以安装opencode(类claude-code,windows下推荐wsl中安装),/provider 完成github copilot验证,即可用/model切换模型

292809f0-90e9-4ffa-9ad5-56b375b13650.png
- Windows下推荐安装Terminal,类似mac os的iterms