A Telegram chatbot powered by OpenRouter AI that allows you to chat with multiple AI models directly in Telegram. Switch between free models like Mistral, Gemma, DeepSeek, and Qwen β or easily add your own custom models in the code!
- Inline Menu & Reply Keyboard β choose AI models easily while typing.
- Persistent Conversation Memory β each user's chat is saved in JSON files.
- Typing Indicator β feels like chatting with a real human.
- Customizable Models β edit
FREE_MODELSin the code to add or change AI models. - Interactive Setup Script β one command installs everything on Ubuntu.
- Systemd Integration β bot starts automatically with the system.
- Clone this repository:
git clone https://github.com/bboyJohnn/Telegram-bot-OpenRouter.git
cd telegram-openrouter-bot- Run the interactive setup script on Ubuntu:
./setup_bot.sh- Enter your
TELEGRAM_BOT_TOKENandOPENROUTER_API_KEY. The bot will be deployed and start automatically.
Open bot.py and locate the FREE_MODELS dictionary:
FREE_MODELS = {
"Mistral 7B": "mistralai/mistral-7b-instruct:free",
"Gemma 3 12B": "google/gemma-3-12b-it:free",
"DeepSeek R1": "deepseek/deepseek-r1:free",
"Qwen 2.5 32B": "qwen/qwen2.5-vl-32b-instruct:free",
}- Add a new model:
"YourModelName": "your/model-id:tag"- Remove or rename existing models as you like.
The bot will automatically show any new or modified models in both the inline menu and reply keyboard.
/startβ start the bot and show menus/helpβ show available commands/clearβ clear conversation history/menuβ show inline menu again/mistral,/gemma,/deepseek,/qwenβ directly select a model
- Each user has a separate JSON history, so the bot remembers previous messages.
- You can extend the bot by adding new features or connecting more models.
You can fully customize the bot by editing bot.py:
- Change models in
FREE_MODELSdictionary. - Modify the reply keyboard or inline menu layout.
- Extend commands or add new AI interaction features.
Make it your own AI Telegram hub!