Providers
Cloudflare AI 閘道
Cloudflare AI Gateway 位於供應商 API 前方,並提供分析、快取與控制功能。對於 Anthropic,OpenClaw 會透過你的閘道端點使用 Anthropic Messages API。
| 屬性 | 值 |
|---|---|
| 供應商 | cloudflare-ai-gateway |
| 外掛 | 官方外部套件(@openclaw/cloudflare-ai-gateway-provider) |
| 基礎 URL | https://gateway.ai.cloudflare.com/v1/<account_id>/<gateway_id>/anthropic |
| 預設模型 | cloudflare-ai-gateway/claude-sonnet-4-6 |
| API 金鑰 | CLOUDFLARE_AI_GATEWAY_API_KEY(用於透過閘道提出請求的供應商 API 金鑰) |
為 Anthropic Messages 模型啟用思考功能時,OpenClaw 會先移除結尾的 助理預填輪次,再透過 Cloudflare AI Gateway 傳送承載資料。 Anthropic 會拒絕搭配延伸思考的回應預填,但一般的 非思考預填仍可使用。
安裝外掛
安裝官方外掛,然後重新啟動閘道:
openclaw plugins install @openclaw/cloudflare-ai-gateway-provideropenclaw gateway restart開始使用
設定供應商 API 金鑰與閘道詳細資料
執行新手設定,並選擇 Cloudflare AI Gateway 驗證選項:
openclaw onboard --auth-choice cloudflare-ai-gateway-api-key系統會提示你輸入帳戶 ID、閘道 ID 與 API 金鑰。
設定預設模型
將模型新增至你的 OpenClaw 設定:
{ agents: { defaults: { model: { primary: "cloudflare-ai-gateway/claude-sonnet-4-6" }, }, },}確認模型可用
openclaw models list --provider cloudflare-ai-gateway非互動式範例
對於指令碼或 CI 設定,請在命令列中傳入所有值:
openclaw onboard --non-interactive \ --mode local \ --auth-choice cloudflare-ai-gateway-api-key \ --cloudflare-ai-gateway-account-id "your-account-id" \ --cloudflare-ai-gateway-gateway-id "your-gateway-id" \ --cloudflare-ai-gateway-api-key "$CLOUDFLARE_AI_GATEWAY_API_KEY"進階設定
已驗證的閘道
如果你已在 Cloudflare 中啟用閘道驗證,請新增 cf-aig-authorization 標頭。此標頭是額外搭配你的供應商 API 金鑰使用。
{ models: { providers: { "cloudflare-ai-gateway": { headers: { "cf-aig-authorization": "Bearer <cloudflare-ai-gateway-token>", }, }, }, },}環境注意事項
如果閘道以常駐程式(launchd/systemd)形式執行,請確認該程序可使用 CLOUDFLARE_AI_GATEWAY_API_KEY。
相關內容
Was this useful?