Files
bot/docs/providers/cloudflare-ai-gateway.md
zeekay 4bdc9ee3e4 chore: rebrand openclaw → hanzo-bot for bridge merge
Comprehensive rename of all openclaw references to hanzo-bot equivalents:
- Package: openclaw → @hanzo/bot
- Binary: openclaw → hanzo-bot
- Types: OpenClaw* → Bot*
- Env vars: OPENCLAW_* → BOT_*
- Android: ai.openclaw.android → ai.hanzo.bot.android
- iOS/macOS: ai.openclaw.* → ai.hanzo.*
- Swift modules: OpenClaw* → Bot*
- Plugins: openclaw.plugin.json → bot.plugin.json
- Paths: .openclaw/ → .hanzo/bot/
- URLs: github.com/openclaw → github.com/hanzoai
2026-02-26 22:36:01 -08:00

1.9 KiB

title, summary, read_when
title summary read_when
Cloudflare AI Gateway Cloudflare AI Gateway setup (auth + model selection)
You want to use Cloudflare AI Gateway with Hanzo Bot
You need the account ID, gateway ID, or API key env var

Cloudflare AI Gateway

Cloudflare AI Gateway sits in front of provider APIs and lets you add analytics, caching, and controls. For Anthropic, Hanzo Bot uses the Anthropic Messages API through your Gateway endpoint.

  • Provider: cloudflare-ai-gateway
  • Base URL: https://gateway.ai.cloudflare.com/v1/<account_id>/<gateway_id>/anthropic
  • Default model: cloudflare-ai-gateway/claude-sonnet-4-5
  • API key: CLOUDFLARE_AI_GATEWAY_API_KEY (your provider API key for requests through the Gateway)

For Anthropic models, use your Anthropic API key.

Quick start

  1. Set the provider API key and Gateway details:
hanzo-bot onboard --auth-choice cloudflare-ai-gateway-api-key
  1. Set a default model:
{
  agents: {
    defaults: {
      model: { primary: "cloudflare-ai-gateway/claude-sonnet-4-5" },
    },
  },
}

Non-interactive example

hanzo-bot 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"

Authenticated gateways

If you enabled Gateway authentication in Cloudflare, add the cf-aig-authorization header (this is in addition to your provider API key).

{
  models: {
    providers: {
      "cloudflare-ai-gateway": {
        headers: {
          "cf-aig-authorization": "Bearer <cloudflare-ai-gateway-token>",
        },
      },
    },
  },
}

Environment note

If the Gateway runs as a daemon (launchd/systemd), make sure CLOUDFLARE_AI_GATEWAY_API_KEY is available to that process (for example, in ~/.hanzo/bot/.env or via env.shellEnv).