🤖 OpenClaw 安装与配置完全指南
打造属于你的个人 AI 助手,无缝接入 Telegram & 飞书
📋 目录
🎯 OpenClaw 简介
OpenClaw 是一个开源的 AI 助手框架,让你能够将各种大语言模型(LLM)接入到日常使用的通讯工具中。
✅ 多平台支持
Telegram、飞书、Discord、Slack
✅ 丰富工具
搜索、文件操作、代码执行
✅ 跨平台同步
随时随地访问你的 AI 助手
✅ 可扩展
Skills 技能系统,无限可能
💻 系统要求
| 操作系统 | macOS 12+ (Monterey) |
| Node.js | v18+(推荐 v20+) |
| 内存 | 至少 4GB 可用内存 |
| 网络 | 稳定的互联网连接 |
📦 安装 OpenClaw
方式一:npm 安装(推荐)
# 使用 npm 全局安装 npm install -g openclaw # 或使用 pnpm pnpm add -g openclaw
方式二:Homebrew 安装
brew tap openclaw/openclaw brew install openclaw
验证安装
openclaw --version # 应显示版本号,如:2026.3.1
初始化配置
openclaw init
按提示完成:
- 选择默认 AI 模型(如 Kimi、DeepSeek、Claude)
- 配置 API 密钥
- 设置工作目录(默认:
~/.openclaw)
⚙️ 基础配置
配置文件位置
~/.openclaw/openclaw.json
配置模型 API
编辑配置文件,添加你的 API 密钥:
{
"models": {
"moonshot": {
"apiKey": "your-moonshot-api-key",
"baseURL": "https://api.moonshot.cn/v1"
},
"deepseek": {
"apiKey": "your-deepseek-api-key"
},
"anthropic": {
"apiKey": "your-claude-api-key"
}
},
"defaultModel": "moonshot/kimi-k2.5"
}
启动 Gateway 服务
# 启动服务 openclaw gateway start # 查看状态 openclaw gateway status # 设置开机自启 openclaw gateway install-service
🚀 配置 Telegram
Telegram 是最常用的 OpenClaw 接入方式,配置简单且完全免费。
📸 步骤 1:创建 Telegram Bot
图示说明:

- 在 Telegram 中搜索
@BotFather - 发送
/newbot命令 - 输入 Bot 名称(如:My AI Assistant)
- 输入 Bot 用户名(必须以
bot结尾,如:myai_bot) - 保存生成的 Bot Token(格式:123456789:ABCdef…)

⚙️ 步骤 2:配置 OpenClaw
使用命令行配置:
# 设置 Telegram Token
openclaw config set channels.telegram.token "your-bot-token"
# 启用 Telegram 频道
openclaw config set channels.telegram.enabled true
或手动编辑配置文件:
{
"channels": {
"telegram": {
"enabled": true,
"token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
"accounts": ["default"]
}
}
}
🔄 步骤 3:重启 & 测试
openclaw gateway restart
测试连接:
- 在 Telegram 中找到你的 Bot
- 发送
/start或直接发消息 - AI 助手应立即回复!

🚀 配置飞书(Feishu)
飞书是国内常用的企业协作平台,OpenClaw 提供完整的飞书支持。
📸 步骤 1:创建飞书应用

- 访问 飞书开放平台
- 点击「创建企业自建应用」
- 填写应用名称和描述
- 记录 App ID 和 App Secret

🔐 步骤 2:配置权限

在应用后台的「权限管理」中,添加以下权限:
| 权限名称 | 说明 |
|---|---|
im:chat:readonly | 读取群组信息 |
im:message:send_as_bot | 以机器人身份发送消息 |
im:message.group_msg | 发送群组消息 |
im:message.p2p_msg | 发送单聊消息 |
📡 步骤 3:配置事件订阅

- 进入「事件订阅」页面
- 开启「接收消息」事件
- 记录 Verification Token 和 Encrypt Key
⚙️ 步骤 4:配置 OpenClaw
# 设置飞书配置
openclaw config set channels.feishu.appId "cli_xxxxxxxxxx"
openclaw config set channels.feishu.appSecret "xxxxxxxxxx"
openclaw config set channels.feishu.verificationToken "xxxxxxxxxx"
openclaw config set channels.feishu.encryptKey "xxxxxxxxxx"
或手动编辑 ~/.openclaw/openclaw.json:
{
"channels": {
"feishu": {
"enabled": true,
"appId": "cli_xxxxxxxxxx",
"appSecret": "xxxxxxxxxxxxxxxxxxxxxx",
"verificationToken": "xxxxxxxxxx",
"encryptKey": "xxxxxxxxxx"
}
}
}
🚀 步骤 5:发布应用

- 在飞书后台点击「版本管理与发布」
- 创建版本并填写发布说明
- 点击「申请发布」
- 等待管理员审批(个人测试可立即通过)
💬 步骤 6:添加机器人到聊天

- 在飞书中搜索你的应用名称
- 添加为联系人,或添加到群组
- @机器人并发送消息测试
💡 日常使用
常用命令
| 命令 | 说明 |
|---|---|
openclaw status | 查看系统状态 |
openclaw logs --follow | 实时查看日志 |
openclaw gateway restart | 重启服务 |
openclaw update | 更新版本 |
openclaw security audit | 安全检查 |
技能管理
# 列出已安装技能
openclaw skills list
# 安装新技能
openclaw skills install weather
# 更新所有技能
openclaw skills update
❓ 常见问题
Q: 安装后无法启动 gateway?
A: 检查 Node.js 版本(需 v18+),并查看日志:openclaw logs --follow
Q: Telegram Bot 没有响应?
- 确认 Token 正确
- 检查 gateway 是否运行
- 查看日志排查错误
Q: 飞书收不到消息?
- 确认应用已发布
- 检查权限是否全部添加
- 确认 Bot 已被添加到聊天
- 查看事件订阅配置
📚 参考链接
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)