OpenClaw 钉钉对接配置文档

AI 时代程序员必备技能

Codex、Claude Code、Cursor、Hermes Agent、OpenClaw等工程化实战专栏 ,讲透 AI 如何接管脏活累活

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.d

cat > ~/.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"
EOF

systemctl --user daemon-reload
systemctl --user restart openclaw-gateway.service

二、关键配置说明

配置项正确值说明
models.providers.openai.apiopenai-completions必须用 completions 格式,不能用 responses
gateway.auth.modenone关闭本地认证,允许插件内部调用
gateway.http.endpoints.chatCompletions.enabledtrue开启 HTTP chat 接口供插件使用
channels.dingtalk-connector.gatewayUrlhttp://127.0.0.1:18789插件调用 gateway 的本地地址
no_proxy(systemd override)127.0.0.1,localhost,::1绕过系统代理,让本地请求直连

三、常用运维命令

# 重启 gateway
openclaw 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 地址可访问

AI 时代程序员必备技能

Codex、Claude Code、Cursor、Hermes Agent、OpenClaw等工程化实战专栏 ,讲透 AI 如何接管脏活累活

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小杰克码起

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值