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

# Vercel AI 閘道

[Vercel AI Gateway](https://vercel.com/ai-gateway) 提供統一的 API，可透過單一端點
存取數百個模型。

| 屬性     | 值                                      |
| ------ | -------------------------------------- |
| 提供者    | `vercel-ai-gateway`                    |
| 套件     | `@openclaw/vercel-ai-gateway-provider` |
| 驗證     | `AI_GATEWAY_API_KEY`                   |
| API    | 相容於 Anthropic Messages                 |
| 基礎 URL | `https://ai-gateway.vercel.sh`         |
| 模型目錄   | 透過 `/v1/models` 自動探索                   |

<Tip>
  OpenClaw 會自動探索閘道的 `/v1/models` 目錄，因此
  `/models vercel-ai-gateway` 聊天指令與
  `openclaw models list --provider vercel-ai-gateway` 都會包含目前的模型
  參照，例如 `vercel-ai-gateway/openai/gpt-5.5` 與
  `vercel-ai-gateway/moonshotai/kimi-k2.6`。
</Tip>

## 開始使用

<Steps>
  <Step title="安裝外掛">
    ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
    openclaw plugins install @openclaw/vercel-ai-gateway-provider
    ```
  </Step>

  <Step title="設定 API 金鑰">
    ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
    openclaw onboard --auth-choice ai-gateway-api-key
    ```
  </Step>

  <Step title="設定預設模型">
    ```json5 theme={"theme":{"light":"min-light","dark":"min-dark"}}
    {
      agents: {
        defaults: {
          model: { primary: "vercel-ai-gateway/anthropic/claude-opus-4.6" },
        },
      },
    }
    ```
  </Step>

  <Step title="確認模型可用">
    ```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
    openclaw models list --provider vercel-ai-gateway
    ```
  </Step>
</Steps>

## 非互動式範例

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
openclaw onboard --non-interactive \
  --mode local \
  --auth-choice ai-gateway-api-key \
  --ai-gateway-api-key "$AI_GATEWAY_API_KEY"
```

## 模型 ID 簡寫

OpenClaw 會在執行階段將 Claude 簡寫模型參照正規化：

| 簡寫輸入                                | 正規化後的模型參照                                     |
| ----------------------------------- | --------------------------------------------- |
| `vercel-ai-gateway/claude-opus-4.6` | `vercel-ai-gateway/anthropic/claude-opus-4.6` |
| `vercel-ai-gateway/opus-4.6`        | `vercel-ai-gateway/anthropic/claude-opus-4-6` |

<Tip>
  你可以在設定中使用任一形式；OpenClaw 會自動解析標準的
  `anthropic/...` 參照。
</Tip>

## 進階設定

<AccordionGroup>
  <Accordion title="背景服務程序的環境變數">
    如果 OpenClaw 閘道以背景服務（launchd/systemd）執行，請確保該程序
    可使用 `AI_GATEWAY_API_KEY`。

    <Warning>
      僅在互動式 shell 中匯出的金鑰不會對 launchd/systemd 背景服務可見，
      除非明確匯入該環境。請在 `~/.openclaw/.env` 中或透過
      `env.shellEnv` 設定金鑰，以確保閘道程序能夠讀取它。
    </Warning>
  </Accordion>

  <Accordion title="提供者路由">
    Vercel AI Gateway 會依據模型參照前綴中指定的上游提供者，將每個請求路由至該提供者。
    例如，`vercel-ai-gateway/anthropic/claude-opus-4.6` 會透過 Anthropic 路由，
    `vercel-ai-gateway/openai/gpt-5.5` 會透過 OpenAI 路由，而
    `vercel-ai-gateway/moonshotai/kimi-k2.6` 會透過 MoonshotAI 路由。一個
    `AI_GATEWAY_API_KEY` 即可驗證所有上游提供者。
  </Accordion>

  <Accordion title="思考層級">
    當 OpenClaw 能識別上游模型前綴時，`/think` 選項會依循該前綴。
    `vercel-ai-gateway/anthropic/...` 使用 Claude 思考設定檔，
    包括 Claude 4.6 模型的自適應預設值。受信任的
    `vercel-ai-gateway/openai/...` 參照（`gpt-5.2` 及更新版本，以及最低至
    `gpt-5.1-codex` 的 Codex 變體）會公開 `/think xhigh`。其他具命名空間的
    參照會保留標準推理層級，除非其目錄中繼資料宣告了更多層級。
  </Accordion>
</AccordionGroup>

## 相關內容

<CardGroup cols={2}>
  <Card title="模型選擇" href="/zh-TW/concepts/model-providers" icon="layers">
    選擇提供者、模型參照與容錯移轉行為。
  </Card>

  <Card title="疑難排解" href="/zh-TW/help/troubleshooting" icon="wrench">
    一般疑難排解與常見問題。
  </Card>
</CardGroup>
