OpenClaw接入胜算云API
OpenClaw 是开源 AI Agent 平台,支持 Node.js 22+/24+。通过胜算云统一 OpenAI 兼容接口,一个 Key 可调用数百种模型。
https://router.shengsuanyun.com/api/v1Bearer YOUR_API_KEY用 CC-Switch 一键接入胜算云
下载并安装 CC-Switch
打开 CC-Switch,点击 "供应商"
在供应商列表中选择 "胜算云"
输入你的 胜算云 API Key
勾选 "写入通用配置" 以覆盖已有配置
点击启用,重启对应工具即可使用
OpenClaw 使用 CC-Switch 注意事项
使用 CC-Switch 配置 OpenClaw 时,勾选 "写入通用配置"
选择供应商为"胜算云"后,API Key 和 Base URL 会自动填充
下载安装
macOS:支持 brew install 或直接下载 .dmg 安装包
Windows:下载 .msi 安装包,双击安装
Linux:提供 .deb 和 .rpm 安装包
支持 Claude Code、Codex、OpenCode、OpenClaw、Hermes Agent 等多工具一键配置
自动管理 API Key 和 Base URL,无需手动编辑配置文件
https://github.com/farion1231/cc-switch/releases CC-Switch GitHub 仓库 →
前置准备
安装最新版 OpenClaw
npm install -g openclaw@latest # 或使用中文优化版(推荐国内用户) npm install -g @qingchencloud/openclaw-zh@latest
验证:openclaw --version
获取胜算云 API Key
访问 胜算云官网 注册/登录 → 控制台生成 API Key
确认 Node.js 环境
node -v # 需 >= 22.14 或 24+
交互式向导配置(推荐新手)
运行命令:
openclaw onboard
向导步骤:
安全警告:输入 Yes 继续
配置模式:推荐选择 QuickStart
模型提供商:选择 Custom Provider → OpenAI Compatible
Base URL:https://router.shengsuanyun.com/api/v1
API Key:粘贴你的胜算云 Key
Model ID:如 openai/gpt-5.4、anthropic/claude-sonnet-4.6
启动验证
openclaw gateway status openclaw dashboard # 打开浏览器访问 http://127.0.0.1:18789
交互式配置面板(二次修改)
openclaw config
进入可视化面板,修改 Base URL、API Key、默认模型等,保存后自动校验。
CLI 快捷命令
openclaw config set models.providers.shengsuanyun.baseUrl "https://router.shengsuanyun.com/api/v1" openclaw config set models.providers.shengsuanyun.apiKey "sk-你的胜算云API Key" openclaw config set agents.defaults.model.primary "shengsuanyun/你的模型ID" openclaw config get models.providers.shengsuanyun
直接编辑配置文件
配置文件路径:~/.openclaw/openclaw.json(推荐备份后再编辑)
{
"models": {
"mode": "merge",
"providers": {
"shengsuanyun": {
"baseUrl": "https://router.shengsuanyun.com/api/v1",
"apiKey": "sk-你的胜算云API Key",
"api": "openai-completions",
"models": [
{ "id": "openai/gpt-5.4", "name": "胜算云-GPT-5.4" },
{ "id": "openai/gpt-5.4-mini", "name": "胜算云-GPT-5.4 Mini" }
]
}
}
}
}修改后生效:
openclaw gateway restart openclaw config validate
测试与常见问题
打开仪表板:openclaw dashboard
在已配置渠道发送消息测试
CLI 测试:openclaw tui chat
Base URL 必须带 /v1
推荐使用 @qingchencloud/openclaw-zh@latest,已内置"胜算云"预设
mode: "merge" 可同时保留官方模型和胜算云
更新:npm update -g openclaw@latest 后重新运行 openclaw onboard