See how Cloudflare AI Gateway unifies AI infrastructure with caching, rate limiting, and observability across any model provider โ all at the edge.
Cache AI responses at 345+ cities globally. Reduce latency and costs by serving repeated queries from the edge.
Control costs with per-user and global rate limits. Prevent abuse and manage API quotas effortlessly.
Monitor token usage, latency, error rates, and cache hit ratios from a unified dashboard.
Route to Workers AI, OpenAI, Anthropic, or any provider. Switch models without changing your application.
llama-3.1-8b-instructEach request flows through Cloudflare's global network, enabling caching, analytics, and security policies before reaching the AI model.
// Cloudflare Worker โ AI Gateway
const response = await fetch(
`https://gateway.ai.cloudflare.com/v1/
${ACCOUNT_ID}/${GATEWAY}/workers-ai/
@cf/meta/llama-3.1-8b-instruct`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
messages: [{ role: 'user', content: prompt }]
})
}
);
// Response includes:
// cf-aig-cache-status: HIT | MISS
// cf-aig-request-id: unique-id
// Analytics available in dashboard
Deploy AI Gateway in minutes and gain visibility, control, and cost optimization across all your AI providers.