跳转至

OpenClaw Windows 本地安装部署与常用命令手册

OpenClaw Windows 本地安装部署手册(对接 Qwen 模型)

本文以 Windows 10/11 + PowerShell 为例,指导在本地安装 OpenClaw,并 对接 Qwen(通义千问 / 百炼 DashScope API Key),以及开启 OpenClaw 托管浏览器 做网页自动化。


一、环境准备

1. 操作系统与权限

  • 操作系统:Windows 10 或 11(64 位)
  • 账号权限:建议使用有管理员权限的本地账号

2. 安装 Node.js 与 npm

  • 建议版本:Node.js ≥ 22(官方推荐)
  • Node.js 官网 下载 LTS 或 Current 版安装包,安装时勾选 Automatically install necessary tools(可选)
  • 安装完成后,在 PowerShell 中确认:
node -v
npm -v

3. 准备 Qwen API Key

  • 若走 阿里云百炼 / DashScope:在百炼控制台创建 API Key,形如 sk-xxx...sk-sp-xxx...

二、安装 OpenClaw

1. 全局安装 OpenClaw CLI

在 PowerShell 中执行(建议用管理员打开):

npm install -g openclaw@latest

验证:

openclaw --version

2. 运行初始化向导(onboard)

openclaw onboard --install-daemon

在向导中按提示完成:网关运行方式(本地)、基本模型(可先选演示模型)、聊天渠道(可跳过)、工作区路径(默认即可)。完成后会安装网关守护进程并启动 Gateway,请根据提示信息完成 OpenClaw 配置,参考配置如下:

配置项 配置内容
I understand this is powerful and inherently risky. Continue? 选择 ”Yes”
Onboarding mode 选择 “QuickStart”
Model/auth provider 选择 “Skip for now”,后续可以配置
Filter models by provider 选择 “All providers”
Default model 使用默认配置
Select channel (QuickStart) 选择 “Skip for now”,后续可以配置
Configure skills now? (recommended) 选择 “No”,后续可以配置。
Enable hooks? 按空格键选中,选择“Skip for now”,按回车键进入下一步。
How do you want to hatch your bot? 选择 “Hatch in TUI”。

三、对接 Qwen 模型(DashScope API Key)

1. 通过 Web UI 修改配置文件

  1. 在终端执行以下命令打开 Web UI。

openclaw dashboard
2. 在 Web UI 的左侧菜单栏中选择 配置 > All Settings > RAW

  1. 复制以下内容到 Raw JSONS 输入框,替换已有内容。 > 若需保留已有配置,请勿直接全量替换,详见 已有配置如何安全修改? >
  2. YOUR_API_KEY 替换为 Coding Plan 专属 API Key

{
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
        "apiKey": "YOUR_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3.5-plus",
            "name": "qwen3.5-plus",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 1000000,
            "maxTokens": 65536
          },
          {
            "id": "qwen3-max-2026-01-23",
            "name": "qwen3-max-2026-01-23",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 262144,
            "maxTokens": 65536
          },
          {
            "id": "qwen3-coder-next",
            "name": "qwen3-coder-next",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 262144,
            "maxTokens": 65536
          },
          {
            "id": "qwen3-coder-plus",
            "name": "qwen3-coder-plus",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 1000000,
            "maxTokens": 65536
          },
          {
            "id": "MiniMax-M2.5",
            "name": "MiniMax-M2.5",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 204800,
            "maxTokens": 131072
          },
          {
            "id": "glm-5",
            "name": "glm-5",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 202752,
            "maxTokens": 16384
          },
          {
            "id": "glm-4.7",
            "name": "glm-4.7",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 202752,
            "maxTokens": 16384
          },
          {
            "id": "kimi-k2.5",
            "name": "kimi-k2.5",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 262144,
            "maxTokens": 32768
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3.5-plus"
      },
      "models": {
        "bailian/qwen3.5-plus": {},
        "bailian/qwen3-max-2026-01-23": {},
        "bailian/qwen3-coder-next": {},
        "bailian/qwen3-coder-plus": {},
        "bailian/MiniMax-M2.5": {},
        "bailian/glm-5": {},
        "bailian/glm-4.7": {},
        "bailian/kimi-k2.5": {}
      }
    }
  },
  "gateway": {
    "mode": "local"
  }
}
3. 单击右上角 Save 保存,然后单击 Update 使配置生效。

保存成功后,apiKey 将显示为 “OPENCLAW_REDACTED”。该脱敏保护仅用于前端界面隐藏,不影响实际调用。

image

2. 通过终端修改配置文件

编辑配置文件

默认路径:

C:\Users\<你的用户名>\.openclaw\openclaw.json
  1. 复制以下内容到配置文件。将 YOUR_API_KEY 替换为 Coding Plan 专属 API Key

若需保留已有配置,请勿直接全量替换,详见 已有配置如何安全修改?

{
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
        "apiKey": "YOUR_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3.5-plus",
            "name": "qwen3.5-plus",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 1000000,
            "maxTokens": 65536
          },
          {
            "id": "qwen3-max-2026-01-23",
            "name": "qwen3-max-2026-01-23",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 262144,
            "maxTokens": 65536
          },
          {
            "id": "qwen3-coder-next",
            "name": "qwen3-coder-next",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 262144,
            "maxTokens": 65536
          },
          {
            "id": "qwen3-coder-plus",
            "name": "qwen3-coder-plus",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 1000000,
            "maxTokens": 65536
          },
          {
            "id": "MiniMax-M2.5",
            "name": "MiniMax-M2.5",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 204800,
            "maxTokens": 131072
          },
          {
            "id": "glm-5",
            "name": "glm-5",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 202752,
            "maxTokens": 16384
          },
          {
            "id": "glm-4.7",
            "name": "glm-4.7",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 202752,
            "maxTokens": 16384
          },
          {
            "id": "kimi-k2.5",
            "name": "kimi-k2.5",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 262144,
            "maxTokens": 32768
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3.5-plus"
      },
      "models": {
        "bailian/qwen3.5-plus": {},
        "bailian/qwen3-max-2026-01-23": {},
        "bailian/qwen3-coder-next": {},
        "bailian/qwen3-coder-plus": {},
        "bailian/MiniMax-M2.5": {},
        "bailian/glm-5": {},
        "bailian/glm-4.7": {},
        "bailian/kimi-k2.5": {}
      }
    }
  },
  "gateway": {
    "mode": "local"
  }
}

四、开启 OpenClaw 托管浏览器

openclaw.json 中确认或添加:

{
  "browser": {
    "enabled": true,
    "defaultProfile": "openclaw"
  }
}
  • defaultProfile: "openclaw":使用独立 Chromium 实例,无需 Chrome 扩展、无需手动挂标签。

2. 保存文件并退出,重启 Gateway

openclaw gateway restart
openclaw gateway status
openclaw models status

五、验证

1. 打开 Dashboard

openclaw dashboard

2. 测试浏览器自动化

在聊天中输入例如:

请访问 https://www.baidu.com/,在搜索框中输入“OpenClaw百科”,
然后点击“百度一下”,看是否跳转到搜索结果页面且有百度百科结果,用一句话告诉我结果。

预期:自动打开托管浏览器窗口并完成操作、返回结果。


六、常见问题

现象 处理
浏览器报「服务不可用」或「no tab is connected」 browser.defaultProfile 设为 "openclaw" 并重启网关
Qwen 不响应或认证错误 检查 apiKeybaseUrl 区域,运行 openclaw models status --check

七、OpenClaw 常用命令列表

7.1 基础与配置

命令 说明
openclaw --version 显示版本
openclaw --help 显示所有可用命令
openclaw onboard 运行初始化向导
openclaw onboard --install-daemon 向导并安装后台服务
openclaw configure 交互式修改配置
openclaw config get <path> 读取配置项
openclaw config set <path> <value> 设置配置项
openclaw config unset <path> 删除配置项

7.2 网关(Gateway)

命令 说明
openclaw gateway / openclaw gateway run 前台运行网关
openclaw gateway status 查看网关状态
openclaw gateway start 启动服务
openclaw gateway stop 停止服务
openclaw gateway restart 重启服务
openclaw gateway install 安装为系统服务
openclaw gateway install --force 强制重新安装服务
openclaw gateway health 健康信息
openclaw gateway probe 探测网关是否可达
openclaw gateway --port 18789 指定端口运行

7.3 模型(Models)

命令 说明
openclaw models list 列出可用模型
openclaw models status 查看当前模型与认证状态
openclaw models status --check 校验认证(过期/缺失时退出码非 0)
openclaw models set <provider/model> 设置默认模型,如 openclaw models set dashscope/qwen-plus
openclaw models set-image <provider/model> 设置默认图像模型
openclaw models scan 刷新可用模型列表
openclaw models aliases list 查看模型别名
openclaw models fallbacks list 查看备用模型链
openclaw models auth add 交互式添加认证
openclaw models auth login --provider <id> 按提供商登录(OAuth/API Key)
openclaw models auth paste-token --provider <name> 粘贴 API Key 到指定提供商

7.4 通道(Channels)

命令 说明
openclaw channels list 列出已配置通道
openclaw channels status 查看连接状态
openclaw channels add 添加新通道
openclaw channels login --channel <name> 登录指定通道(如 whatsapp、telegram)
openclaw channels remove / logout 移除或登出通道

7.5 浏览器(Browser)

命令 说明
openclaw browser status 查看浏览器状态
openclaw browser start 启动浏览器服务
openclaw browser stop 停止浏览器服务
openclaw browser --browser-profile openclaw 使用托管浏览器 profile
openclaw browser extension install 安装 Chrome 扩展(扩展中继模式时用)

7.6 定时任务(Cron)

命令 说明
openclaw cron list 列出所有定时任务
openclaw cron status 查看任务状态
openclaw cron add 添加新任务(交互或带参数)
openclaw cron edit 编辑任务
openclaw cron rm <name> 删除任务
openclaw cron enable / disable 启用/禁用任务
openclaw cron run / runs 执行任务

7.7 技能(Skills)

命令 说明
openclaw skills list 列出已安装技能
openclaw skills info 查看技能信息
openclaw skills check 检查技能状态
openclaw plugins list 列出已安装插件
openclaw plugins enable <name> 启用插件

7.8 诊断与日志

命令 说明
openclaw doctor 全面环境检查并尝试修复
openclaw doctor --fix 带修复的检查
openclaw status 快速查看总体状态
openclaw status --deep 深度检查
openclaw logs 查看日志
openclaw logs --follow 实时跟踪日志
openclaw health 健康检查
openclaw dashboard 打开 Web 控制台(默认如 http://127.0.0.1:18789/)

7.9 安全与密钥

命令 说明
openclaw security audit 安全审计
openclaw security audit --deep 深度安全审计
openclaw secrets configure 交互式配置密钥与 SecretRef
openclaw secrets audit 扫描明文密钥与未解析引用
openclaw secrets apply 应用密钥配置

7.10 聊天内斜杠命令(在 Dashboard/IM 对话中使用)

命令 说明
/new [model] 开启新对话
/reset 重置当前对话
/model <name> 切换当前使用的模型
/models 列出可用模型
/status 查看当前状态
/compact 压缩会话上下文

八、建议使用路径(测试工程师)

  1. 先确认 Qwen 普通问答正常。
  2. 用「访问百度并搜索」等自然语言指令验证浏览器自动化。
  3. 将冒烟/简单 E2E 写成自然语言描述,交给 OpenClaw 执行并汇报。
  4. 使用 openclaw cron add 做定时冒烟,结果推送到 Telegram/企业微信/飞书等。

手册版本:基于 Windows 本地部署 + Qwen(DashScope) + OpenClaw 托管浏览器。配置路径与命令以当前 OpenClaw 文档为准,如有变动请以官方文档为准。