---
title: &quot;在龙虾 (OpenClaw) 中使用 RunAPI — OpenAI 兼容配置指南&quot;
url: &quot;https://runapi.ai/zh-CN/openclaw.md&quot;
canonical: &quot;https://runapi.ai/zh-CN/openclaw&quot;
locale: &quot;zh-CN&quot;
---

# RunAPI in OpenClaw

RunAPI 可以作为 OpenClaw 的 OpenAI 兼容端点使用。把 prompt 复制进 OpenClaw，让它添加 provider；需要核对字段时再看配置 tab。

## Install prompt

Copy this prompt into OpenClaw:

```text
Configure this OpenClaw workspace to use RunAPI.

Requirements:
- Read the API key from RUNAPI_API_KEY. Do not hardcode the key.
- Add a model provider named runapi.
- Use baseUrl &quot;https://runapi.ai/v1&quot;.
- Use api &quot;openai-completions&quot;.
- Register provider-local model id &quot;gpt-5.5&quot; with display name &quot;RunAPI GPT 5.5&quot;.
- Set the default model to &quot;runapi/gpt-5.5&quot; while keeping existing providers available.
- After editing config, run `openclaw models status` and confirm `runapi/gpt-5.5` appears.
- If RUNAPI_API_KEY is missing, ask me to set it before starting OpenClaw.
```

## Configuration

```json5
{
  agents: {
    defaults: {
      model: { primary: "runapi/gpt-5.5" },
      models: {
        "runapi/gpt-5.5": { alias: "RunAPI GPT 5.5" },
      },
    },
  },
  models: {
    mode: "merge",
    providers: {
      runapi: {
        baseUrl: "https://runapi.ai/v1",
        apiKey: "${RUNAPI_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "gpt-5.5",
            name: "RunAPI GPT 5.5",
            reasoning: false,
            input: ["text"],
            contextWindow: 128000,
            maxTokens: 8192,
          },
        ],
      },
    },
  },
}
```

## Steps

1. **粘贴 setup prompt** — 复制第一个 tab 里的 prompt 给 OpenClaw。它会要求 OpenClaw 读取 RUNAPI_API_KEY、添加 runapi provider，并保留现有 provider。
2. **核对生成的配置** — OpenClaw 应该把 gpt-5.2 加为 provider 内部模型 ID，再通过带 provider 前缀的 runapi/gpt-5.2 选择模型。
3. **验证选择** — 运行 openclaw models status，切换到 RunAPI 模型，然后启动 OpenClaw 会话。如果模型没有出现，检查 allowlist 是否包含 runapi/gpt-5.2。

## FAQ

### OpenClaw 可以把 RunAPI 当作自定义模型 provider 吗？

可以。OpenClaw 通过 models.providers 支持自定义 OpenAI 兼容 provider。为 RunAPI 配置 /v1 base URL，把 api 设为 openai-completions，并在 agents.defaults.model.primary 中选择带 provider 前缀的模型引用。

### models.providers 里的模型 ID 要带 provider 前缀吗？

不要。在 models.providers.runapi.models 内使用 provider 内部 ID，例如 gpt-5.2。只有在 OpenClaw 默认模型或命令里选择模型时，才使用 runapi/gpt-5.2 这种带 provider 前缀的引用。

### RunAPI API key 应该存在哪里？

把 key 存在 RUNAPI_API_KEY，并在 OpenClaw 配置里读取它。这样凭证不会进入版本控制，也能让同一份配置用于本地 shell、服务器和自动化环境。

### 还能保留现有 OpenClaw 模型作为 fallback 吗？

可以。保持 models.mode 为 merge，并把 RunAPI 作为其中一个 provider 加进去。现有 provider 仍可用；需要恢复链路时，把 fallback 放进 agents.defaults.model.fallbacks。


## Links

- [Model catalog](https://runapi.ai/zh-CN/models)
- [CLI](https://runapi.ai/zh-CN/cli)
- [MCP Server](https://runapi.ai/zh-CN/mcp)
- [Pricing](https://runapi.ai/zh-CN/pricing)
- [API docs](https://runapi.ai/zh-CN/docs)
- [Hermes Agent setup](https://runapi.ai/zh-CN/hermes-agent)
