快速开始 — 5 分钟上手你的第一个 AI Agent
- Node.js 18+(运行
node -v检查) - 一个消息平台账号(Telegram、Discord、飞书等)
- 一个 LLM API Key(OpenAI、Anthropic、智谱、Kimi 等均可)
第一步:安装 OpenClaw
Section titled “第一步:安装 OpenClaw”npm install -g openclaw验证安装:openclaw --version
第二步:初始化
Section titled “第二步:初始化”openclaw init这会创建 ~/.openclaw/ 目录,包含:
openclaw.json— 主配置文件workspace/— Agent 工作空间(AGENTS.md、SOUL.md、MEMORY.md)
第三步:设置 LLM 模型
Section titled “第三步:设置 LLM 模型”# 方案 A:OpenAIopenclaw config set model '"gpt-4o"' --jsonexport OPENAI_API_KEY="你的密钥"
# 方案 B:Anthropicopenclaw config set model '"claude-sonnet-4"' --jsonexport ANTHROPIC_API_KEY="你的密钥"
# 方案 C:国内模型(智谱 GLM)openclaw config set model '"glm-4"' --jsonopenclaw config set provider.baseUrl '"https://open.bigmodel.cn/api/paas/v4"' --json
# 方案 D:任意 OpenAI 兼容 API(中转站等)openclaw config set provider.baseUrl '"https://your-relay.com/v1"' --json第四步:连接消息渠道
Section titled “第四步:连接消息渠道”openclaw channels add# 选择平台 → 按提示操作| 平台 | 上手难度 | 指南 |
|---|---|---|
| Telegram | ⭐⭐⭐ 最简单 | Telegram 配置 |
| 飞书 / Lark | ⭐⭐⭐ 推荐 | 飞书配置 |
| Discord | ⭐⭐⭐ | Discord 配置 |
| ⭐⭐ | WhatsApp 配置 | |
| 网页版 | 内置 | openclaw gateway → 访问 localhost |
第五步:启动网关
Section titled “第五步:启动网关”openclaw gateway向你的 Bot 发一条消息,你会收到配对码:
openclaw pairing list <channel>openclaw pairing approve <channel> <配对码>搞定了! 你的 AI Agent 已上线。🎉