A personal Telegram calorie tracker powered by Claude AI. Send a text description or a photo of your food ā the bot estimates calories and macronutrients (protein, fat, carbs) and logs them. Ask it what you've eaten today or over the last week.
- Text & photo input ā describe your meal or snap a photo; nutrition labels are also supported
- Calories + macros ā estimates kcal, protein, fat, and carbohydrates per meal
- Claude vision ā photo analysis via Claude Haiku
- Clarifying questions ā when Claude needs more info it asks;
/cancelto abort - Persistent log ā SQLite, survives restarts
/todayā today's meals with calorie and macro totals; shows progress vs daily targets when a profile is set/historyā 7-day summary grouped by date with goal icons (ā on track,ā ļø over, ā under)/undoā remove the last logged meal/settingsā toggle visible nutrients, enable/disable daily reminders, choose language/profileā guided setup for weight, height, age, sex, activity level, and goal; computes daily calorie & macro targets via Mifflin-St Jeor- Multi-language ā full i18n for English, German, and Russian (UI, keyboard, Claude responses)
- Daily reminders ā opt-in nudge at 20:00 CET with a Claude-generated message in your language
- Allowlist ā only authorised Telegram user IDs can interact
- Systemd service ā auto-restarts on crash, survives reboots
- CI/CD ā pytest runs on every push; deploys to production only if tests pass
| Layer | Choice |
|---|---|
| Bot framework | python-telegram-bot 22 |
| AI | Anthropic Claude Haiku (claude-haiku-4-5-20251001) |
| Database | SQLite via aiosqlite |
| Runtime | Python 3.11+, polling mode |
| Hosting | Ubuntu 22, systemd |
| CI/CD | GitHub Actions |
calbot/
āāā main.py # entry point ā wiring, allowlist, keyboard, daily reminders
āāā handlers/
ā āāā food.py # Telegram handlers (text, photo, today, history, cancel, undo, settings)
ā āāā profile.py # /profile ConversationHandler (guided setup for daily targets)
āāā services/
ā āāā claude.py # Claude API + conversation state + daily nudge generation
ā āāā nutrition.py # Mifflin-St Jeor daily target calculations
ā āāā database.py # SQLite CRUD (meals, settings, profiles)
āāā utils/
ā āāā i18n.py # translations (EN/DE/RU) and language helpers
ā āāā helpers.py # shared utilities (language resolution, etc.)
ā āāā photos.py # photo download ā base64
āāā tests/ # 153 pytest tests, fully mocked
āāā calbot.service # systemd unit file
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate a .env file:
BOT_TOKEN=<from @BotFather>
ANTHROPIC_API_KEY=<from console.anthropic.com>
ALLOWED_USER_IDS=<comma-separated Telegram user IDs>
LOG_LEVEL=INFO
Run:
python main.py
Run tests:
pip install -r requirements-dev.txt pytest
Copy calbot.service to /etc/systemd/system/, create .env at /opt/calbot/.env, then:
systemctl daemon-reload
systemctl enable --now calbot
journalctl -u calbot -fSee CLAUDE.md for full deployment and CI/CD setup instructions.