A secure, lightweight AI chatbot that runs entirely on Cloudflare's free tier. Powered by OpenRouter's top free AI models, with a built-in web dashboard for setup β no terminal, no CLI, no build step.
- β‘ Zero server cost β runs on Cloudflare's Free Tier. No VPS, no maintenance.
- π Copy-paste deploy β one
_worker.jsfile. Paste it into the dashboard. Done. - π¨ Web setup dashboard β configure tokens and settings in your browser, not in code.
- π€ 10 free AI models β switch any time with
/model, automatic fallback on rate limits. - πΎ Persists in KV β your settings survive code updates.
- π¬ Remembers context β multi-turn conversations per user.
| Feature | Description |
|---|---|
| π Model switcher | /model shows an inline keyboard of the top 10 free OpenRouter models |
| β»οΈ Auto-fallback | If a model is rate-limited (429), the next one is tried automatically |
| π§ Memory | Remembers the last 10 messages per user (/clear to wipe) |
| π Protected webhook | Secret-token check so only Telegram can reach your bot |
| ποΈ Web dashboard | Change tokens, system prompt, and model list at /setup |
| βοΈ Long replies | Auto-splits messages over Telegram's 4096-char limit |
Get your bot running in about 3 minutes, entirely in the browser.
- Go to Cloudflare Dashboard β Workers & Pages β KV.
- Click Create a namespace, name it
BOT_DB.
- Go to Workers & Pages β Create Application β Create Worker.
- Name it (e.g.
ai-bot) and click Deploy. - Click Edit code, delete the sample, paste the contents of
_worker.js, and click Deploy.
- Go to your Worker β Settings β Bindings (or Variables).
- Add a KV Namespace Binding:
- Variable name:
BOT_DB - KV namespace: select the
BOT_DByou created.
- Variable name:
- Save and Deploy.
- Open
https://<your-worker>.workers.dev/setup. - Enter:
- Telegram Bot Token β from @BotFather (
/newbot) - OpenRouter API Key β from openrouter.ai/keys (free, no card)
- Telegram Bot Token β from @BotFather (
- Click Save configuration, then click the Register webhook link.
- Open your bot in Telegram and send
/start. π
β οΈ Tip: Change the default admin password (admin) in the setup form right after your first save, so nobody else can edit your config.
Everything is changed from the web dashboard β no code edits needed:
/setupβ update tokens, system prompt (personality), or the model list/registerβ re-register the Telegram webhook (e.g. after changing the secret)/β status page showing whether the bot is configured
In Telegram:
/modelβ pick which free AI model answers you/clearβ wipe your conversation history/helpβ show commands
| Layer | Free limit | Meaning |
|---|---|---|
| Cloudflare Workers | 100,000 req/day | Effectively unlimited for a personal bot |
| Cloudflare KV | 100,000 writes/day, 1,000 lists | Plenty for chat history |
| OpenRouter free models | ~20 req/min, ~50β200 req/day | Your real bottleneck |
If you outgrow OpenRouter's free daily cap, a one-time $10 credit (never expires) raises the free-model daily limit to ~1000 requests.
The model list and personality are editable from /setup β but you can also
change defaults at the top of _worker.js:
DEFAULT_MODELSβ the model list and orderDEFAULT_SYSTEM_PROMPTβ the bot's personalityHISTORY_LIMITβ how many past messages to remember
Free model IDs (ending in :free) change over time β see the current list at
openrouter.ai/collections/free-models.
- Bot doesn't reply β check the Worker's Logs (real-time) in the dashboard,
and verify the webhook at
https://api.telegram.org/bot<TOKEN>/getWebhookInfo - "Setup needed" page β the
BOT_DBKV binding is missing (step 3) - 403 in logs β webhook secret mismatch; re-run Register webhook from
/setup - "All free models rate-limited" β you hit OpenRouter's daily free quota; wait for reset or add the one-time $10 credit