AI-powered Telegram bot that helps students solve educational tasks via text and photos.
- Solve tasks with plain text
- Solve tasks from photos (vision + reasoning)
- Daily token limit and notification
- Minimal vision token usage for cost-efficiency
Text flow
Text → Mistral → Telegram response
Photo flow
Photo → Gemini (vision) → Extracted text → Mistral → Telegram response
Gemini is used only for vision (OCR).
Mistral handles reasoning and answers.
Python 3.10+python-telegram-botgoogle-generativeai(Gemini)mistralai(Mistral)python-dotenvSQLite(built-in)
macOS / Linux
python3 -m venv venv
source venv/bin/activateWindows
python -m venv venv
venv\Scripts\activatepip install -r requirements.txtIf requirements.txt is missing, install manually:
pip install python-telegram-bot google-generativeai mistralai python-dotenvBOT_TOKEN=your_telegram_bot_token
MISTRAL_API_KEY=your_mistral_api_key
GEMINI_API_KEY=your_gemini_api_key
ADMIN_IDS=123456789,987654321BOT_TOKEN is requiredMISTRAL_API_KEY is required for solving tasksGEMINI_API_KEY is required for photo solvingADMIN_IDS is optional (comma-separated Telegram user IDs)
python main.pymain.py — application entry pointapp/config.py — environment configurationapp/handlers.py — Telegram message handlersapp/services.py — Mistral integration and business logicapp/vision.py — Gemini photo text extractionapp/limits.py — daily token limit logicapp/db.py — SQLite database logic
