设计与多媒体

mealie-recipe-import

试用

Import recipes into a self-hosted Mealie instance from a photo, text, or URL, with AI ingredient parsing and cover image upload.

它能做什么

Add a recipe to a self-hosted Mealie instance (v1 API, app v3.x) from a photo, plain text, or a URL. Handles AI ingredient parsing, food/unit dedup + creation, recipe metadata, and cover-image upload. Verified against Mealie v3.21.0.

技能文档

Mealie Recipe Import

Add a recipe to a self-hosted Mealie instance (v1 API, app v3.x) from a photo, plain text, or a URL. Handles AI ingredient parsing, food/unit dedup + creation, recipe metadata, and cover-image upload. Verified against Mealie v3.21.0.

Requirements

  • A running self-hosted Mealie instance (v1 API / app v3.x; verified on v3.21.0) reachable over the network.
  • A Mealie API token (see Setup).
  • Python 3 (standard library only) for the bundled script — no pip install needed.
  • For photo import: an agent with a vision/image capability to transcribe the recipe. Plain-text and URL import work without vision.
  • Optional but recommended: an AI ingredient parser configured in Mealie admin (OpenAI or Gemini) for best ingredient structuring; otherwise the built-in nlp/brute parser is used.

Setup

Two env vars (never hardcode instance/token):

  • MEALIE_URL — base URL, e.g. http://mealie.example.lan:9925
  • MEALIE_API_KEY — long-lived Mealie API token

Get a token: Mealie UI -> user profile -> "Manage Your API Tokens" -> create; or POST /api/users/api-tokens {"name":"agent"}. Store it in your agent's .env, never in the skill.

Verify access:

curl -s -H "Authorization: Bearer $MEALIE_API_KEY" "$MEALIE_URL/api/users/self"   # 200 + user json
curl -s "$MEALIE_URL/api/app/about"                                                # version

Workflow

  1. Extract. Photo -> use your vision/image tool to transcribe: title, servings, times, ingredient lines (one per line, keep quantity + unit + note), and steps. Text -> use as-is. URL -> POST /api/recipes/create/url {"url":..,"includeTags":false} returns the slug (URL import parses ingredients weakly, so still run the parser in step 3).
  2. Create record (photo/text): POST /api/recipes {"name":""} returns the slug as a bare quoted JSON string.
  3. Parse ingredients: POST /api/parser/ingredients {"parser":"openai","ingredients":[...]}. Each result item has .ingredient = {quantity, unit|null, food|null, note, originalText, referenceId} plus .confidence.average. The AI parser auto-resolves existing foods/units to their DB ids.
  4. Dedup + create foods/units. GET /api/foods?perPage=2000 and GET /api/units?perPage=2000. For any parsed food/unit that has no id: match by lowercased/trimmed name; if still missing POST /api/foods {"name":..} / POST /api/units {"name":..} and use the returned object. Prevents duplicate foods.
  5. Build + PUT recipe. GET /api/recipes/{slug} for the full object, then set recipeIngredient (array), recipeInstructions ([{title:"",text,ingredientReferences:[]}]), recipeServings (number), recipeYield (string), totalTime/prepTime (strings), then PUT /api/recipes/{slug} with the modified object.
  6. Cover image: PUT /api/recipes/{slug}/image as multipart form image=@;type=image/jpeg + extension=jpg -> {"image":""}. If you have both a cookbook-page scan and a finished-dish photo, use the finished dish as the cover.
  7. Verify (VBR): GET /api/recipes/{slug} (check name, servings, ingredient/instruction counts, image id) and GET /api/media/recipes/{recipe_id}/images/original.webp -> expect HTTP 200.

The bundled scripts/mealie_import.py performs steps 2 + 4-7 (and step 3 if you pass raw ingredient lines) from a JSON job file.

recipeIngredient entry shape

{
  "quantity": 250.0,
  "unit": { "id": "...", "name": "Gramm" },
  "food": { "id": "...", "name": "Tortellini" },
  "note": "dry",
  "isFood": true,
  "disableAmount": false,
  "originalText": "250 g dry tortellini",
  "referenceId": ""
}

Gotchas

  • parser:"openai" selects whichever AI provider is configured in Mealie admin (OpenAI or Gemini). If no AI parser is configured, fall back to "parser":"nlp" or "brute", or keep lines as plain notes (food/unit null, disableAmount:true).
  • The parser can return a transient HTTP 500 -> retry once.
  • Set disableAmount:true when an ingredient has no quantity and no unit (e.g. Salt, Pepper) so it renders as just the name.
  • POST /api/recipes returns the slug as a bare quoted JSON string, not an object.
  • URL import (/api/recipes/create/url) stores ingredients as weakly-parsed raw text -> re-run the parser and PUT.
  • Every write needs the Bearer token; keep it in env only.

Usage example (photo -> Mealie)

export MEALIE_URL=http://mealie.example.lan:9925
export MEALIE_API_KEY=****

# After transcribing the photo, write a job file:
cat > job.json <<'JSON'
{
  "title": "Party Tortellini Salad",
  "servings": 4,
  "yield": "4 servings",
  "total_time": "40 min",
  "instructions": [
    "Cook tortellini per package. Dice peppers, wedge tomatoes, strip the ham. Drain and cool.",
    "Whisk yogurt with sour cream, balsamic and chives. Season, fold everything in, rest 10 min, serve."
  ],
  "ingredient_lines": [
    "250 g dry tortellini", "Salt", "1 yellow bell pepper", "1 green bell pepper",
    "4 tomatoes", "6 slices cooked ham", "250 g low-fat yogurt", "2 tbsp sour cream",
    "1 tbsp balsamic vinegar", "3 tbsp chives", "Pepper"
  ],
  "parser": "openai",
  "image_path": "/path/to/finished-dish.jpg"
}
JSON

python3 scripts/mealie_import.py job.json

相关技能

以 AI 机器人身份加入视频会议,提供语音、虚拟形象与屏幕共享四种模式。

作者 johnpatternai21 次安装8 星标

在本地磁盘以分类纯 Markdown 文件保存需要长期留存的事实,与智能体内置记忆并存。

作者 Iván555 次安装18 星标

把自然语言描述转为结构化 JSON,并由 mcp-diagram-generator MCP 服务生成 Draw.io、Mermaid 或 Excalidraw 图表文件。

作者 nssa.io1.0k 次安装47 星标

诊断生产力系统反复失效的根因,给出最小干预——容量测算、瓶颈定位、可靠的本地记录。

作者 Iván854 次安装69 星标

从 AdMapix API 拉取广告创意、应用、榜单和收入预估等数据,原样返回结构化 JSON。

作者 fly0pants4.3k 次安装296 星标

maikimolto 的更多技能

浏览全部技能

管理 Bring! 购物清单——添加、勾选、移除商品,并设置默认列表方便日常使用。

作者 maikimolto42 次安装2 星标

Automate browser tasks locally with headless Chrome or via Browserbase cloud for stealth, CAPTCHA-solving, and protected sites access.

作者 maikimolto18 次安装

Create and manage Proxmox Backup Server (PBS) backups for VMs and LXC containers. Guided first-time setup including PBS installation, NAS storage, Proxmox ho...

作者 maikimolto16 次安装

Manage one or many Proxmox VE servers via REST API. Multi-host support with cluster-wide overview commands. List nodes, VMs, containers; control power states...

作者 maikimolto17 次安装