Gateway 配置

配置 OpenClaw Gateway — 所有渠道和 Agent 的中央路由中枢。

概述

Gateway 是 OpenClaw 的核心组件。它管理所有渠道连接、将消息路由到 Agent,并处理会话管理。

启动 Gateway

# 作为后台守护进程启动
openclaw gateway --daemon

# 前台启动(用于调试)
openclaw gateway --port 18789

配置

Gateway 在 ~/.openclaw/openclaw.json 中配置:

{
  "gateway": {
    "port": 18789,
    "host": "127.0.0.1",
    "logLevel": "info"
  }
}

关键选项

选项说明默认值
port控制面板和 API 的 HTTP 端口18789
host绑定地址127.0.0.1
logLevel日志级别(debug, info, warn, error)info

Gateway 管理

# 检查状态
openclaw gateway status

# 停止守护进程
openclaw service stop

# 重启
openclaw service restart

# 查看日志
openclaw logs --follow

远程访问

通过 Tailscale

{
  "gateway": {
    "host": "0.0.0.0",
    "tailscale": true
  }
}

通过 SSH 隧道

ssh -L 18789:localhost:18789 user@remote-server

控制面板

访问 http://127.0.0.1:18789/

openclaw dashboard

下一步