ChatGPT Telegram Workers
tbxark/ChatGPT-Telegram-Workers ↗ ·★ 3.8k ·TypeScript ·MIT
Deploy a serverless Telegram AI bot on Cloudflare Workers with many providers, streaming, commands, plugins and text-to-image support.
Overview
ChatGPT Telegram Workers turns a Cloudflare Worker into a fully functional ChatGPT bot that lives inside Telegram. Because it is webhook-driven and serverless, there is no process to keep running — the Worker wakes up when a message arrives, calls your LLM provider, replies, and goes back to sleep. That model fits the Cloudflare free tier perfectly and keeps your hosting bill at zero.
Setup is mostly configuration rather than code. You create a bot token with BotFather, supply an API key for OpenAI, Azure, Anthropic, Gemini, DeepSeek or another supported provider, and deploy. From there, Telegram commands and inline keyboards handle presets, model switching and access control. The README also calls out streaming output, text-to-image generation, multiple bot support and a plugin system for custom behavior.
This project is also a clean reference for the broader “serverless bot” pattern on Cloudflare. If you want to understand how Workers, secrets and Telegram webhooks fit together, the codebase is small enough to read end to end while still being production-usable.
Highlights
- ✓ Runs entirely on Cloudflare Workers — no VPS, no always-on process to pay for
- ✓ Supports OpenAI, Azure, Anthropic, Gemini, DeepSeek, Groq and other providers
- ✓ Inline model switching, custom commands, streaming replies and plugin hooks
- ✓ Webhook-based, so it scales to zero and only runs when a message arrives
Best for
- →A private ChatGPT bot for yourself or a small group
- →Learning the Cloudflare Workers + Telegram webhook pattern
- →Anyone who wants an AI bot without managing a server or Docker host
Getting started
- 1 Create a Telegram bot with @BotFather and copy its token
- 2 Get an API key from OpenAI, Azure, Anthropic, Gemini or another supported provider
- 3 Deploy to Cloudflare Workers — set TELEGRAM_AVAILABLE_TOKENS and API_KEY as environment variables/secrets
- 4 Register the webhook by visiting the worker's /init endpoint, then message your bot
FAQ
The Cloudflare Workers free tier covers the bot's hosting (100k requests/day). You still pay your LLM provider for API usage — the bot itself is free to host.
Yes. You can whitelist Telegram chat IDs via environment variables so only you or your group can talk to it.
The README lists OpenAI, Azure OpenAI, Cloudflare AI, Cohere, Anthropic, Mistral, DeepSeek, Gemini, Groq and other providers, with model switching through Telegram inline keyboards.
Deployment guides
Deploy ChatGPT Telegram Workers for free
Free-tier platforms that can host this project. Pick one and ship it.