# Workers AI and AI Gateway: using AI on Cloudflare without scattering API keys

> Source: <https://dev.to/kevinbkt/workers-ai-and-ai-gateway-using-ai-on-cloudflare-without-scattering-api-keys-23in>
> Published: 2026-10-18 20:41:27+00:00

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.

One 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.

I wrote up how I set this up across my projects, with the trade-offs I hit along the way (in Portuguese):

[https://kevinbk.com/blog/evitar-acumulo-de-chaves-api-em-projetos-ia](https://kevinbk.com/blog/evitar-acumulo-de-chaves-api-em-projetos-ia)
