搞定了kimi k2或qwen 3 coder + claude code在windows下原生使用
Windows下使用claude code的障碍是shell环境(命令行),非posix风格shell无法正常让claude code读取到url和key, 导致无法使用。解决问题的本质是使用符合posix风格的shell环境,我们采用Windows自己的windows terminal (需要从windows store中下载)。
本质: claude code + windows terminal + git for windows (需要使用它的bash程序)
注意:需要安装 git for windows, windows terminal 需要调用git 目录下的bash.exe
如果你的git安装目录不是默认路径,需要设置环境变量指定位置:(例 如)
CLAUDE_CODE_GIT_BASH_PATH = C:\soft\apps\git\current\bin\bash.exe (这个路径与你的实际安装环境对应,不要照抄。默认安装git for windows 无需设置此环境变量)
windows
1. 安装 nodejs程序 (网上搜索windows安装包)
https://nodejs.org/dist/v22.17.1/node-v22.17.1-x64.msi
2. 安装 claude-code
npm install -g @anthropic-ai/claude-code
claude --version
3. 设置windows 环境变量
在系统高级设置中添加环境变量
ANTHROPIC_AUTH_TOKEN 及 ANTHROPIC_BASE_URL
3.1 Kimi K2模型:
ANTHROPIC_BASE_URL=https://api.moonshot.cn/anthropic/
ANTHROPIC_AUTH_TOKEN=你的kimi平台api_key (从Moonshot AI - 开放平台 申请,需要充值50块钱,否则会卡)
3.2 使用qwen 3 coder, 需要修改如下:
ANTHROPIC_BASE_URL=https://dashscope.aliyuncs.com/api/v2/apps/claude-code-proxy
ANTHROPIC_AUTH_TOKEN=你的阿里百炼平台 api key
4. 安装git for windows
5. 在Windows store中安装windows terminal
使用windows terminal 的命令行运行
输入claude then enjoy!