Skip to content

OpenClaw 详细配置指南

从零开始配置你的 OpenClaw AI 助理。

📋 前置要求

  • Node.js 20+
  • npm 或 yarn
  • 一个 AI 模型 API 密钥(推荐:通义千问)

🚀 安装步骤

1. 安装 OpenClaw

bash
npm install -g openclaw

2. 初始化配置

bash
openclaw configure

按提示选择:

  • 模型提供商:ModelStudio(通义千问)
  • 认证方式:API Key
  • 工作区路径:默认 ~/.openclaw/workspace

3. 启动网关

bash
openclaw gateway start

4. 验证安装

bash
openclaw status

🔧 高级配置

配置多模型

编辑 ~/.openclaw/openclaw.json

json
{
  "models": {
    "providers": {
      "modelstudio": {
        "models": [
          {
            "id": "qwen3.5-plus",
            "name": "通义千问 Plus"
          },
          {
            "id": "qwen3-max-2026-01-23",
            "name": "通义千问 Max"
          }
        ]
      }
    }
  }
}

配置 Feishu 集成

json
{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "cli_xxxxx",
      "appSecret": "xxxxx",
      "connectionMode": "websocket",
      "groupPolicy": "allowlist"
    }
  }
}

配置记忆系统

json
{
  "memory": {
    "enabled": true,
    "maxEntries": 1000,
    "retentionDays": 30
  }
}

🛡️ 安全配置

1. 配置文件权限

bash
chmod 600 ~/.openclaw/openclaw.json
chmod -R 700 ~/.openclaw/credentials/

2. 加密敏感信息

bash
# 创建加密目录
mkdir -p ~/.openclaw/credentials/encrypted

# 加密凭证
gpg --symmetric --cipher-algo AES256 credentials.json

3. 配置防火墙

bash
# 仅允许本地访问
sudo ufw allow from 127.0.0.1 to any port 18789

📁 工作区配置

核心文件

文件用途
SOUL.mdAI 人格定义
IDENTITY.md身份信息
USER.md用户偏好
TOOLS.md工具配置
AGENTS.md代理指南
HEARTBEAT.md定时任务

示例:配置泡泡龙

SOUL.md:

markdown
# SOUL.md - Who You Are

- **Name:** 泡泡龙 (PaoPaoLong)
- **Creature:** AI 助理
- **Vibe:** 严肃/执着
- **Emoji:** 🟢🐉

USER.md:

markdown
# USER.md - About Your Human

- **Name:** Lei
- **What to call them:** 老大
- **Timezone:** Asia/Shanghai

🔍 故障排查

问题 1:网关无法启动

bash
# 检查端口占用
netstat -tlnp | grep 18789

# 查看日志
openclaw logs --tail 50

问题 2:模型认证失败

bash
# 验证 API Key
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.dashscope.aliyuncs.com/api/v1/models

问题 3:Feishu 无法连接

bash
# 检查应用配置
# 确保:
# 1. App ID 和 Secret 正确
# 2. 事件订阅已配置
# 3. 权限已授予

📚 下一步


提示

配置完成后,执行 ./update.sh 自动部署更新!

🟢🐉 泡泡龙

Released under the MIT License.