在开始部署前,请准备好以下信息:
- App ID:
cli_xxxxx(飞书开放平台创建应用后获取) - App Secret:
xxxxx(飞书开放平台创建应用后获取) - 获取地址:https://open.feishu.cn/app
选项 A:OpenRouter(推荐,支持免费模型)
- API Key:
sk-or-v1-xxxxx - 获取地址:https://openrouter.ai/settings/keys
- 免费模型:
openrouter/qwen/qwen3-coder:free
选项 B:通义千问 DashScope
- API Key:
sk-xxxxx - 获取地址:https://dashscope.console.aliyun.com/
- 注意:需通过 OpenRouter 访问
选项 C:MiniMax
- API Key:
xxxxx - 获取地址:https://www.minimaxi.com/
- macOS 系统
- 已安装 Homebrew
- 已安装 Node.js 22+(或使用 nvm)
# 下载并执行安装脚本 curl -fsSL https://openclaw.ai/install.sh | bash验证安装:
openclaw --version # 应输出:2026.3.1 或更高版本# 安装飞书插件 openclaw plugins install @openclaw/feishu手动配置飞书渠道:
编辑配置文件:
vim ~/.openclaw/openclaw.json在 channels 部分添加飞书配置:
{ "channels": { "feishu": { "appId": "cli_xxxxx", // 替换为你的 App ID "appSecret": "xxxxx", // 替换为你的 App Secret "enabled": true } } }确保配置文件中有 gateway.mode 设置:
openclaw config set gateway.mode "local"或手动编辑 ~/.openclaw/openclaw.json:
{ "gateway": { "mode": "local", "auth": { "mode": "token", "token": "自动生成的token" } } }# 重启 Gateway 服务 launchctl stop ai.openclaw.gateway sleep 3 launchctl start ai.openclaw.gateway sleep 5 # 检查服务状态 openclaw gateway status预期输出:
Runtime: running (pid xxxxx) RPC probe: ok Listening: 127.0.0.1:18789 1. 在飞书中给机器人发送任意消息
你会收到类似这样的回复:
OpenClaw: access not configured. Your Feishu user id: ou_xxxxx Pairing code: ABC12345 Ask the bot owner to approve with: openclaw pairing approve feishu ABC12345 2. 批准配对请求:
openclaw pairing approve feishu ABC123453. 验证配对成功:
openclaw channels status在飞书中 @机器人 发送消息:
你好,测试一下 机器人应该会正常回复。
错误信息:
Gateway start blocked: set gateway.mode=local 解决方案:
openclaw config set gateway.mode "local" launchctl restart ai.openclaw.gateway错误信息:
No API key found for provider "openrouter" 解决方案:
- 检查认证文件是否存在:
cat ~/.openclaw/agents/main/agent/auth-profiles.json-
确认格式正确(参考步骤 4)
-
重启 Gateway:
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist检查清单:
- Gateway 是否正常运行:
openclaw gateway status- 飞书渠道是否启用:
openclaw channels status- 用户是否已配对:
openclaw pairing list- 查看日志:
openclaw logs --follow- 主配置文件:
~/.openclaw/openclaw.json - 认证配置:
~/.openclaw/agents/main/agent/auth-profiles.json - 日志文件:
/tmp/openclaw/openclaw-YYYY-MM-DD.log - 服务配置:
~/Library/LaunchAgents/ai.openclaw.gateway.plist
# 查看配置 openclaw config file openclaw config get <path> # 模型管理 openclaw models list openclaw models status openclaw models set <model-id> # 渠道管理 openclaw channels list openclaw channels status # 服务管理 openclaw gateway status launchctl stop ai.openclaw.gateway launchctl start ai.openclaw.gateway # 查看日志 openclaw logs --follow # 健康检查 openclaw doctor- 定期轮换 API Key
- 不要将 API Key 提交到 Git 仓库
- 使用环境变量存储敏感信息(可选)
- 定期备份配置文件
# 检查更新 openclaw update check # 执行更新 openclaw update# 卸载 OpenClaw(保留 CLI) openclaw uninstall # 完全卸载(包括 CLI) npm uninstall -g openclaw rm -rf ~/.openclaw- OpenClaw 官网:https://openclaw.ai/
- 官方文档:https://docs.openclaw.ai/
- GitHub Issues:https://github.com/openclaw/openclaw/issues
- 飞书开放平台:https://open.feishu.cn/
- OpenRouter:https://openrouter.ai/
- Skill 版本: 1.0.0
- OpenClaw 版本: 2026.3.1
- 最后更新: 2026-03-03
- 测试环境: macOS (Darwin 22.6.0)