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

# OpenClaw

> OpenClaw 接入 ViVi-API 的配置教程。

准备好 [ViVi-API 控制台](https://api.viviai.cc/dashboard)创建的令牌 Key，并确认分组支持所选模型。已有配置请先备份，再合并所需字段。

## 1. 找到配置文件

| 操作系统 | 默认路径 |
| - | - |
| Windows | `C:\Users\<用户名>\.openclaw\openclaw.json` |
| macOS | `/Users/<用户名>/.openclaw/openclaw.json` |
| Linux | `/home/<用户名>/.openclaw/openclaw.json` |

如果自行设置过配置目录，请使用实际路径。

## 2. 添加 ViVi-API 供应商

下面使用 **OpenAI Chat Completions 兼容协议**。将 `apiKey` 替换为自己的令牌，并按分组权限保留需要的模型。

```json openclaw.json theme={null}
{
  "agents": {
    "defaults": {
      "model": {
        "primary": "viviai/gemini-3-flash-preview"
      }
    }
  },
  "models": {
    "providers": {
      "viviai": {
        "baseUrl": "https://api.viviai.cc/v1",
        "apiKey": "sk-your-api-key",
        "api": "openai-completions",
        "models": [
          { "id": "gemini-3-flash-preview", "name": "Gemini 3 Flash" },
          { "id": "gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro" },
          { "id": "gpt-4o", "name": "GPT-4o" },
          { "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" }
        ]
      }
    }
  }
}
```

同一个供应商下可以配置多个模型，前提是这些模型都支持所选协议。聊天中使用完整模型引用切换，例如：

```text theme={null}
/model viviai/gemini-3.1-pro-preview
```

## 3. 理解配置字段

| 字段 | 说明 |
| - | - |
| `agents.defaults.model.primary` | 默认模型，格式为 `供应商 ID/模型 ID`。 |
| `baseUrl` | 供应商的 API 基础地址，与 `api` 协议匹配。 |
| `apiKey` | ViVi-API 创建的令牌 Key。 |
| `api` | 请求协议类型，见下表。 |
| `id` | 模型的实际调用 ID。 |
| `name` | 界面中显示的名称，可以自定义。 |

| 协议 | `api` | `baseUrl` |
| - | - | - |
| OpenAI 兼容 | `openai-completions` | `https://api.viviai.cc/v1` |
| Gemini 原生 | `google-generative-ai` | `https://api.viviai.cc/v1beta` |
| Anthropic 原生 | `anthropic-messages` | `https://api.viviai.cc` |

> [!TIP]
>
> 模型名称包含 Gemini，不代表一定要使用 Gemini 原生协议。上面的完整示例使用 OpenAI 兼容协议，因此地址为 `/v1`。使用原生协议时，建议添加独立供应商，并同时修改 `api`、`baseUrl` 与默认模型引用。

## 4. 重启 Gateway

保存配置后执行：

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

重启完成后发送一条简短消息测试，再按需要切换模型。

更多说明见[接入概览](https://docs.viviai.cc/scenarios.md)与[常见问题](https://docs.viviai.cc/faq.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.