配置文件位于 ~/.openclaw/openclaw.json,以下是一份完整的参考模板,附带每个字段的说明。
{
"meta": {
"lastTouchedVersion": "2026.3.7",
"lastTouchedAt": "2026-03-08T18:02:22.355Z"
},
"wizard": {
"lastRunAt": "2026-03-08T07:14:06.984Z",
"lastRunVersion": "2026.3.2",
"lastRunCommand": "onboard",
"lastRunMode": "local"
},
"browser": {
"enabled": true,
"executablePath": "/usr/bin/google-chrome-stable",
"headless": true,
"noSandbox": true
},
"auth": {
"profiles": {
"anthropic:default": {
"provider": "anthropic",
"mode": "api_key"
}
}
},
"models": {
"mode": "merge",
"providers": {
"custom-proxy": {
"baseUrl": "https://code.aipor.cc",
"apiKey": "anthropic兼容的接口",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"api": "anthropic-messages",
"reasoning": true,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 180000,
"maxTokens": 32000
},
{
"id": "claude-sonnet-4-6",
"name": "claude-sonnet-4-6",
"api": "anthropic-messages",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 16384
}
]
},
"custom-openai": {
"baseUrl": "https://code.aipor.cc/v1",
"apiKey": "codex分组key",
"api": "openai-responses",
"models": [
{
"id": "gpt-5.4",
"name": "gpt-5.4",
"api": "openai-responses",
"reasoning": true,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 16384
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "custom-openai/gpt-5.4"
},
"models": {
"custom-proxy/claude-opus-4-6": {},
"custom-openai/gpt-5.4": {
"params": {
"reasoning": {
"effort": "xhigh"
}
}
}
},
"workspace": "/workspace",
"contextPruning": {
"mode": "cache-ttl",
"ttl": "1h"
},
"compaction": {
"mode": "safeguard"
},
"thinkingDefault": "xhigh",
"verboseDefault": "on",
"heartbeat": {
"every": "30m"
}
},
"list": [
{
"id": "main",
"model": "custom-proxy/claude-opus-4-6"
}
]
},
"tools": {
"profile": "full",
"web": {
"search": {
"provider": "brave",
"apiKey": "你的Brave搜索API密钥"
}
}
},
"commands": {
"native": "auto",
"nativeSkills": "auto",
"restart": true,
"ownerDisplay": "raw"
},
"session": {
"dmScope": "per-channel-peer"
},
"channels": {
"feishu": {
"enabled": true,
"domain": "feishu",
"accounts": {
"main": {
"appId": "你的飞书AppID",
"appSecret": "你的飞书AppSecret"
}
},
"dmPolicy": "open"
}
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"allowedOrigins": [
"http://localhost:18789",
"http://127.0.0.1:18789",
"http://你的服务器IP:18789"
],
"dangerouslyDisableDeviceAuth": false
},
"auth": {
"mode": "token",
"token": "你的网关认证Token"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
"plugins": {
"entries": {
"feishu": {
"enabled": true
}
}
}
}
models — 模型配置| 字段 | 说明 |
|---|---|
mode |
merge 表示与内置模型合并 |
providers |
自定义模型提供商 |
baseUrl |
API 代理地址 |
api |
API 格式:anthropic-messages 或 openai-responses |
reasoning |
是否支持扩展思考 |
contextWindow |
上下文窗口大小(token) |
maxTokens |
最大输出 token |
cost |
费用配置(自建代理可设为 0) |
agents — Agent 配置| 字段 | 说明 |
|---|---|
model.primary |
默认使用的模型 |
thinkingDefault |
思考深度:off / low / medium / high / xhigh |
verboseDefault |
详细模式:on / off |
heartbeat.every |
心跳检查间隔 |
contextPruning |
上下文裁剪策略 |
compaction.mode |
压缩模式:safeguard 安全模式 |
agents.list — Agent 列表{
"id": "main",
"model": "custom-proxy/claude-opus-4-6"
}
每个 Agent 可以指定不同的模型。main 是默认的主 Agent。
gateway — 网关配置| 字段 | 说明 |
|---|---|
port |
网关端口(默认 18789) |
mode |
local 本地模式 |
bind |
lan 局域网绑定 |
controlUi.allowedOrigins |
控制面板允许的来源 |
auth.mode |
认证模式:token |
channels — 消息平台目前支持:feishu、telegram、discord、whatsapp、signal、slack、line
飞书配置需要:
- appId — 飞书开放平台的应用 ID
- appSecret — 应用密钥
- dmPolicy — open 允许所有人私聊
tools — 工具配置| 字段 | 说明 |
|---|---|
profile |
full 开放所有工具 |
web.search.provider |
搜索引擎:brave |
web.search.apiKey |
Brave Search API Key |
browser — 浏览器配置{
"enabled": true,
"executablePath": "/usr/bin/google-chrome-stable",
"headless": true,
"noSandbox": true
}
服务器环境建议开启 headless 和 noSandbox。
agents.list 中配置多个 Agent 使用不同模型openclaw gateway restart有配置问题欢迎回帖讨论!
666666666
我刚好在研究这个方向,有没有更多资料推荐?
同意。有时候最笨的方法反而最可靠。
学到了,感谢!
哈哈,这个描述太准确了 😂
写得很清楚,新手友好。给你点赞 👍
我刚好在研究这个方向,有没有更多资料推荐?
不错不错,继续加油!
我觉得这个功能以后会越来越重要。
写得很清楚,新手友好。给你点赞 👍