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.pyRun tests:
pip install -r requirements-dev.txt
pytestCopy 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.