Important
This project is no longer maintained. It grew up into Petcast, a finished app that paints a new picture of your pets in today's weather every morning, for your home screen, your wallpaper and your picture frame.
- petcast.app: the app for iPhone and Android, with 30+ art styles, family sharing, birthdays and holidays.
- Get it on Google Play. The App Store version is coming soon.
- Picture frames: send the daily picture to a digital or e-ink frame, with a preset for the reTerminal E1002 this project was built for.
- Art styles: every style, painted with real pets.
The code below still works as a self-hosted starting point, but it won't get updates or fixes.
AI-generated daily pet weather forecasts for e-ink displays. Heavily inspired by forecats.
Petcast picks your pets, checks the weather, designs a scene with OpenAI gpt-5.6-sol at low reasoning effort, renders it with OpenAI gpt-image-2.5-sunburst, dithers it for a 6-color e-ink palette, and serves it over HTTP for your display to fetch. Either generation step can also use Gemini.
Five new styles, with different randomly selected pet groups. Click an image for the full-color original, or compare its six-color display version. Full sample gallery and scene descriptions.
| Claymation miniature Zeya, Patrick, Pixel, Kona ![]() E-ink version |
Medieval bestiary Patrick, Pixel ![]() E-ink version |
| Vintage enamel sign Pebble, Fennec ![]() E-ink version |
Painted wooden toy diorama Margot, Zeya, Pebble ![]() E-ink version |
| Photorealistic surrealism Margot, Zeya, Pebble, Mumford, Fennec ![]() E-ink version |
- Pick a photo — randomly selects a reference photo from your collection. The pets in that photo become the cast for the day.
- Fetch weather — pulls today's forecast from Open-Meteo (free, no API key needed). The weather code is computed as the dominant condition across daylight hours (not Open-Meteo's "worst hour wins" default), so a single overcast hour won't turn a sunny day cloudy.
- Generate a scene — the configured scene provider (default: OpenAI
gpt-5.6-solat low reasoning effort; optionally Gemini 2.5 Flash) designs an anthropomorphic scene where the pets do human-like activities (sipping coffee, flying kites, reading books) appropriate to the weather, season, and location-specific phenology (bare vs. budding vs. leafed-out trees, etc.), described in the visual language of a randomly chosen art style. - Generate the image — the configured image provider (default: OpenAI
gpt-image-2.5-sunburst; optionally Gemini 3 Pro) renders the scene with creatively integrated weather info (date, temperature, weather icon), using one or more reference photos for pet likeness. The weather info is woven into the art style — on a sign, chalkboard, newspaper, banner, etc. - Dither — Atkinson dithers the image to the Spectra 6 e-ink palette (black, white, red, green, blue, yellow) at 800x480.
- Serve — an HTTP server lets your display fetch the image whenever it's ready.
Requires Python 3.13+ and uv. Run commands from the repository root. Before generating, set your location in config.yaml and add your photos and pet descriptions as described in Fork and make it your own.
# Clone and customize
git clone https://github.com/kylekampy/petcasts.git
cd petcasts
# Add the API key for the default scene and image models
# https://platform.openai.com/api-keys
cat > .env <<EOF
OPENAI_API_KEY=...
EOF
# Add GOOGLE_API_KEY to .env if you configure either step to use Gemini.
# Install deps
uv sync
# Test weather
uv run python -m petcast weather
# Test selection
uv run python -m petcast select --count 10
# Generate an image
uv run python -m petcast generate --debug
# Force a specific style (overrides the style cooldown)
uv run python -m petcast generate --debug --style "claymation"
# Test low battery behavior
uv run python -m petcast generate --debug --battery 8
# Start the HTTP server
uv run python -m petcast serveselect --count 10 previews choices without recording history. generate makes a paid API call for each generation step and updates the current image and history. The --style option matches the first configured style containing your text, case-insensitively.
Open output/latest_raw.png for the full-color result and output/latest.png for the 800×480 display version. output/latest.json includes the pets, style, scene description, forecast, and reference-photo names. Debug images use fixed filenames; copy anything you want to keep before another debug run. Each run's dithered image and metadata are retained under output/archive/, while output/daily/ keeps only the latest run for each date.
# Run from GitHub Container Registry
docker run -d \
--name petcast \
-p 7777:7777 \
-e OPENAI_API_KEY=... \
-v /opt/volumes/petcast/state:/app/pets/state \
-v /opt/volumes/petcast/output:/app/output \
--restart unless-stopped \
ghcr.io/kylekampy/petcasts:latest
# Trigger a generation
curl -X POST http://localhost:7777/api/generate
# Check status
curl http://localhost:7777/api/status
# Fetch the image
curl http://localhost:7777/output/latest.png -o forecast.png
# Browse past images
curl http://localhost:7777/api/archive
# Generate again today
curl -X POST http://localhost:7777/api/generate \
-H 'Content-Type: application/json' \
-d '{"force": true}'Persist both the state and output mounts: state holds cooldown and celebration history. The published image includes this repository's pets and configuration. To use your own without rebuilding, also mount your pets/input/, pets/meta/, and config.yaml at the corresponding paths under /app, read-only. Mount config.local.yaml at /app/config.local.yaml for private settings, and pass GOOGLE_API_KEY if you enable Gemini.
Designed for the Seeed reTerminal E1002 (800x480, Spectra 6 color e-ink) running ESPHome.
The frame wakes from deep sleep once a day, triggers image generation on the server, fetches the result, updates the e-ink display, and goes back to sleep. The whole cycle takes about 2 minutes.
- Green (wake): wakes from deep sleep, fetches latest image
- Right white (regenerate): triggers a new generation while awake
- Left white (test pattern): toggles a color calibration test pattern
The frame sends its battery percentage with each generation request. When battery drops below 15%, the pets in the scene look worried about running out of energy — huddling around dying lanterns, clutching dimming flashlights, etc.
- Copy
esphome/petcast-frame.yamlto your ESPHome config directory - Create
esphome/secrets.yaml:wifi_ssid: "your-wifi-ssid" wifi_password: "your-wifi-password" ap_password: "your-fallback-ap-password"
- Update the server URL in
petcast-frame.yaml(default:http://mini:7777) - Update the timezone (default:
America/Chicago) - Flash to your ESP32-S3
- Fork this repo
- Replace the pet photos in
pets/input/with your own - Edit
pets/meta/pets.yaml— name each pet, describe their appearance and personality, and list which photos they appear in - Edit
config.yaml— set your location, tweak styles, adjust cooldowns - Add
OPENAI_API_KEYto.envfor local development and to the container's environment at runtime. AddGOOGLE_API_KEYif eitherimage_providerorscene_provideris set togemini. The container build does not need model API keys. - Push — the GitHub Action builds and publishes your container to your own ghcr.io registry
pets:
- name: "Luna"
description: >-
A golden retriever. Fluffy cream coat, dark eyes, always smiling.
Loves swimming and carrying sticks.
photos:
- "luna_and_max.png"
- "luna_solo.png"
- name: "Max"
description: >-
A black lab. Sleek short coat, brown eyes, floppy ears.
Ball obsessed. Will not give it back.
photos:
- "luna_and_max.png"
- "max_sleeping.png"Photos define natural groupings — if Luna and Max appear in luna_and_max.png, they'll sometimes be generated together. Solo photos mean solo scenes.
| Endpoint | Method | Description |
|---|---|---|
/api/generate |
POST | Start generation asynchronously (202). Optional body: {"battery": 85, "force": true}. Returns 429 if already generated today without force, or 409 if generation is in progress. |
/api/status |
GET | Latest metadata + generating flag |
/api/archive |
GET | List all archived images with metadata |
/output/latest.png |
GET | Latest dithered image (800×480, for the e-ink frame) |
/output/latest_raw.png |
GET | Latest full-quality raw image (1600×960 by default, for sharing) |
/output/latest.json |
GET | Latest metadata |
/output/daily/YYYY-MM-DD.png |
GET | Per-day raw image (one per day, overwritten on re-run) |
/output/daily/YYYY-MM-DD_eink.png |
GET | Per-day dithered image |
/output/daily/YYYY-MM-DD.json |
GET | Per-day metadata |
/output/archive/... |
GET | Every run's dithered image and metadata, organized by date/time |
Key knobs in config.yaml:
image_provider: 'openai' # 'openai' | 'gemini'
scene_provider: 'openai' # independent of image_provider
openai:
image_model: 'gpt-image-2.5-sunburst'
quality: 'medium' # 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'auto'
size: '1600x960' # exact 5:3, twice the frame resolution; no crop needed
chat_model: 'gpt-5.6-sol'
chat_reasoning_effort: 'low'
gemini:
image_model: 'gemini-3-pro-image-preview'
chat_model: 'gemini-2.5-flash' # used when scene_provider is gemini
cooldowns:
photo_days: 7
style_days: 7 # exclude styles used in the last 7 days; 0 disables itconfig.local.yaml overrides the checked-in config automatically and is ignored by git. Nested settings merge, but lists such as styles replace the base list; celebration events append. PETCAST_PRIVATE_CONFIG can specify additional overlay paths, separated by your platform's path separator (: on Linux/macOS).
Petcast can add birthdays, anniversaries, holidays, and other special days to
the scene and image prompts. Public holiday support is built in for common U.S.
holidays plus Pi Day and May the Fourth. Private dates go in config.local.yaml,
which is ignored by git.
cp config.local.example.yaml config.local.yamlExample event:
celebrations:
events:
- id: family-anniversary
name: Family Anniversary
kind: anniversary
date: '2001-06-15'
message_template: 'Happy {ordinal} Anniversary'
prompt: >-
Include all requested pets celebrating together and looking at the
camera, like a warm group portrait.
pets: all
photo: none # auto-select multiple reference photos if no single photo has all pets
priority: 90date may be YYYY-MM-DD, MM/DD/YY, Month D, YYYY, or a month/day with a
separate start_year. Birthday and anniversary events can use {ordinal},
{years}, {name}, and {year} in message_template.
Celebration scene ideas are recorded in pets/state/celebrations.json so the
prompt can avoid reusing last year's concept for the same event. That file is
also ignored by git.
src/petcast/scene.py contains a _PHENOLOGY_CALENDAR tuned for the upper Midwest (~44°N) that maps each date range to a landscape description (bare trees vs. budding vs. full canopy, etc.). This is injected into the scene prompt so late-April scenes show tender pale-green leaves, mid-October shows peak fall color, and so on — rather than generic "spring" or "fall" cues. If you're in a different climate, edit _PHENOLOGY_CALENDAR to match your local transitions.
Art styles are listed under styles: in config.yaml. The collection contains 19 styles spanning painting, printmaking, collage, sculpture, and photography. New additions are claymation, medieval bestiary, vintage enamel sign, painted wooden toy diorama, and photorealistic surrealism. Closely overlapping abstract cut-paper, vintage travel poster, minimalist poster, jazzy mid-century illustration, linocut, and papercut entries have been removed.
Style selection randomly chooses from styles that have not appeared during the last cooldowns.style_days days (default 7). This replaces the old style_uses weighting and combo_days style-history window. Set style_days: 0 to allow all styles. If every configured style is on cooldown, the full list becomes available so generation can continue. Moderation retries use the same eligible pool; --style explicitly overrides the initial selection.
Bold shapes, readable weather lettering, strong contrast, and quiet backgrounds help all styles survive the six-color display. Drawn styles use thick outlines; photography and miniature scenes retain natural lighting and three-dimensional materials. Photorealistic surrealism combines recognizable real pets with playful impossible scale or settings. Each medium determines the appearance, while the pets keep doing their own weather-appropriate activity.
Default: OpenAI gpt-image-2.5-sunburst at medium quality and 1600x960, plus gpt-5.6-sol at low reasoning effort for the scene. Adjust openai.chat_reasoning_effort to tune reasoning; use none for no reasoning on models that support it.
Sunburst and Flare share the same standard token rates: $8 per million image input tokens, $2 per million cached image input tokens, $30 per million image output tokens, $5 per million text input tokens, and $1.25 per million cached text input tokens. Equal token rates do not guarantee equal cost per image: usage depends on the model, quality, dimensions, prompt, and reference photos. Scene generation is billed separately. See OpenAI pricing and the image cost guide for current rates and estimates.
Switch providers independently via image_provider and scene_provider in config.yaml:
openai— tuneopenai.qualityandopenai.sizefor image generation. GPT Image access may require a verified OpenAI organization.gemini— usesgemini.image_modelfor images andgemini.chat_modelfor scenes.
uv sync
uv run pytestThe tests use mocked providers and do not incur model API charges. Scene concept and activity instructions live in src/petcast/scene.py; the final image prompt in src/petcast/generate.py enforces pet counts, likeness, weather lettering, and display composition. Keep both prompts aligned when changing behavior. Style descriptions live in config.yaml, and cooldown selection lives in src/petcast/select.py.




