A free AI chat + translation API on Cloudflare Workers AI (no credit card, ~5 minutes) A developer published two MIT-licensed Cloudflare Workers templates that expose free LLM endpoints on Cloudflare Workers AI without a paid API key: a chat API using Llama 3.1 8B with conversation history, configurable system prompt, CORS and optional bearer-token auth, and a translation endpoint using Meta's m2m100-1.2b covering 100 languages callable via GET or POST. Both rely on the Workers AI `[ai]` binding and deploy with `npx wrangler deploy`, drawing on the free plan's daily neuron allocation for prototyping. If you're building a side project and just want an LLM endpoint without wiring up a paid API key, Cloudflare Workers AI is worth a look. The free plan includes a daily allocation of "neurons" Cloudflare's usage unit for open models like Llama 3.1 8B and m2m100. That's plenty for prototypes, demos, and low-traffic tools. Limits are set by Cloudflare and can change, so check the current pricing page. I packaged two small, tested Workers as an MIT-licensed free download: cf-ai-starter-lite.zip https://cf-ai-starter-shop.pages.dev/cf-ai-starter-lite.zip . The full code is below too, so you can copy it straight from this post. 01-chat-api : a chat endpoint with conversation history, a configurable system prompt, CORS, and optional bearer-token auth 04-translate : a translation endpoint for 100 languages m2m100 , callable with GET or POST 01-chat-api/wrangler.toml : name = "cf-chat-api" main = "worker.js" compatibility date = "2026-10-01" ai binding = "AI" The ai binding is the only thing that makes Workers AI available as env.AI . 01-chat-api/worker.js : // Free LLM chat API on Cloudflare Workers AI // POST /chat {"message":"hi","history": {"role":"user","content":"..."} ,"system":"optional"} const MODEL = "@cf/meta/llama-3.1-8b-instruct"; const cors = { "Access-Control-Allow-Origin": " ", "Access-Control-Allow-Headers": "Content-Type, Authorization", "Access-Control-Allow-Methods": "POST, OPTIONS" }; const json = d, s = 200 = new Response JSON.stringify d , { status: s, headers: { "Content-Type": "application/json", ...cors } } ; export default { async fetch req, env { if req.method === "OPTIONS" return new Response null, { headers: cors } ; if env.API KEY && req.headers.get "Authorization" == Bearer ${env.API KEY} return json { error: "unauthorized" }, 401 ; if req.method == "POST" return json { error: "POST /chat" }, 405 ; let body; try { body = await req.json ; } catch { return json { error: "invalid JSON" }, 400 ; } if body.message || typeof body.message == "string" return json { error: "message string required" }, 400 ; const history = Array.isArray body.history ? body.history.slice -20 : ; const messages = { role: "system", content: body.system || "You are a helpful, concise assistant." }, ...history, { role: "user", content: body.message } ; const out = await env.AI.run env.MODEL || MODEL, { messages, max tokens: body.max tokens || 512 } ; return json { reply: out.response, model: env.MODEL || MODEL } ; }, }; 04-translate/wrangler.toml : name = "cf-translate" main = "worker.js" compatibility date = "2026-10-01" ai binding = "AI" 04-translate/worker.js : // Translation endpoint using Meta m2m100 100 languages // POST {"text":"Hello","target lang":"french","source lang":"english"} or GET /?text=Hello&to=spanish const MODEL = "@cf/meta/m2m100-1.2b"; const json = d, s = 200 = new Response JSON.stringify d , { status: s, headers: { "Content-Type": "application/json", "Access-Control-Allow-Origin": " " } } ; export default { async fetch req, env { let text, to, from; if req.method === "GET" { const u = new URL req.url ; text = u.searchParams.get "text" ; to = u.searchParams.get "to" ; from = u.searchParams.get "from" ; } else { try { { text, target lang: to, source lang: from } = await req.json ; } catch { return json { error: "invalid JSON" }, 400 ; } } if text || to return json { error: "text and target lang required" }, 400 ; const o = await env.AI.run MODEL, { text, target lang: to, source lang: from || "english" } ; return json { translated text: o.translated text, target lang: to } ; }, }; Put each pair of files in its own folder or unzip the free download , then: cd 01-chat-api npx wrangler login npx wrangler deploy Repeat in 04-translate . curl -X POST https://