About ChatGPT Telegram Bot 0.4.2 — OpenAI Models in Telegram (Python)
chatgpt-telegram-bot is a Python bot that puts OpenAI’s models into Telegram. You message it the way you would message a person, and it answers with the chat model you configured. It can also draw images with DALL·E, transcribe voice and video messages with Whisper, read images you send it, and reply in speech. It is released under GPL-2.0 by n3d1117 and contributors.
This page links to GitHub’s source archive of release 0.4.2. Bineret did not write this bot and is not affiliated with its authors, or with OpenAI.
Read this first: it is not being maintained
The latest release, 0.4.2, came out on 28 December 2024, and that is also the date of the last commit. Nothing has changed in the code for about twenty months. In practice that means:
- The newest models it knows about are GPT-4o and a preliminary o1. You can set any model name in
OPENAI_MODEL, but features built around a model’s specifics, such as vision or token pricing, stop at those. - The prices it uses for usage statistics and budgets are defaults from that period, such as
TOKEN_PRICE=0.002per 1,000 tokens. If you use budgets, set current prices yourself or the limits will be wrong. - Dependencies are pinned to their late-2024 versions, including
openai==1.58.1andpython-telegram-bot==21.9. - Plugins that wrap outside services break when those services change. The project already removed one, a DuckDuckGo translate plugin, when its API disappeared.
It still does the core job with a small setup. Just go in expecting to fix things yourself.
What it does
- Answers in Markdown, streams replies as they are written, and shows a typing indicator.
- Keeps conversation history, summarises it automatically after
MAX_HISTORY_SIZEmessages to limit tokens, and resets with/reset. - Image generation with
/image, speech with/tts, and vision on images you send. - Transcribes audio and video messages with Whisper, which may need
ffmpeg. - Works in groups, optionally only when a message starts with a trigger keyword, and in inline mode.
- Tracks token usage per user, shows it with
/stats, and enforces daily, monthly or all-time budgets per user and for guests. - 14 plugins through OpenAI function calling, including weather, web and image search, WolframAlpha, Spotify, DeepL translation, whois and website screenshots.
- Talks to OpenAI-compatible APIs through
OPENAI_BASE_URL, and supports a proxy for OpenAI, Telegram or both. - Bot messages in 18 languages, Persian included.
One setting to change before anyone else finds it
ALLOWED_TELEGRAM_USER_IDS defaults to *, meaning everyone can talk to your bot, and every message is paid for with your OpenAI key. Set it to your own user ID, and the IDs of the people you mean to share it with, before you start the bot. Budgets are the second line of defence, not the first.
Requirements
Python 3.9 or newer (the project’s Dockerfile uses python:3.9-alpine), a Telegram bot token from BotFather, and an OpenAI API key or an OpenAI-compatible endpoint. Docker is optional.
When to use something else
If you want current model support and active fixes, look for a maintained project. If what you really want is a web chat for a team rather than a Telegram bot, LibreChat is actively developed. If the aim is to protect a Telegram group rather than chat in one, tg-spam is the tool for that.
Key capabilities
Unmaintained, and says so here
0.4.2 and the last commit are from 28 December 2024. Model support stops at GPT-4o and a preliminary o1, the default prices are from that time, and dependencies are pinned to late-2024 versions. It runs; fixes are yours.
Lock it down before launch
ALLOWED_TELEGRAM_USER_IDS defaults to * so anyone can use the bot on your API key. Set it to your own ID and the people you invite before starting, then add budgets as a second limit.
More than text
DALL·E images with /image, text-to-speech with /tts, vision on photos you send, and Whisper transcription of voice and video messages, each switchable in the .env file.
Budgets per user
Token use is tracked per user and shown with /stats. Budgets reset daily, monthly or never, with a separate budget for guests in groups. Update the price settings first, since the defaults are dated.
Plugins through function calling
14 plugins, from weather and DuckDuckGo search to WolframAlpha, Spotify, DeepL, whois and website screenshots. Those wrapping outside services can break when the service changes, with nobody patching them.
Questions & Answers
Is it still maintained?
No. Release 0.4.2 and the last commit are both from 28 December 2024. It still runs, but new models, API changes and broken plugins are yours to handle.
Can I use a newer model than GPT-4o?
You can put any model name in OPENAI_MODEL, and plain chat will often work. Features that depend on model details, such as vision, token limits and cost tracking, were written for the models of late 2024 and may misbehave.
Can it use something other than OpenAI?
Any OpenAI-compatible API, by setting OPENAI_BASE_URL. The README mentions LocalAI and text-generation-webui as examples.
Who pays for the messages?
You do, through your API key. That is why ALLOWED_TELEGRAM_USER_IDS matters: by default anyone who finds the bot can use it. Budgets can cap spending per user and for guests in groups.
Does it work in groups?
Yes. Users not in the allowed list count as guests with their own budget, and GROUP_TRIGGER_KEYWORD stops it replying to every message. Transcription and vision are ignored in groups by default.
Why do voice messages fail?
Transcription may need ffmpeg installed on the machine running the bot. The Docker image is the simplest way to avoid that.
Is the bot's interface available in Persian?
Yes, set BOT_LANGUAGE=fa. That changes the bot's own messages; the model answers in whatever language you write to it.
Is Bineret connected to this project or to OpenAI?
No to both. This page describes the project and links to the source archive GitHub generates for its tag.
Tutorials
1. Get the two keys
A Telegram bot token: message @BotFather, send /newbot and follow the prompts. An OpenAI API key from your OpenAI account, or the address and key of an OpenAI-compatible API.
2. Find your Telegram user ID
Message @getidsbot and it replies with your numeric ID. You need it for the next step.
3. Configure
unzip chatgpt-telegram-bot-0.4.2.zip
cd chatgpt-telegram-bot-0.4.2
cp .env.example .env
In .env, set at least these four:
OPENAI_API_KEY=sk-...
TELEGRAM_BOT_TOKEN=12345678:your-token
ADMIN_USER_IDS=your-user-id
ALLOWED_TELEGRAM_USER_IDS=your-user-id
Do not leave ALLOWED_TELEGRAM_USER_IDS at its default of *, which lets anyone use the bot on your key. List several IDs separated by commas.
4a. Run from source
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
python bot/main.py
4b. Or run with Docker
docker compose up
This builds the image from the included Dockerfile, so it runs the 0.4.2 code you downloaded.
5. Optional settings worth a look
OPENAI_MODEL picks the model (default gpt-4o). PLUGINS=weather,ddg_web_search turns plugins on. BOT_LANGUAGE=fa switches the bot's own messages to Persian. GROUP_TRIGGER_KEYWORD makes it answer in groups only when a message starts with that word. If you set USER_BUDGETS, update TOKEN_PRICE and the other price settings to current values first.
Support
Where support comes from
The project's README documents every setting, and questions and bugs go to its GitHub issues. Given how long it has been since the last commit, do not count on a reply; searching existing issues is often faster.
What Bineret covers
This page. If the download link is broken or something written here is wrong, tell us and we will fix it. We do not host the bot, supply API keys, or maintain the code.
Licence and warranty
GPL-2.0. You can use, study, change and share it; if you distribute a modified version, you must share its source under the same licence. It comes without warranty, and running it on your own API key means you carry the cost of whatever it sends.

