OpenClaw 安装与模型配置
本文介绍 OpenClaw 的通用安装方式,以及如何配置模型提供商(LLM Provider)与默认模型。无论你通过 WSL、虚拟机还是物理机部署,配置方式完全一致。
一、安装 OpenClaw
Section titled “一、安装 OpenClaw”方式 1:官方安装脚本(推荐)
Section titled “方式 1:官方安装脚本(推荐)”macOS / Linux / WSL2 通用:
curl -fsSL https://openclaw.ai/install.sh | bashWindows(PowerShell):
iwr -useb https://openclaw.ai/install.ps1 | iex脚本会自动检测系统、安装所需 Node 运行时(Linux 下为 Node 24 LTS,macOS 下为 Node 26)并完成 OpenClaw 安装。
方式 2:npm 安装
Section titled “方式 2:npm 安装”如果你已自行管理 Node(需 22.22.3+ / 24.15+ / 25.9+,推荐 Node 26):
npm install -g openclaw@latest --allow-scripts=openclawopenclaw onboard --install-daemonopenclaw --version二、首次配置(onboard 向导)
Section titled “二、首次配置(onboard 向导)”运行配置向导,按提示完成:
openclaw onboard向导会引导你完成:
- 模型提供商:选择你使用的 LLM 服务商,粘贴 API Key
- Agent 工作区:创建
~/.openclaw/workspace/作为智能体的家目录 - 聊天通道:可选接入微信、飞书、Discord、DLinkClaw 等通道
- 系统服务:选择是否将 Gateway 注册为开机自启服务
三、配置模型
Section titled “三、配置模型”支持的模型提供商
Section titled “支持的模型提供商”OpenClaw 支持主流 LLM 服务商,包括:DeepSeek、OpenAI、Anthropic、Google Gemini、通义千问、豆包(火山引擎)、智谱、Moonshot、Ollama(本地模型)、llama.cpp(本地模型)等。
设置默认模型
Section titled “设置默认模型”查看当前可用模型:
openclaw models list设置默认模型(提供商/模型名 格式):
openclaw models set deepseek/deepseek-v4-flash例如使用火山引擎(豆包):
openclaw models set volcengine-plan/deepseek-v4-flash手动编辑配置
Section titled “手动编辑配置”配置文件位于 ~/.openclaw/openclaw.json。默认模型对应字段:
{ agents: { defaults: { model: { primary: "deepseek/deepseek-v4-flash", }, }, },}修改后重启 Gateway 生效:
openclaw gateway restart添加更多模型账号
Section titled “添加更多模型账号”在向导中选择「添加模型账号」,或直接运行:
openclaw onboard选择「添加提供商」并粘贴对应 API Key 即可。多个提供商可并存,随时通过 openclaw models set 切换默认模型。
四、管理 Gateway 服务
Section titled “四、管理 Gateway 服务”| 命令 | 说明 |
|---|---|
openclaw status |
查看 Gateway 与各通道运行状态 |
openclaw gateway restart |
重启 Gateway |
openclaw update |
升级 OpenClaw 到最新版 |
openclaw uninstall |
卸载 OpenClaw |
- 想让 DLinkClaw 接入你的对话?查看 DLinkClaw 通道插件。
- 需要更详细的平台安装步骤?查看 WSL 安装、Multipass 安装、Ubuntu 物理机安装。
