# OpenClaw 配置指南

> 用 openclaw.json 把 OpenClaw 接到 LLMoxy 的 Anthropic Messages 接口。

网址：[https://openclaw.ai](https://openclaw.ai)

源码：[GitHub openclaw/openclaw](https://github.com/openclaw/openclaw) · 国内镜像：[Gitee OpenClaw-CN](https://gitee.com/OpenClaw-CN/openclaw-cn)

OpenClaw（由 Clawdbot 改名）用本地 `openclaw.json` 配模型。插件或 SDK 安装失败时，把包名改成 OpenClaw 再试。

开始前准备一把 [LLMoxy 令牌](https://llmoxy.com/docs/get-started/get-token)，建议用 **auto** 分组。

## 安装

```bash
npm i -g openclaw
```

配置文件位置：

| 系统 | 路径 |
| --- | --- |
| Windows | `%USERPROFILE%\.openclaw\openclaw.json` |
| macOS / Linux | `~/.openclaw/openclaw.json` |

也可直接下载完整模板，替换密钥后覆盖上述文件：

- [Windows 版 openclaw.json](https://llmoxy.com/docs-assets/migrated/tutorial-openclaw/file-01.json)
- [macOS 版 openclaw.json](https://llmoxy.com/docs-assets/migrated/tutorial-openclaw/file-02.json)

## 接入 LLMoxy

把下面两段合并进现有 `openclaw.json`。Anthropic 兼容地址 **不带** `/v1`。

```json
{
  "models": {
    "providers": {
      "claude": {
        "baseUrl": "https://llmoxy.com",
        "apiKey": "你的LLMoxy API Key",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "claude-opus-5-5",
            "name": "claude-opus-5-5",
            "reasoning": false,
            "input": ["text"],
            "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
            "contextWindow": 200000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "claude/claude-opus-5-5" },
      "models": {
        "claude/claude-opus-5-5": { "alias": "claude-opus-5-5" }
      }
    }
  }
}
```

界面里走「自定义服务器 / 自定义模型」时，填同一组值：

| 字段 | 值 |
| --- | --- |
| `baseUrl` / API 端点 | `https://llmoxy.com` |
| `api` | `anthropic-messages` |
| `apiKey` | LLMoxy 令牌 |
| 模型 ID | `claude-opus-5-5` |

![自定义模型](https://llmoxy.com/docs-assets/migrated/tutorial-openclaw/image-01.png)

## 启动

```bash
openclaw gateway
```

浏览器打开 `http://localhost:18789`。

## 常见问题

**安装失败、找不到包**
仓库改过名。安装和插件请用 `openclaw`，不要再用 `clawdbot`。

**走 OpenAI 兼容而不是 Anthropic**
把 `api` 改成 `openai-completions`，`baseUrl` 改成 `https://llmoxy.com/v1`。

本文是 https://llmoxy.com/docs/code-tutorials/openclaw 的 markdown 版本。
