Cloudflare AI Gateway sits in front of provider APIs and lets you add analytics, caching, and controls. For Anthropic, CoderClaw uses the Anthropic Messages API through your Gateway endpoint.
cloudflare-ai-gatewayhttps://gateway.ai.cloudflare.com/v1/<account_id>/<gateway_id>/anthropiccloudflare-ai-gateway/claude-sonnet-4-5CLOUDFLARE_AI_GATEWAY_API_KEY (your provider API key for requests through the Gateway)For Anthropic models, use your Anthropic API key.
coderclaw onboard --auth-choice cloudflare-ai-gateway-api-key
{
agents: {
defaults: {
model: { primary: "cloudflare-ai-gateway/claude-sonnet-4-5" },
},
},
}
coderclaw 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"
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>",
},
},
},
},
}
If the Gateway runs as a daemon (launchd/systemd), make sure CLOUDFLARE_AI_GATEWAY_API_KEY is available to that process (for example, in ~/.coderclaw/.env or via env.shellEnv).