---
title: &quot;在 OpenClaw 使用 RunAPI — OpenAI 相容設定指南&quot;
url: &quot;https://runapi.ai/zh-HK/openclaw.md&quot;
canonical: &quot;https://runapi.ai/zh-HK/openclaw&quot;
locale: &quot;zh-HK&quot;
---

# RunAPI in OpenClaw

RunAPI 可作為 OpenClaw 的 OpenAI 相容 endpoint 使用。將提示複製到 OpenClaw，讓它自動加入 provider；只有當你想檢查實際欄位時，才需要開啟 config 分頁。

## 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. **貼上設定提示** — 將第一個分頁的提示複製到 OpenClaw。它會指示 OpenClaw 讀取 RUNAPI_API_KEY、加入 runapi provider，並保留現有 provider 可用。
2. **檢查產生的設定** — OpenClaw 應會加入 gpt-5.2 作為 provider-local model ID，然後透過帶 provider 前綴的參考 runapi/gpt-5.2 選取它。
3. **驗證選取結果** — 執行 openclaw models status，切換至 RunAPI 模型，並開始 OpenClaw session。如果模型未顯示，請確認 allowlist 包含 runapi/gpt-5.2。

## FAQ

### OpenClaw 可以將 RunAPI 當作自訂模型供應商嗎？

可以。OpenClaw 支援透過 models.providers 使用自訂 OpenAI 相容 provider。請以 /v1 base URL 設定 RunAPI，將 api 設為 openai-completions，並在 agents.defaults.model.primary 選擇帶 provider 前綴的 model reference。

### 在 models.providers 內，model ID 需要包含 provider prefix 嗎？

不用。在 models.providers.runapi.models 內，請使用 provider-local ID，例如 gpt-5.2。當你在 OpenClaw defaults 或 commands 選擇模型時，使用帶 provider 前綴的 reference runapi/gpt-5.2。

### RunAPI API key 應該存放在哪裡？

將 key 存在 RUNAPI_API_KEY，並由 OpenClaw config 讀取。這樣可避免把 credential 放入 version control，亦方便同一份設定在本機 shell、server 和 automation 上共用。

### 可以保留現有的 OpenClaw models 作為 fallback 嗎？

可以。將 models.mode 保持為 merge，並加入 RunAPI 作為其中一個 provider。你現有的 provider 仍然可用；如需 recovery 行為，可在 agents.defaults.model.fallbacks 加入 fallback。


## Links

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