← Gemini2tg

Essay

Gemini2tg, bringing Gemini into Telegram

A Python experiment that turned coursework into a Telegram interface for Gemini.

  • AI
  • Python
  • Projects
  • Insights

I built Gemini2tg when the Gemini API had just become available. The idea was simple: instead of opening another website to talk to the model, I wanted to reach it from Telegram, an app that was already part of my everyday communication.

The project was also a way to turn newly learned Python concepts into something tangible and useful.

From coursework to something useful

The project came after finishing Google’s Crash Course on Python and Using Python to Interact with the Operating System. The courses introduced Python syntax and scripting, then moved into files, processes, Linux, Bash, and automation.

Gemini2tg turned those separate lessons into one running system:

Telegram message → Python handler → Gemini API → Telegram reply

The Python process loaded API keys from a JSON configuration file, registered Telegram message handlers, called Gemini, and kept polling for the next update. A shell installer automated the Ubuntu environment, virtual environment, dependencies, configuration, and background process. The repository also gained Docker support.

What Gemini2tg connected

The bot handled two main kinds of interaction:

  • text messages were sent to gemini-pro through a conversational chat session;
  • photos and their captions were downloaded and sent to gemini-pro-vision.

The repository keeps chat state per Telegram user and uses /start to begin a new conversation. It also includes logging, configuration validation, temporary-image cleanup, an installation script, and a Dockerfile. The implementation remains intentionally direct: Telegram is the interface, Python is the glue, and Gemini generates the response.

Years later

Years later, seeing projects such as OpenClaw makes this small experiment feel different in hindsight. AI is no longer confined to a standalone website or a single question-and-answer conversation. It can live inside Telegram, WhatsApp, Slack, Discord, and other familiar places while using tools, remembering context, running background tasks, and acting across external services.

That is the change I find most exciting. The progress is not only that models have become better at replying. AI is gradually becoming part of the environment around everyday communication and work: available where people already are, capable of doing more than continuing a chat, and increasingly connected to the tools people use.

Gemini2tg is still a small and direct project. But what began as Python practice also captured an intuition I continue to like: AI does not always need to be another destination. Sometimes it is more useful when it quietly becomes part of the software already present in daily life.