来源:docs.openclaw.ai/getting-started | github.com/openclaw/openclaw | 整理时间:2026-04-01
前置要求
- Node.js 24(推荐)或 Node.js 22.16+
- 一个 AI 模型的 API Key(Anthropic、OpenAI、Google 等)
- Windows 用户建议使用 WSL2
检查 Node 版本:
node --version
安装方式
方式一:一键安装脚本(推荐)
macOS / Linux:
curl -fsSL https://openclaw.ai/install.sh | bash
Windows PowerShell:
irm https://openclaw.ai/install.ps1 | iex
方式二:npm 安装
npm install -g openclaw@latest
# 或
pnpm add -g openclaw@latest
方式三:Docker
参见 Docker 安装文档
快速上手(5分钟)
第一步:运行引导向导
openclaw onboard --install-daemon
向导会引导你完成:
- 选择模型提供商(Anthropic/OpenAI/Google 等)
- 输入 API Key
- 配置 Gateway
- 连接你喜欢的聊天频道(Telegram 最简单)
第二步:验证 Gateway 运行中
openclaw gateway status
应该看到 Gateway 在 18789 端口运行。
第三步:打开控制台
openclaw dashboard
在浏览器中打开控制 UI,开始聊天!
第四步:连接 Telegram(可选,推荐)
- 在 @BotFather 创建机器人,获取 Token
- 编辑配置文件
~/.openclaw/openclaw.json:
{
"agent": {
"model": "anthropic/claude-opus-4-6"
},
"channels": {
"telegram": {
"botToken": "你的TOKEN"
}
}
}
- 重启 Gateway,在 Telegram 里开始对话!
聊天命令参考
在 WhatsApp/Telegram/Slack 等频道中可以用以下命令:
| 命令 | 功能 |
|---|---|
/status |
查看会话状态(模型/Token 用量/费用) |
/new 或 /reset |
重置会话 |
/compact |
压缩会话上下文(节省 Token) |
/think <level> |
设置思考深度:off/minimal/low/medium/high/xhigh |
/verbose on/off |
开关详细输出 |
/usage |
查看 Token 用量 |
/restart |
重启 Gateway(仅 owner) |
配置示例
最简配置 ~/.openclaw/openclaw.json:
{
"agent": {
"model": "anthropic/claude-opus-4-6"
}
}
支持的频道配置(按难易程度):
| 频道 | 难度 | 特点 |
|---|---|---|
| Telegram | ⭐ | 只需 Bot Token,最易上手 |
| Discord | ⭐⭐ | 需要创建 Discord App |
| ⭐⭐⭐ | 需要扫码绑定设备 | |
| Signal | ⭐⭐⭐ | 需要安装 signal-cli |
| iMessage | ⭐⭐⭐⭐ | 仅 macOS,推荐通过 BlueBubbles |
安全注意事项
OpenClaw 连接真实的通讯平台,请注意:
- 默认 DM 策略:未知发送者需要配对码才能与 Agent 对话
- 批准配对:
openclaw pairing approve <channel> <code> - 运行安全检查:
openclaw doctor - 沙箱模式:对非主会话(群组/频道)启用 Docker 隔离
{
"agents": {
"defaults": {
"sandbox": {
"mode": "non-main"
}
}
}
}
进阶:安装技能(Skills)
OpenClaw 的超能力在于社区技能生态:
# 搜索可用技能
openclaw skills search "github"
# 安装技能
openclaw skills install github-pr-reviewer
# 或者让 Agent 自己搜索和安装!
# 在聊天中说:"帮我找一个可以查看天气的技能"
技能市场:clawhub.ai(5400+ 技能)