Bulk-import printed recipes into Mealie. Put a printed recipe in the scanner, hit one button, and Claude transcribes it into a real recipe: ingredients, steps, times, tags. You review and fix anything odd, then it publishes to Mealie through the API with the scan attached as the photo.
It was built for my wife's reams of letter-sized recipe printouts, fed through a Brother ADS-1700W (sheetfed, duplex ADF). Any scanner SANE can drive will work, and drag-and-drop of PDFs or images works with no scanner at all.
Two more tabs work on recipes that are already in Mealie, so the same tooling cleans up an existing library: Refine rewrites the description and organizers and turns plain-text ingredient lines into parsed amounts/foods, and Images replaces a scan with a real or generated photo.
The tabs are a pipeline, left to right.
1 · Scan. One click runs the ADF, pulls the pages in, and queues them. Or drag in PDFs/images. Pages are grouped into recipes (1 page each, or 2 for double-sided sheets, then split/merge by hand). Recognize sends each recipe's pages to Claude as a single vision call and fills in name, description, yield, prep/cook/total time, ingredients, steps, categories and tags. It runs in the background, so a stack keeps moving while you work.
2 · Review. The recognized drafts in a list, each shown next to its scan so you can check the transcription and edit before committing. Import to Mealie creates the recipe, populates it, and uploads the scan as its image.
3 · Refine. Pick a recipe that already lives in Mealie. Claude proposes a
description plus categories, tags and tools, seeded with the organizer names your
instance already uses so it reuses Dinner instead of coining dinner. Separately,
Mealie's own NLP ingredient parser runs over the ingredient lines and returns an
editable preview of the parsed amounts, units and foods. Nothing is written until you
click Save to Mealie.
4 · Images. Replace a recipe's image with a real photo (Pexels search), a
generated one (OpenAI gpt-image-1), or an upload. The previous scan is stashed as a
recipe asset first, so it's never lost. Both API keys are optional; each source hides
itself when its key is unset.
Refine and Images each track which recipes you've already done, with a hide done filter, so a long library can be worked through over several sittings.
Two containers, because the scanner and the server usually aren't the same machine:
Scanner ──USB──► scan agent ──HTTP──► app ──► Claude → review → Mealie
(PC by the scanner) (server)
- App. Web UI, recognition, Mealie publishing. Holds every API key.
- Scan agent. A small, deliberately keyless container that does nothing but drive the USB scanner and hand back page images.
The app can also drive a network scanner itself over WiFi, which is how this started. It was flaky enough on the ADS-1700W that the agent exists to replace it, but it's still there if a second machine isn't worth it.
Python/FastAPI, SQLite for drafts, and a no-build vanilla-JS frontend. No registry, no build step, no framework.
- A Mealie v1 instance and a long-lived API token (Profile → Manage Your API Tokens).
- An Anthropic API key. Recognition is one vision call per recipe. See Cost below.
- Docker with Compose.
- Optional: a scanner. Optional: Pexels (free) and/or OpenAI keys for the Images tab.
git clone https://github.com/<you>/mealieimport.git
cd mealieimport
cp .env.example .env # ANTHROPIC_API_KEY, MEALIE_URL, MEALIE_TOKEN at minimum
docker compose up -d --buildOpen http://:9926. Scans, images and the SQLite draft DB live in ./data
(a bind mount). That directory is the whole backup unit.
docker-compose.yml uses host networking, so the app resolves and reaches Mealie,
the Anthropic API and a network scanner the same way the host does. That's Linux only;
on Docker Desktop (macOS/Windows), drop network: host and network_mode: host and
publish ports: ["9926:9926"] instead. The file has a comment where to do it.
MEALIE_URL has to be reachable from the app container. If Mealie is in the same
Docker stack, use its service name; otherwise its LAN or HTTPS address.
Runs on whatever machine the scanner is plugged into. Keyless: no Anthropic or Mealie secrets go on that box.
Windows + Docker Desktop: Docker runs in a Linux VM, so the USB device has to be handed in with usbipd-win:
winget install usbipd
usbipd list # note the scanner's BUSID, e.g. 2-4
usbipd bind --busid <BUSID> # once
usbipd attach --wsl --busid <BUSID> # again after every reboot or replugLinux: USB is native to Docker, so skip usbipd.
Then, in a clone of this repo on that machine:
docker compose -f docker-compose.agent.yml up -d --build
docker compose -f docker-compose.agent.yml exec scanagent scanimage -LYou want a brother5:bus…;dev… device in that listing. Nothing listed means the USB
bridge didn't attach, so re-check usbipd attach --wsl.
Finally set SCAN_AGENT_URL=http://<that-PC-ip>:9927 in the app's .env, run
docker compose up -d, and the Scan button will pull from it.
Leave SCAN_AGENT_URL blank and point the app at the scanner directly:
- Find the scanner's IP. On the ADS-1700W: Settings → Network → WLAN → status, or your router's lease table. Reserve a DHCP lease so it can't move.
- Set
SCANNER_HOSTin.envanddocker compose up -d. - Confirm the app sees it:
docker compose exec mealieimport scanimage -L
If it isn't listed, or a scan fails on the source name, get the exact strings from the
device and set SCANNER_DEVICE / SCANNER_SOURCE to match:
docker compose exec mealieimport scanimage -d "<device>" -A | grep -i sourceSCANNER_BACKEND=airscan uses driverless eSCL/WSD, which is worth trying first on
non-Brother hardware. The ADS-1700W needs Brother's brscan5 (SCANNER_BACKEND=brother,
the default), which the image installs and registers by IP at startup. Brother only
ships that driver as an amd64 .deb, so the image won't build on ARM. On a Pi or
Apple Silicon, use airscan and drop the brscan5 lines from the Dockerfile.
Drag-and-drop in the Scan tab always works as a fallback: scan on a laptop, or feed it exported PDFs.
| Variable | Purpose | Default |
|---|---|---|
ANTHROPIC_API_KEY |
Claude API key. Required for recognition. | (none) |
ANTHROPIC_MODEL |
Model for recognition and Refine suggestions | claude-opus-4-8 |
RECOGNIZE_THINKING |
adaptive (better on faded scans) or off (cheaper) |
adaptive |
IMAGE_MAX_EDGE |
Downscale long edge (px) before sending to Claude | 1600 |
MEALIE_URL |
Mealie base URL, no trailing slash | (none) |
MEALIE_TOKEN |
Mealie long-lived API token | (none) |
PEXELS_API_KEY |
Enables real-photo search in Images. Blank = hidden. | (none) |
OPENAI_API_KEY |
Enables image generation in Images. Blank = hidden. | (none) |
OPENAI_IMAGE_MODEL |
Generation model | gpt-image-1 |
SCAN_AGENT_URL |
Keyless scan agent, e.g. http://192.168.1.30:9927. When set, the SCANNER_* vars below are ignored by the app. |
(none) |
SCANNER_HOST |
Network scanner IP. Blank = no direct scanning. | (none) |
SCANNER_BACKEND |
brother (brscan5) or airscan (eSCL/WSD) |
brother |
SCANNER_DEVICE |
SANE device string; blank = auto-detect | (none) |
SCANNER_SOURCE |
ADF source name, from scanimage -d <dev> -A |
Automatic Document Feeder(center aligned,Duplex) |
SCANNER_RESOLUTION / SCANNER_MODE |
Scan DPI / color mode | 300 / 24bit Color[Fast] |
APP_PORT |
Port the app listens on | 9926 |
Things that were less obvious than expected, in case you're building something similar.
Cost. Recognition is one vision call per recipe. In practice, about 75 recipes cost
roughly $10 at the defaults (Opus, adaptive thinking, 1600px long edge), so call it
$0.13 a recipe. IMAGE_MAX_EDGE and RECOGNIZE_THINKING=off both bring that down.
Recognition isn't interactive, so the Anthropic Batch API would roughly halve it again.
Obvious next step, not done yet.
Plain JSON, not structured outputs. Grammar compilation behind messages.parse
times out on this recipe schema's nested arrays. Opus emits clean JSON from a plain
prompt reliably, so recognition asks for JSON, parses tolerantly (fences, prose around
the object) and validates into a Pydantic model.
Never fabricate. The recognition prompt is explicit that blank fields stay blank. A model that helpfully invents a cook time is worse than useless when the whole point is faithful transcription of what's on the page.
Ingredients import verbatim. On import they go in as note lines with
disableAmount, exactly as printed. Splitting 1 cup flour, sifted into quantity /
unit / food is a job Mealie's own parser already does well, so Refine calls
/api/parser/ingredients rather than reimplementing it. Ingredient section headers
(For the sauce) map to Mealie's per-ingredient title, which renders as a heading.
Two things break that parser, both fixable upstream of it. Mealie's display
renderer emits Unicode fraction glyphs it can't itself re-parse, so those are folded
back to ASCII first. And parenthetical metric conversions (1 cup (240 ml) flour)
confuse it, so they're stripped, but only when the amount is in a metric unit, so
(2 cloves) and (1 cup) survive.
Reuse the parser's ids. It resolves against Mealie's food/unit database and returns the matched object with its id. Carrying that through on save means existing foods are reused instead of re-created, which is what otherwise 400s on a duplicate name.
Categories describe the dish, not the meal. Claude is told to avoid Dinner /
Dessert and use protein + cuisine + dish type (Chicken, Cajun, Stew). Course is
what tags are for, and the facets stay useful as a library grows.
Mealie's API drifts. Endpoint and field names are stable across recent v1 but not
guaranteed. performTime is cook time, for instance. If a publish fails, check your
instance's OpenAPI at /docs. Categories and tags are sent by name and the publish
retries without them on a 422, so an import never fails over an organizer.
backend/app/
main.py FastAPI routes (scan, ingest, group, recognize, publish, refine, images)
scanner.py drive a scanner over SANE/scanimage, or proxy to the scan agent
ingest.py PDF/image -> per-page images (pypdfium2 + Pillow)
recognize.py Claude vision -> structured Recipe
suggest.py Claude -> description/categories/tags/tools for an existing recipe
images.py Pexels search + gpt-image-1 generation
jobs.py background recognition worker
mealie.py Mealie API client (publish, parse, refine, set image)
models.py Recipe schema, shaped to map onto Mealie
db.py SQLite storage
static/ no-build vanilla-JS frontend (the four tabs)
backend/entrypoint.sh registers the scanner with the SANE backend, launches uvicorn
scanagent/ the keyless USB scan agent (its own image)
MIT. See LICENSE.