Dev.to
7/17/2026

I built a Cloudflare Worker so you can give the public free AI, without ever getting a surprise bill
Short summary
A developer built a ~20 KB Cloudflare Worker that lets you expose free AI endpoints to the public with a guaranteed spend ceiling. It routes requests through free-tier providers (Google Gemini, OpenRouter community models) in cost order, caps usage per device, IP, and globally, and keeps your API key server-side. It's a commercial pay-what-you-want boilerplate targeting indie devs who want to ship free AI features without financial risk.
- •Cloudflare Worker relays public AI requests through free-tier providers in cost order, defaulting to $0 spend
- •Three-layer cap (device + IP + global daily) prevents runaway costs from anonymous users
- •Commercial pay-what-you-want boilerplate, not open source; includes one-toggle kill switch
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



