A Telegram bot that translates messages using a locally running LLM (Ollama), so no data leaving your machine.
Example:
- Input:
Hello, how are you? - Output:
Привет, как дела?
- Language is detected using
langdetect - Target language is selected via simple rules (you can easily customise it however you like):
- EN / DE -> Russian
- RU -> English
- A prompt is sent to the local LLM
- The model returns only the translated text
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activatepip install -r requirements.txtCreate a .env file:
TOKEN=your_telegram_bot_token
MODEL=model_of_your_choiceMake sure Ollama is running locally:
ollama run qwen3Default API endpoint:
http://localhost:11434/api/generate
python bot.py