> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnimux.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenClaw 手动安装

> 手动安装和配置 OpenClaw Gateway，接入 OmniMux 多协议模型提供商

## 概述

<Note>
  OmniMux 网关统一使用 Base URL：`https://api.omnimux.ai`（OpenAI 兼容客户端通常填 `https://api.omnimux.ai/v1`）。控制台为 [omnimux.ai/dashboard](https://omnimux.ai/dashboard)。文中的模型 ID 仅为示例，请以控制台或 `GET /v1/models` 为准。
</Note>

OpenClaw 是一个开源的 AI 智能体 Gateway 网关,充当聊天应用与 AI 智能体之间的桥梁。通过一个中心化的 Gateway 进程,它可以将 Telegram、WhatsApp、Discord、飞书等聊天平台连接到 AI 编程智能体。

本文档介绍如何手动安装 OpenClaw 并配置 **OmniMux API** 作为模型提供商。完成本文档后,你可以继续配置具体的聊天渠道(如 Telegram 或飞书)。

**本文将介绍:**

* 安装并配置 OpenClaw Gateway
* 将 OmniMux API 配置为自定义模型提供商
* 验证安装是否成功

## 系统环境检查(可选)

在开始安装之前,建议先运行环境检查工具,确保你的系统满足 OpenClaw 的运行要求。

### 下载检查工具

从 [GitHub Releases](https://github.com/suuuuuu-1/openclaw-env-checker/releases) 下载对应平台的检查工具:

| 平台                    | 文件名                            |
| --------------------- | ------------------------------ |
| Windows               | `openclaw-checker-win-x64.exe` |
| macOS (Intel)         | `openclaw-checker-macos-x64`   |
| macOS (Apple Silicon) | `openclaw-checker-macos-arm64` |
| Linux                 | `openclaw-checker-linux-x64`   |

### 检查项目

工具会自动检查以下条件:

* ✅ Node.js 版本(需要 >= 22.12.0)
* ✅ npm 可用
* ✅ Git 可用
* ✅ 网络连通性(github.com、npmjs.org、omnimux.ai)

如果检查未通过,工具会给出具体的修复建议。

## 使用前准备

在开始配置之前,请确保已完成以下准备工作:

### 1. 安装 Node.js

OpenClaw 通过 npm 安装,需要先安装 Node.js 22 或更高版本。

访问 [Node.js 官网](https://nodejs.org/zh-cn/download),下载 Windows 安装包(.msi 文件),双击运行安装程序。

安装完成后,打开 PowerShell 验证:

```bash theme={null}
node --version
npm --version
```

建议以管理员身份运行 PowerShell,避免后续安装时出现权限问题。

**方式 1: 使用安装包**

访问 [Node.js 官网](https://nodejs.org/zh-cn/download),下载 macOS 安装包(.pkg 文件),双击运行安装程序。

**方式 2: 使用 Homebrew**

```bash theme={null}
brew install node
```

安装完成后,打开终端验证:

```bash theme={null}
node --version
npm --version
```

如果后续安装时遇到权限问题,可能需要在命令前加 `sudo`。

### 2. 获取 OmniMux API Key

* 登录 [OmniMux 控制台](https://omnimux.ai/dashboard)
* 在控制台中找到 API Keys,点击"创建新Key"按钮,然后复制生成的 Key
* API Key 通常以 `sk-` 开头,请妥善保存

## 第一步:安装 OpenClaw

在终端中执行:

```bash theme={null}
npm install -g openclaw@latest
```

安装完成后验证:

```bash theme={null}
openclaw --version
```

## 第二步:初始化引导

运行新手引导命令,OpenClaw 会引导你完成初始配置并安装后台守护服务:

```bash theme={null}
openclaw onboard --install-daemon
```

### 1. 确认安装

系统会提示安装风险说明,确认同意后继续:

### 2. 选择安装模式

系统会提示选择安装模式,选择 **Quickstart** 即可:

### 3. 选择供应商

系统会提示选择模型供应商,这里选择 **跳过(Skip)**,后续我们会手动配置 OmniMux 作为自定义供应商:

### 4. 选择模型

系统会提示选择要启用的模型,选择 **All(全部)** 即可:

### 5. 选择默认模型

系统会提示选择默认模型,选择 **Keep current(保持当前)** 即可:

### 6. 选择渠道

系统会提示选择要配置的聊天渠道。这里建议选择 **Skip for now(暂时跳过)**,以后可以随时添加渠道:

### 7. 配置 Skills

系统会提示是否配置 Skills。建议选择 **No**,以后可以随时添加:

### 8. 启用 Hooks

系统会提示是否启用 Hooks。建议选择 **session-memory**:

### 9. 重启网关服务

系统会提示网关服务已安装，选择 **Restart(重启)**:

### 10. 启动机器人

系统会提示如何启动机器人。建议选择 **Do this later(稍后处理)**:

## 第三步:配置 OmniMux API 与模型切换

### 1. 找到两个配置文件（重点）

OpenClaw 模型配置通常涉及两个文件:

* `openclaw.json`: `%USERPROFILE%\\.openclaw\\openclaw.json`

* `models.json`: `%USERPROFILE%\\.openclaw\\agents\\main\\agent\\models.json`

* `openclaw.json`: `~/.openclaw/openclaw.json`

* `models.json`: `~/.openclaw/agents/main/agent/models.json`

可直接打开:

```bash theme={null}
open ~/.openclaw/openclaw.json
open ~/.openclaw/agents/main/agent/models.json
```

如果 `models.json` 中某个 provider 的 `apiKey` / `baseUrl` 非空,它会覆盖 `openclaw.json` 中同名 provider 的对应值。建议两边保持一致。

### 2. 配置模型提供商

建议在 `openclaw.json` 中配置以下 providers（并同步到 `models.json`）:

```json theme={null}
"models": {
"providers": {
"omnimux-anthropic": {
"api": "anthropic-messages",
"baseUrl": "https://api.omnimux.ai",
"apiKey": "你的 OmniMux API Key",
"models": [
{ "id": "claude-sonnet-4-5-20250929", "name": "OmniMux 网关" },
{ "id": "claude-fable-5", "name": "Claude Fable 5" },
{ "id": "claude-opus-5", "name": "Claude Opus 5" },
{ "id": "claude-opus-4-8", "name": "Claude Opus 4.8" },
{ "id": "claude-opus-4-7", "name": "Claude Opus 4.7" },
{ "id": "claude-opus-4-6", "name": "Claude Opus 4.6" },
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" },
{ "id": "claude-sonnet-5", "name": "Claude Sonnet 5" },
{ "id": "claude-opus-4-5-20251101", "name": "Claude Opus 4.5" },
{ "id": "claude-sonnet-4-5-20250929", "name": "Claude Sonnet 4.5" },
{ "id": "claude-haiku-4-5-20251001", "name": "Claude Haiku 4.5" }
]
},
"omnimux-google": {
"api": "google-generative-ai",
"baseUrl": "https://api.omnimux.ai/v1beta",
"apiKey": "你的 OmniMux API Key",
"models": [
{ "id": "claude-sonnet-4-5-20250929", "name": "OmniMux 网关" },
{ "id": "gemini-3.1-flash-lite-preview", "name": "Gemini 3.1 Flash Lite" },
{ "id": "gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro" },
{ "id": "gemini-2.5-pro", "name": "Gemini 2.5 Pro" },
{ "id": "gemini-2.5-flash", "name": "Gemini 2.5 Flash" },
{ "id": "gemini-3-pro-preview", "name": "Gemini 3.0 Pro" },
{ "id": "gemini-3-flash-preview", "name": "Gemini 3.0 Flash" }
]
},
"omnimux-openai": {
"api": "openai-completions",
"baseUrl": "https://api.omnimux.ai/v1",
"apiKey": "你的 OmniMux API Key",
"models": [
{ "id": "gpt-5.4", "name": "GPT-5.4" },
{ "id": "gpt-5.2", "name": "GPT-5.2" },
{ "id": "gpt-5.1", "name": "GPT-5.1" },
{ "id": "gpt-5.1-chat", "name": "GPT-5.1 Chat" },
{ "id": "gpt-5.1-thinking", "name": "GPT-5.1 Thinking" },
{ "id": "gemini-2.5-pro", "name": "Gemini 2.5 Pro (OpenAI SDK)" },
{ "id": "gemini-2.5-flash", "name": "Gemini 2.5 Flash (OpenAI SDK)" },
{ "id": "gemini-3-pro-preview", "name": "Gemini 3.0 Pro (OpenAI SDK)" },
{ "id": "gemini-3-flash-preview", "name": "Gemini 3.0 Flash (OpenAI SDK)" },
{ "id": "doubao-seed-2.0-pro", "name": "Doubao Seed 2.0 Pro" },
{ "id": "doubao-seed-2.0-lite", "name": "Doubao Seed 2.0 Lite" },
{ "id": "doubao-seed-2.0-mini", "name": "Doubao Seed 2.0 Mini" },
{ "id": "doubao-seed-2.0-code", "name": "Doubao Seed 2.0 Code" },
{ "id": "kimi-k2-thinking", "name": "Kimi K2 Thinking" },
{ "id": "kimi-k2-thinking-turbo", "name": "Kimi K2 Thinking Turbo" }
]
}
}
}
```

以上模型 ID 为示例。请以你的 OmniMux 账户实际开通模型为准。

Gemini 场景下 `omnimux-google.baseUrl` 必须带 `/v1beta`，即 `https://api.omnimux.ai/v1beta`。若缺少该后缀,常见报错为 `Forbidden (403)`。

### 3. 配置默认模型（支持快速切换）

在 `agents.defaults` 中设置默认模型。推荐将默认模型设为控制台可用的稳定模型（示例 `claude-sonnet-4-5-20250929`，请以 `GET /v1/models` 为准）：

```json theme={null}
"agents": {
"defaults": {
"model": {
"primary": "omnimux-anthropic/claude-sonnet-4-5-20250929"
}
}
}
```

**选择模型**：在配置中填写账户可用的模型 ID。完整列表见控制台或 [模型列表](/cn/guides/models)（`GET /v1/models`）。下方示例 ID 仅作占位，请替换为你环境中的真实模型名。

如需指定特定模型，也可以手动切换：

* 示例默认: `omnimux-anthropic/claude-sonnet-4-5-20250929`（请改为你的可用模型）
* Claude: `omnimux-anthropic/claude-opus-5`
* GPT: `omnimux-openai/gpt-5.2`
* Gemini: `omnimux-google/gemini-3.1-pro-preview`
* Doubao: `omnimux-openai/doubao-seed-2.0-mini`

### 4. 快速切换到 OmniMux 模型（推荐）

完成 provider 配置后，后续切换模型建议直接用 CLI 命令，不必反复手改 JSON:

```bash theme={null}
# 查看已配置的 OmniMux OpenAI 兼容模型
openclaw models list --provider omnimux-openai --plain

# 切换默认模型（示例：gpt-5.4）
openclaw models set omnimux-openai/gpt-5.4

# 查看当前生效模型
openclaw models status --plain
```

如果 `models list --provider omnimux-openai` 看不到你预期的模型，请先检查 `openclaw.json` 与 `models.json` 两处是否都已配置对应 provider。

### 5. 重启并验证

配置完成后重启网关:

```bash theme={null}
openclaw gateway restart
```

检查状态:

```bash theme={null}
openclaw gateway status
```

发送一条测试消息验证模型可用:

```bash theme={null}
openclaw agent --agent main -m "hi" --json
```

## 常用命令

| 命令                         | 描述       |
| -------------------------- | -------- |
| `openclaw gateway status`  | 检查网关运行状态 |
| `openclaw gateway restart` | 重启网关服务   |
| `openclaw gateway stop`    | 停止网关服务   |
| `openclaw gateway start`   | 启动网关服务   |
| `openclaw logs --follow`   | 实时查看网关日志 |
| `openclaw plugins list`    | 查看已安装的插件 |

## 故障排除

| 问题                          | 排查方法                                                                                            |
| --------------------------- | ----------------------------------------------------------------------------------------------- |
| npm 安装失败                    | Windows: 以管理员身份运行 PowerShell; macOS: 在命令前加 `sudo`                                               |
| 找不到配置文件                     | 确认 onboard 流程已完成,检查 `~/.openclaw/` 目录是否存在                                                       |
| 网关启动失败                      | 检查端口是否被占用,使用 `openclaw gateway status` 查看详细错误                                                   |
| API Key 无效                  | 确认 API Key 正确复制,检查是否有多余空格或引号                                                                    |
| 模型配置不生效                     | 同时检查 `openclaw.json` 与 `models.json` 是否一致（`models.json` 可能覆盖）                                   |
| Gemini 返回 `Forbidden (403)` | 检查 `models.providers.omnimux-google.baseUrl` 是否为 `https://api.omnimux.ai/v1beta`（必须带 `/v1beta`） |
| 切换模型后仍使用旧模型                 | 执行 `openclaw models status --plain` 确认当前模型,必要时 `openclaw gateway restart`                       |

## 下一步

OpenClaw 安装和 OmniMux API 配置已完成。接下来你可以:

* **配置 Telegram 渠道**: 参考 [OpenClaw + Telegram](/cn/integration-guide/openclaw-telegram) 文档
* **配置飞书渠道**: 参考 [OpenClaw + 飞书](/cn/integration-guide/openclaw-feishu) 文档
* **使用自动安装工具**: 参考 [OpenClaw 自动安装](/cn/integration-guide/openclaw-auto) 文档
