examples/provider-cloudflare/gateway/README.md
You can run this example with:
npx promptfoo@latest init --example provider-cloudflare/gateway
cd provider-cloudflare/gateway
This example demonstrates how to route AI requests through Cloudflare AI Gateway for caching, rate limiting, and analytics.
Set the required environment variables:
export CLOUDFLARE_ACCOUNT_ID=your_account_id
export CLOUDFLARE_GATEWAY_ID=your_gateway_id
export OPENAI_API_KEY=your_openai_key
export ANTHROPIC_API_KEY=your_anthropic_key
export GROQ_API_KEY=your_groq_key
npx promptfoo eval -c examples/provider-cloudflare/gateway/promptfooconfig.yaml
The configuration compares responses from three different providers, all routed through Cloudflare AI Gateway:
Each provider answers questions about technical topics, and the assertions verify that responses contain relevant keywords.
See the Cloudflare AI Gateway provider documentation for more details.