OpenClaw 钉钉对接配置文档
OpenClaw 钉钉对接配置文档
环境信息
- 服务器:Linux Ubuntu 24.04
- OpenClaw 版本:2026.3.13
- AI 供应商:open1.codes(OpenAI 兼容接口)
- 模型:gpt-5.4
一、核心配置文件
1. /root/.openclaw/openclaw.json
{"meta": {"lastTouchedVersion": "2026.3.13","lastTouchedAt": "2026-03-16T08:02:32.469Z"},"models": {"mode": "merge","providers": {"openai": {"apiKey": "你的API_KEY","baseUrl": "https://www.open1.codes","api": "openai-completions","models": [{"id": "gpt-5.4","name": "gpt-5.4"}]}}},"agents": {"defaults": {"model": {"primary": "openai/gpt-5.4"},"models": {"openai/gpt-5.4": {}},"workspace": "/root/.openclaw/workspace"}},"channels": {"dingtalk-connector": {"enabled": true,"clientId": "你的钉钉clientId","clientSecret": "你的钉钉clientSecret","gatewayToken": "你的gatewayToken","gatewayUrl": "http://127.0.0.1:18789","sessionTimeout": 1800000}},"plugins": {"entries": {"dingtalk-connector": {"enabled": true}},"installs": {"dingtalk-connector": {"source": "path","sourcePath": "/root/.openclaw/extensions/dingtalk-connector","installPath": "/root/.openclaw/extensions/dingtalk-connector","version": "0.6.0","installedAt": "2026-03-16T00:00:00.000Z"}}},"tools": {"profile": "minimal"},"commands": {"native": "auto","nativeSkills": "auto","restart": true,"ownerDisplay": "raw"},"session": {"dmScope": "per-channel-peer"},"gateway": {"port": 18789,"mode": "local","bind": "loopback","auth": {"mode": "none"},"http": {"endpoints": {"chatCompletions": {"enabled": true}}},"tailscale": {"mode": "off","resetOnExit": false},"nodes": {"denyCommands": ["camera.snap","camera.clip","screen.record","contacts.add","calendar.add","reminders.add","sms.send"]}}}
2. /root/.openclaw/agents/main/agent/models.json
{"providers": {"openai": {"baseUrl": "https://www.open1.codes","apiKey": "你的API_KEY","api": "openai-completions","models": [{"id": "gpt-5.4","name": "gpt-5.4","reasoning": false,"input": ["text"],"cost": {"input": 0,"output": 0,"cacheRead": 0,"cacheWrite": 0},"contextWindow": 200000,"maxTokens": 8192,"api": "openai-completions"}]}}}
3. systemd 服务 override(解决代理冲突问题)
文件路径:~/.config/systemd/user/openclaw-gateway.service.d/override.conf
[Service]Environment="no_proxy=127.0.0.1,localhost,::1"Environment="NO_PROXY=127.0.0.1,localhost,::1"
创建命令:
mkdir -p ~/.config/systemd/user/openclaw-gateway.service.dcat > ~/.config/systemd/user/openclaw-gateway.service.d/override.conf << 'EOF'[Service]Environment="no_proxy=127.0.0.1,localhost,::1"Environment="NO_PROXY=127.0.0.1,localhost,::1"EOFsystemctl --user daemon-reloadsystemctl --user restart openclaw-gateway.service
二、关键配置说明
| 配置项 | 正确值 | 说明 |
|---|---|---|
| models.providers.openai.api | openai-completions | 必须用 completions 格式,不能用 responses |
| gateway.auth.mode | none | 关闭本地认证,允许插件内部调用 |
| gateway.http.endpoints.chatCompletions.enabled | true | 开启 HTTP chat 接口供插件使用 |
| channels.dingtalk-connector.gatewayUrl | http://127.0.0.1:18789 | 插件调用 gateway 的本地地址 |
| no_proxy(systemd override) | 127.0.0.1,localhost,::1 | 绕过系统代理,让本地请求直连 |
三、常用运维命令
# 重启 gatewayopenclaw gateway restart# 查看运行状态openclaw status# 查看实时日志openclaw logs --follow# 验证模型状态openclaw models status# 终端对话测试openclaw tui
四、故障排查
问题1:fetch failed
原因:服务器设置了系统代理(http_proxy),导致本地 127.0.0.1 请求也走代理
解决:添加 systemd override 设置 no_proxy,让本地地址绕过代理
问题2:No reply from agent / 返回 0 字符
原因:api 字段设置为 openai-responses,与供应商的 /v1/chat/completions 接口不兼容
解决:openclaw.json 和 models.json 中的 api 都改为 openai-completions
问题3:Gateway error: 404
原因:gateway 未开启 HTTP chatCompletions 接口
解决:在 gateway 配置里添加 http.endpoints.chatCompletions.enabled 为 true
问题4:JSON 语法错误(SyntaxError)
原因:手动编辑时逗号、括号位置不对
解决:使用 AI 生成完整文件后上传覆盖,避免手动修改
问题5:LLM request timed out
原因:服务器网络访问 AI API 地址不稳定或走了代理
解决:检查网络连通性,确认 API 地址可访问