Skip to content

快速开始

本教程帮助你在 10 分钟内搭建第一个 OpenClaw Agent。

📋 前置要求

  • Node.js 18+
  • npm 或 pnpm
  • 一个 AI 模型 API Key(OpenAI / Claude / 其他)

🚀 安装

方式一:npm 安装(推荐)

bash
npm install -g openclaw

方式二:从源码安装

bash
git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm install
npm run build
npm link

⚙️ 配置

1. 初始化配置

bash
openclaw init

这会在 ~/.openclaw/ 目录创建配置文件。

2. 配置模型

编辑 ~/.openclaw/config.yaml

yaml
model:
  provider: openai
  model: gpt-4
  apiKey: your-api-key-here

或者使用环境变量:

bash
export OPENAI_API_KEY=your-api-key-here

3. 配置渠道(可选)

如果需要接入 Telegram/Discord 等渠道:

yaml
channels:
  telegram:
    enabled: true
    token: your-telegram-bot-token

🎮 启动

启动 Gateway

bash
openclaw gateway start

启动 Web Chat

bash
openclaw chat

然后在浏览器打开 http://localhost:3000

🧪 测试

在 Web Chat 中发送消息:

你好,请介绍一下你自己

如果收到 AI 的回复,恭喜你,Agent 已经运行起来了!

📦 下一步

❓ 遇到问题?

养虾俱乐部 - OpenClaw 中文社区