{"slug": "workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys", "title": "Workers AI and AI Gateway: using AI on Cloudflare without scattering API keys", "summary": "A developer described consolidating AI inference within Cloudflare to avoid scattering provider API keys across projects. Workers AI runs models through a Worker binding so no external key appears in code, while AI Gateway fronts external providers so the provider key lives in one place with caching, rate limits and logs on top. The writeup, published in Portuguese, covers the setup and the trade-offs encountered.", "body_md": "If you run several small projects, API keys tend to pile up: one per provider, copied into env files, CI secrets and old branches. Every copy is one more place a key can leak.\n\nOne way out is to keep inference inside Cloudflare. Workers AI runs models from a Worker binding, so there's no external key in the code at all, and AI Gateway sits in front of external providers so the provider key lives in one place, with caching, rate limits and logs on top.\n\nI wrote up how I set this up across my projects, with the trade-offs I hit along the way (in Portuguese):\n\n[https://kevinbk.com/blog/evitar-acumulo-de-chaves-api-em-projetos-ia](https://kevinbk.com/blog/evitar-acumulo-de-chaves-api-em-projetos-ia)", "url": "https://wpnews.pro/news/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys", "canonical_source": "https://dev.to/kevinbkt/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys-23in", "published_at": "2026-10-18 20:41:27+00:00", "updated_at": "2026-10-18 20:49:02.888806+00:00", "lang": "en", "topics": ["ai-infrastructure", "ai-tools", "developer-tools", "ai-agents"], "entities": ["Cloudflare", "Workers AI", "AI Gateway"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys", "markdown": "https://wpnews.pro/news/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys.md", "text": "https://wpnews.pro/news/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys.txt", "jsonld": "https://wpnews.pro/news/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys.jsonld"}}