主题
OpenClaw 配置指南
📌 关于 OpenClaw
OpenClaw 是一款强大的 AI 编码助手工具,支持通过自定义 API 接入服务。
- Website: https://openclaw.ai/
- GitHub: openclaw/openclaw
注意
因为 Clawdbot 改名,有些插件 SDK 安装的时候注意如果安装失败,要改成 OpenClaw。
一、本地部署
1. 安装 Node.js
访问 nodejs.org 下载 LTS 长期支持版(稳定性强,适合开发/生产环境)。
提示
Node.js 安装包自带 npm(包管理器),不用单独下载。
2. 安装 Git
访问 git-scm.com 下载安装。Windows 建议选 64 位版本。
3. 验证安装
bash
node -v
npm -v4. 安装 OpenClaw
bash
npm i -g openclaw二、核心配置流程
定位配置文件
| 操作系统 | 默认路径 |
|---|---|
| Windows | C:\Users\<Your_Username>\.openclaw\openclaw.json |
| macOS / Linux | ~/.openclaw/openclaw.json |
添加自定义 Provider(关键步骤)
在配置文件中,将以下 JSON 代码片段加入到 models.providers 块中:
json
"models": {
"providers": {
"claude": {
"baseUrl": "https://www.laoge.xin",
"apiKey": "sk-xxxxxx你的网站获取的秘钥",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}添加 agents.defaults(关键步骤)
告知 OpenClaw 优先使用该节点:
json
"agents": {
"defaults": {
"model": {
"primary": "claude/claude-opus-4-6"
},
"models": {
"claude/claude-opus-4-6": {
"alias": "claude-opus-4-6"
}
}
}
}三、启动服务
启动网关服务
bash
openclaw gateway打开链接
http://localhost:18789提示
请使用 auto 分组的令牌。
阿里云配置教程
📖 官方文档
使用以下 JSON 配置模板,替换自己的密钥:
json
"models": {
"providers": {
"claude": {
"baseUrl": "https://www.laoge.xin",
"apiKey": "sk-xxxxxxx秘钥",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "claude/claude-opus-4-6"
},
"models": {
"claude/claude-opus-4-6": {
"alias": "claude-opus-4-6"
}
}
}
}配置说明:
- 将
sk-xxxxxxx秘钥替换为您从网站获取的实际令牌 baseUrl使用https://www.laoge.xinapi协议选择anthropic-messages- 模型使用
claude-opus-4-6
腾讯云配置教程
在自定义服务器里面选择自定义模型配置,使用以下 JSON 配置模板:
json
{
"provider": "openai",
"base_url": "https://www.laoge.xin",
"api": "anthropic-messages",
"api_key": "sk-xxxxxxxxx",
"model": {
"id": "claude-opus-4-6",
"name": "claude-opus-4-6"
}
}通用配置模板
如果需要其他模型,可以使用以下通用模板接入任何兼容 OpenAI/Anthropic 协议的模型:
json
{
"provider": "openai",
"base_url": "https://www.laoge.xin",
"api": "anthropic-messages",
"api_key": "sk-xxxxxxxxx",
"model": {
"id": "claude-opus-4-6",
"name": "claude-opus-4-6"
}
}参数说明:
| 参数 | 说明 |
|---|---|
provider | 提供商名称(可自定义) |
base_url | API 接入点 |
api | API 协议类型(openai-completions 或 anthropic-messages) |
api_key | 您的令牌 |
model.id | 模型标识符 |
model.name | 模型显示名称 |
