我用 Kimi K2 and GLM 4.5 替换了 Claude Code 默认模型
Claude Code 发布以来,编程能力是目前公认最强的,但是对国内不太友好,封控严重,国内一封一大片,我也在一直观望,否则秒封白折腾。
但是 7 月 11 号晚上 月之暗面发布 Kimi K2,总参数 1T,支持 Anthropic API,价格还便宜,可以替换 Claude Code 的默认模型,实现国内无痛用上 Claude Code
- Claude Code: Deep coding at terminal velocity \ Anthropic
- anthropics/claude-code: Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
最新 7 月 28 号,智谱发布 GLM 4.5,综合评分全球第三、开源第一,总参数 3550 亿,高速低成本,API 调用价格低至输入 0.8 元/百万 tokens、输出 2 元/百万 tokens,同样也支持 anthropic 格式的 API,直接爽炸!
1.1 替换 CC 默认模型
月之暗面的开发者后台申请 API Key,注册默认送 ¥15,https://platform.moonshot.cn/console/api-keys
要求安装 Node.js,版本 >= 18,安装 Claude Code:
1 | npm install -g @anthropic-ai/claude-code |
添加环境变量
1 | cat << 'EOF' >> ~/.zshrc |
如果是智谱的 GLM 4.5 模型,才采用下方的:
1 | cat << 'EOF' >> ~/.zshrc |
这样我们就把 Claude Code 默认的模型替换为 Kimi K2 或 GLM 4.5
1.2 绕过 Claude Code 认证
打开项目文件夹,终端启动 Claude Code
1 | cd your_project |
这时候就会弹出登录认证网页。
我们只需要 ctrl + c 停掉 Claude code,然后编辑 $HOME/.claude.json
添加新字段 "hasCompletedOnboarding": true
即可
最后我们在终端启动 claude
就可以开始对话了。
1.3 其他说明
对于月之暗面,Free 账户默认并发请求只有 1,至少累计冲 50 解锁“并发 50” 才能完全发挥 Claude Code 的实力。
1.4 总结
唯一槽点就是需要累积冲 50 提高并发能力才能丝滑使用 Claude Code。另外体验和编程能力肯定是没有原生 Claude 4 好,但是国内不会封号啊,这点很重要,而且价格还便宜。
这类 编程类的 AI Agent,背后有很多流程,我们只是把“决策大脑”从 Claude AI 替换成了 Kimi K2,其他的都还是用 Clade Code 自己的。