Cloudflare AI Gateway
Cloudflare AI Gateway sits in front of provider APIs and lets you add analytics, caching, and controls. For Anthropic, OpenClaw 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)
Quick start
- Set the provider API key and Gateway details:
- Set a default model:
Non-interactive example
Authenticated gateways
If you enabled Gateway authentication in Cloudflare, add thecf-aig-authorization header (this is in addition to your provider API key).
Environment note
If the Gateway runs as a daemon (launchd/systemd), make sureCLOUDFLARE_AI_GATEWAY_API_KEY is available to that process (for example, in ~/.openclaw/.env or via env.shellEnv).