在 OpenClaw 中使用 RunAPI。
RunAPI 可作為 OpenClaw 的 OpenAI 相容 endpoint。把提示詞貼到 OpenClaw,讓它自動新增 provider;只有在你想確認實際欄位時,再開啟 config 分頁查看。
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 "https://runapi.ai/v1".
- Use api "openai-completions".
- Register provider-local model id "gpt-5.2" with display name "RunAPI GPT 5.2".
- Set the default model to "runapi/gpt-5.2" while keeping existing providers available.
- After editing config, run `openclaw models status` and confirm `runapi/gpt-5.2` appears.
- If RUNAPI_API_KEY is missing, ask me to set it before starting OpenClaw.
{
agents: {
defaults: {
model: { primary: "runapi/gpt-5.2" },
models: {
"runapi/gpt-5.2": { alias: "RunAPI GPT 5.2" },
},
},
},
models: {
mode: "merge",
providers: {
runapi: {
baseUrl: "https://runapi.ai/v1",
apiKey: "${RUNAPI_API_KEY}",
api: "openai-completions",
models: [
{
id: "gpt-5.2",
name: "RunAPI GPT 5.2",
reasoning: false,
input: ["text"],
contextWindow: 128000,
maxTokens: 8192,
},
],
},
},
},
}
export RUNAPI_API_KEY="runapi_xxx"
openclaw models status
openclaw models set runapi/gpt-5.2
openclaw
用提示詞在 OpenClaw 安裝 RunAPI
貼上設定提示詞
將第一個分頁中的提示詞複製到 OpenClaw。它會告訴 OpenClaw 讀取 RUNAPI_API_KEY、加入 runapi 供應商,並保留既有供應商可用。
Copy prompt
檢視產生的設定
OpenClaw 應該將 gpt-5.2 加入為供應商內部的模型 ID,然後透過帶有供應商前綴的參照 runapi/gpt-5.2 來選取它。
runapi/gpt-5.2
驗證選取結果
執行 openclaw models status,切換到 RunAPI 模型,並開始 OpenClaw 工作階段。如果模型沒有出現,請確認 allowlist 包含 runapi/gpt-5.2。
openclaw models status
設定欄位
| 欄位 | 值 | 用途 |
|---|---|---|
baseUrl |
https://runapi.ai/v1 |
將 OpenClaw 指向 RunAPI 的 OpenAI 相容 API 端點。 |
apiKey |
${RUNAPI_API_KEY} |
從環境變數讀取 RunAPI API 金鑰。 |
api |
openai-completions |
使用 OpenAI 相容 endpoint 所預期的 Chat Completions adapter。 |
agents.defaults.model.primary |
runapi/gpt-5.2 |
將 RunAPI 模型設為新 OpenClaw 工作階段的預設模型。 |
OpenClaw 設定常見問題
可以。OpenClaw 透過 models.providers 支援自訂的 OpenAI 相容供應商。請將 RunAPI 設定為 /v1 base URL,將 api 設為 openai-completions,並在 agents.defaults.model.primary 選擇帶有供應商前綴的模型參照。
不用。在 models.providers.runapi.models 內,請使用供應商內部的 ID,例如 gpt-5.2。當你要在 OpenClaw 預設值或指令中選擇模型時,使用帶有供應商前綴的參照 runapi/gpt-5.2。
請將金鑰存到 RUNAPI_API_KEY,並從 OpenClaw 設定中讀取。這樣可避免憑證進入版本控制,也能讓同一份設定在本機 shell、伺服器和自動化流程中通用。
可以。將 models.mode 保持為 merge,並新增 RunAPI 作為其中一個供應商。你既有的供應商仍然可用,而且當你需要復原行為時,也可以在 agents.defaults.model.fallbacks 中加入備援。