---
title: &quot;透過 RunAPI 在 OpenClaw 中使用 GPT — LLM API 指南&quot;
url: &quot;https://runapi.ai/zh-TW/openclaw-gpt.md&quot;
canonical: &quot;https://runapi.ai/zh-TW/openclaw-gpt&quot;
locale: &quot;zh-TW&quot;
model: &quot;gpt&quot;
---

# 在 OpenClaw 中使用 GPT。

GPT-5.5 是 OpenAI 的旗艦 LLM，透過 RunAPI 提供，每 token 價格僅為官方的一半。OpenClaw 原生支援 OpenAI completions 協定——將其指向 RunAPI 的 /v1 base URL，所有 GPT 變體（5.5、5.4、5.4-mini、5.3-codex）即可搭配串流、函式呼叫與結構化輸出使用。

## API example

```bash
curl -X POST https://runapi.ai/v1/chat/completions \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;gpt-5.5&quot;,
    &quot;messages&quot;: [
      {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a concise coding assistant.&quot;},
      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Write a Python function that merges two sorted lists in O(n) time.&quot;}
    ],
    &quot;temperature&quot;: 0.3,
    &quot;max_tokens&quot;: 1024
  }&#39;

```

### Response

```json
{
  &quot;id&quot;: &quot;chatcmpl-abc123&quot;,
  &quot;object&quot;: &quot;chat.completion&quot;,
  &quot;model&quot;: &quot;gpt-5.5&quot;,
  &quot;choices&quot;: [
    {
      &quot;index&quot;: 0,
      &quot;message&quot;: {
        &quot;role&quot;: &quot;assistant&quot;,
        &quot;content&quot;: &quot;def merge_sorted(a, b):\n    result = []\n    i = j = 0\n    while i &lt; len(a) and j &lt; len(b):\n        if a[i] &lt;= b[j]:\n            result.append(a[i]); i += 1\n        else:\n            result.append(b[j]); j += 1\n    result.extend(a[i:])\n    result.extend(b[j:])\n    return result&quot;
      },
      &quot;finish_reason&quot;: &quot;stop&quot;
    }
  ],
  &quot;usage&quot;: {
    &quot;prompt_tokens&quot;: 38,
    &quot;completion_tokens&quot;: 95,
    &quot;total_tokens&quot;: 133
  }
}

```

## How it works

1. **將 OpenClaw 指向 RunAPI** — 如果 RunAPI 已在 OpenClaw 中設定為供應商，相同的 key 與 /v1 base URL 即可用於 GPT。OpenClaw 使用 openai-completions API 模式，因此 GPT-5.5 可直接替換模型——無需更改協定。
2. **選擇 GPT 模型** — 將 model 設為 gpt-5.5 使用旗艦版，gpt-5.4 或 gpt-5.4-mini 降低成本，或 gpt-5.3-codex 處理程式碼密集任務。/v1/chat/completions 端點回傳標準 OpenAI 回應，包含使用量統計與 finish_reason。
3. **使用串流或函式呼叫** — 加入 &quot;stream&quot; true 以取得逐 token 的 SSE 輸出。加入 tools 陣列啟用函式呼叫。加入 response_format 取得結構化 JSON 輸出。所有標準 OpenAI 參數均可透過 RunAPI 直接使用，無需修改。

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | 必填。gpt-5.5、gpt-5.4、gpt-5.4-mini、gpt-5.4-nano、gpt-5.3-codex 或 gpt-5.2。 |
| `messages` | `array` | 必填。訊息物件陣列，每個物件包含 role（system、user、assistant）與 content 欄位。 |
| `temperature` | `number` | 選填。取樣溫度，介於 0 到 2 之間。較低的值產生更具確定性的輸出。預設為 1。 |
| `max_tokens` | `integer` | 選填。completion 中生成的最大 token 數量。 |
| `stream` | `boolean` | 選填。設為 true 時，以 server-sent events 回傳增量 token 差異。預設為 false。 |
| `tools` | `array` | 選填。函式呼叫的工具定義陣列。每個工具包含 type、函式名稱、描述與參數 schema。 |
| `response_format` | `object` | 選填。將 type 設為 &quot;json_object&quot; 或 &quot;json_schema&quot; 以取得結構化 JSON 輸出。 |
| `reasoning_effort` | `string` | 選填。控制支援模型的思考深度。接受的值為 low、medium、high。 |

## FAQ

### 可以透過 RunAPI 在 OpenClaw 中使用 GPT-5.5 嗎？

可以。OpenClaw 支援相容 OpenAI 的供應商。加入 RunAPI 並設定 base URL 為 https://runapi.ai/v1，將 model 設為 gpt-5.5。OpenClaw 已使用的 openai-completions 協定無需更改即可運作。

### RunAPI 的 GPT 定價與 OpenAI 官方定價相比如何？

RunAPI 對所有 GPT 模型收取 OpenAI 官方每 token 費率的 50%。此折扣適用於輸入與輸出 token。請查看 RunAPI 定價頁面以了解每百萬 token 的確切費率。

### 透過 RunAPI 的 GPT 支援串流嗎？

支援。在請求中將 &quot;stream&quot; 設為 true。RunAPI 將 GPT 模型的 SSE 串流代理到您的用戶端，事件格式與官方 OpenAI API 相同——現有的 OpenAI SDK 串流程式碼無需修改即可使用。

### gpt-5.5 與 gpt-5.3-codex 有什麼差別？

GPT-5.5 是通用旗艦版，具有最高的推理能力。GPT-5.3-codex 針對程式碼生成與編輯任務進行最佳化，每 token 成本更低。兩者支援相同的 Chat Completions 端點與參數。

### 可以在 RunAPI 上使用 GPT 的函式呼叫與結構化輸出嗎？

可以。傳入 tools 陣列進行函式呼叫，或將 response_format 設為 json_schema 取得結構化輸出。RunAPI 將這些參數轉發給 GPT 模型，並以標準 OpenAI 回應格式回傳 tool_calls 或結構化 JSON。


## Links

- [OpenClaw 設定指南 →](https://runapi.ai/zh-TW/openclaw)
- [GPT on RunAPI →](https://runapi.ai/zh-TW/models/gpt)
- [Model catalog](https://runapi.ai/zh-TW/models)
- [API docs](https://runapi.ai/zh-TW/docs)
