- claude code安装
1.1 依赖
安装 NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
重新加载 shell 配置
source ~/.bashrc
安装最新的 LTS 版本的 Node.js
nvm install --lts
验证安装
node --version
npm --version
安装 Claude Code
npm install -g @anthropic-ai/claude-code
验证安装
claude --version
安装 Claude Code Router
npm install -g @musistudio/claude-code-router
验证安装
ccr --version
1.2 配置
使用公开llm api
编辑~/.claude-code-router/config.json 文件
{
"PORT": 3456,
"Providers": [{
"name": "xxx",
"api_base_url": "xxx",
"api_key": "xxxxxx",
"models": ["xxx"],
"transformer": {
"use": ["openrouter"]
}
}
],
"Router": {"default": "xxx"}
}
启动服务
ccr start
进入需要编写的项目目录
cd ~/your_project
进入编程模式
ccr code