Open Think Start Free →

One plugin, many providers — Anthropic, OpenAI, Google, Groq, Cerebras, Mistral, xAI, and more through Cloudflare's AI Gateway. Model ids take the form `provider/model-name` (e.g. `anthropic/claude-opus-4-6`), and keys live in Cloudflare's Secrets Store instead of your Worker config. Every call is cached, logged, and metered through the same AI Gateway that powers the rest of Cloudflare's platform.

Install

1 · Config

Append to ENABLED_PLUGINS in wrangler.toml:

cf-ai-gateway

Append to ALLOWED_HOSTS:

gateway.ai.cloudflare.com

2 · Secrets

Run each from your Worker project:

  • wrangler secret put AI_GATEWAY_ID Gateway name you created in the dashboard.
  • wrangler secret put CLOUDFLARE_ACCOUNT_ID Needed by the compat fallback path.
Copy-paste .dev.vars template
AI_GATEWAY_ID=Gateway name you created in the dashboard.
CLOUDFLARE_ACCOUNT_ID=Needed by the compat fallback path.

3 · Steps

  1. dash → AI → AI Gateway → Create gateway
  2. Store each provider key under the gateway's Provider Keys tab
  3. wrangler secret put AI_GATEWAY_ID

Tags

byokmulti-providerstreamingtool-use