AI Photo Recipe — Vision-bot
Telegram bot that recognizes ingredients in refrigerator photos through Gemini Vision and generates 3 recipes based on 4 diet styles (balanced / high-protein / low-calorie / vegetarian).
Technically interesting aspects:
— Photo mode: Gemini Vision identifies ingredients → LLM generates 3 recipes with calories, protein, and cooking steps
— URL mode: Playwright parser for any recipes from pages (with image/CSS blocking for speed) + LLM normalization into structure
— Fallback to OpenRouter when Gemini is geo-blocked from the server (production lessons)
— Redis cache by SHA-256 photo + preferences — same fridge + same preferences = no repeated request to Vision
— Pydantic validation of all LLM outputs — poor format gets discarded before reaching the user
— Rate limit on Redis per user per hour
— Two-mode router (F.photo handler vs URL handler) in aiogram
Stack: aiogram, Gemini Vision (google-genai), OpenRouter, Playwright, async SQLAlchemy + PostgreSQL, Redis, Pydantic, Alembic, Docker, GitHub Actions.
Technically interesting aspects:
— Photo mode: Gemini Vision identifies ingredients → LLM generates 3 recipes with calories, protein, and cooking steps
— URL mode: Playwright parser for any recipes from pages (with image/CSS blocking for speed) + LLM normalization into structure
— Fallback to OpenRouter when Gemini is geo-blocked from the server (production lessons)
— Redis cache by SHA-256 photo + preferences — same fridge + same preferences = no repeated request to Vision
— Pydantic validation of all LLM outputs — poor format gets discarded before reaching the user
— Rate limit on Redis per user per hour
— Two-mode router (F.photo handler vs URL handler) in aiogram
Stack: aiogram, Gemini Vision (google-genai), OpenRouter, Playwright, async SQLAlchemy + PostgreSQL, Redis, Pydantic, Alembic, Docker, GitHub Actions.