I Built a Free AI API Gateway — Here's The Code

in #cloudflare10 hours ago

🔧 Building a Free AI API on Cloudflare Workers

The Architecture

  • Cloudflare Workers — Edge computing, 100k req/day free
  • DeepSeek V4 — Official API behind the scenes
  • GitHub Pages — Static docs (free hosting)
  • BTC — Payment rails for premium

Why This Works

  1. Cloudflare free tier is generous (100k req/day)
  2. DeepSeek's API is fast and affordable
  3. IP rate limiting eliminates user management
  4. BTC payments are permissionless

Live Demo

curl https://free-llm-api.jianchuan.workers.dev/v1/chat/completions   -H "Authorization: Bearer free"   -H "Content-Type: application/json"   -d '{"model":"deepseek-v4-flash-free","messages":[{"role":"user","content":"Explain monads"}]}'

Full docs: https://jianchuan3.github.io/free-ai-api-deepseek/

#cloudflare #serverless #api #javascript #ai #webdev