Claude Code自动代码工具安装配置使用
1.安装Claude Code
在命令行执行:
安装:
npm install -g @anthropic-ai/claude-code -registry=https://registry.npmmirror.com
更新:(可每日更新)
npm update -g @anthropic-ai/claude-code -registry=https://registry.npmmirror.com
2. 设置~/.claude/settings.json配置文件
windows环境该文件需要在C:\Users\<你的用户名>\.claude\settings.json下自己建
文件内容:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "pk-xxxxxx",
"ANTHROPIC_BASE_URL": "https://modelservice.jdcloud.com/coding/anthropic",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "DeepSeek-V3.2",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "GLM-5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M2.5",
"ANTHROPIC_MODEL": "DeepSeek-V3.2",
"ANTHROPIC_REASONING_MODEL": "GLM-5",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
},
"model": "opus",
"enabledPlugins": {
"code-simplifier@claude-plugins-official": true,
"compound-engineering@every-marketplace": true,
"pua@pua-skills": true,
"ralph-loop@claude-plugins-official": true,
"superpowers@claude-plugins-official": true
},
"alwaysThinkingEnabled": true
}
可在该文件下,修改或新增配置模型,我这边用的京东的coding plan提供的编码模型
可以使用CC Switch, 是专门给 Claude Code 做多提供商切换的工具,Windows/macOS/Linux 都有。
https://github.com/farion1231/cc-switch/releases
可以使用CC Switch, 是专门给 Claude Code 做多提供商切换的工具,Windows/macOS/Linux 都有。
https://github.com/farion1231/cc-switch/releases
3. 设置~/.claude.json配置文件
windows环境该文件在C:\Users\<你的用户名>\claude.json,安装完就存在的
内容会根据你的操作,更新,需要重点配置的是:
修改或新增 hasCompletedOnboarding 字段值为 true
{
"hasCompletedOnboarding": true
}
说明:这一步非常重要,不设置将导致启动 claude 要求走官方订阅。
4. 启动
claude g
5. 切换模型
启动时:执行claude --model <Model_Name>,可指定对应的模型。
对话期间:执行/model <Model_Name>切换模型。
注意:本文归作者所有,未经作者允许,不得转载