ChatGPT Telegram Workers

TBXark/ChatGPT-Telegram-Workers ↗ ·★ 3.8k ·TypeScript ·MIT

Deploy your own ChatGPT Telegram bot on Cloudflare Workers in minutes — no server required. Supports multiple models and per-user configuration.

ChatGPT Telegram Workers screenshot
Stars
★ 3.8k
Language
TypeScript
License
MIT
Deploy targets
1

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 (or an Azure/compatible endpoint), and deploy. From there, everything is controlled through Telegram commands: per-user system prompts, conversation history, model selection and access whitelisting. The result is a private assistant you fully own and can lock down to just yourself or a small group.

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 and other providers, switchable per user
  • Per-user system prompts, history and configuration via Telegram commands
  • 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 LLM bot without managing a server

Getting started

  1. 1 Create a Telegram bot with @BotFather and copy its token
  2. 2 Get an API key from OpenAI (or your preferred provider)
  3. 3 Deploy to Cloudflare Workers — set TELEGRAM_AVAILABLE_TOKENS and API_KEY as environment variables/secrets
  4. 4 Register the webhook by visiting the worker's /init endpoint, then message your bot
#chatgpt#telegram#bot#workers#serverless

FAQ

Does this cost anything to run?

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.

Can I restrict who can use the bot?

Yes. You can whitelist Telegram chat IDs via environment variables so only you or your group can talk to it.

Which AI models are supported?

It supports OpenAI-compatible APIs including Azure OpenAI, and additional providers via configuration, so you can switch models without redeploying.

Deploy ChatGPT Telegram Workers for free

Free-tier platforms that can host this project. Pick one and ship it.