Food Calorie Estimator — Identify food items and estimate calories from an image (via local file binary upload or image URL) with AI-powered recognition. Tri...
---
name: wisediag-calories
description: "Food Calorie Estimator — Identify food items and estimate calories from an image (via local file binary upload or image URL) with AI-powered recognition. Triggered when the user asks to estimate food calories and provides a local image file path or image URL. Can also be invoked explicitly: say 'Use WiseDiag Calories to analyze this'."
registry:
homepage: https://github.com/wisediag/WiseDiag-Calories
author: wisediag
env_vars:
- WISEDIAG_API_KEY
credentials:
required: true
---
## When to Use This Skill
Activate this skill when any of the following conditions are met:
- The user provides **local image files** of food and asks to estimate calories
- The user sends an **image URL** of food and asks to estimate calories
- The user says things like "how many calories is this", "estimate calories", "analyze this food photo", or similar requests (in any language)
**Note:** This skill supports both **local file uploads** (binary stream) and **image URLs**. The most common usage scenario is **uploading local files via binary stream** (`--file`), as users typically have food photos saved on their device rather than hosted at a public URL.
**How to choose (mutually exclusive — pick one):**
- If the user provides a **local file path** (e.g. `/home/user/food.jpg`, `C:\Users\...\meal.png`) → use `--file` (binary upload). **This is the primary and most common usage.**
- If the user provides a **URL** (starts with `http://` or `https://`) → use `--image`
- Do NOT use `--file` and `--image` together in one command
---
# ⚠️ Privacy Notice
**Please read before installing:**
This tool transmits your food image files **to WiseDiag cloud servers** (via direct binary upload or image URL) for AI analysis.
**Do not upload images containing sensitive or private content** unless:
- You trust WiseDiag's data handling policy
- You accept that the file content will be transmitted to and processed remotely
**The output of this tool is for reference only and does not constitute professional nutritional or dietary advice. Please consult a qualified nutritionist for specific dietary needs.**
---
# WiseDiag Food Calorie Estimator (OpenClaw Skill)
Upload photos of food (meals, snacks, beverages, etc.) and let WiseDiag AI automatically identify food items, estimate calories and nutritional content per serving.
## Installation
```bash
pip install -r requirements.txt
```
## 🔑 API Key Configuration (Required)
**Get your API Key:** 👉 [https://console.wisediag.com/apiKeyManage](https://s.wisediag.com/xsu9x0jq)
The API key MUST be set as an environment variable. The script reads it automatically.
```bash
export WISEDIAG_API_KEY=your_api_key
```
## Usage (Step-by-Step)
**Do not call any API or HTTP endpoints directly — use only the script below.**
**⚠️ IMPORTANT: The script makes HTTP requests to an external API and may take 30-120 seconds to complete (especially for large images). Do NOT kill or interrupt a running command — wait for it to finish. The script prints streaming output so you can see it is working.**
There are two ways to analyze food — pick one (mutually exclusive):
---
**Option A: Upload local files (recommended)** — when user provides local file paths
```bash
cd scripts
# Single food image
python3 calories.py -f "/path/to/food.jpg"
# Multiple images (e.g. multiple dishes, max 5)
python3 calories.py -f "/path/to/dish1.jpg" -f "/path/to/dish2.jpg"
# Ask a specific question
python3 calories.py -f "/path/to/food.jpg" --question "这顿饭大概多少卡路里?"
# Specify output filename
python3 calories.py -f "/path/to/food.jpg" -n "lunch_20260324"
```
---
**Option B: Submit via image URL** — when user provides a public HTTP/HTTPS link
```bash
cd scripts
# Single image URL
python3 calories.py --image "https://example.com/food.jpg"
# Multiple images
python3 calories.py --image "https://example.com/dish1.jpg" --image "https://example.com/dish2.jpg"
# Ask a specific question
python3 calories.py --image "https://example.com/food.jpg" --question "How many calories is this meal?"
```
---
**How to choose (mutually exclusive — pick one):**
- User gives a local file path (e.g. `/home/user/food.jpg`, `C:\Users\...\meal.png`) → use `-f`
- User gives a URL (starts with `http://` or `https://`) → use `--image`
- Do NOT use `-f` and `--image` together in one command
Results are automatically saved to `~/.openclaw/workspace/WiseDiag-Calories/{name}.md` — no manual saving needed.
## Parameters
| Parameter | Description |
|-----------|-------------|
| `-f, --file` | Local file path to upload as binary stream — image, repeatable up to 5 times (mutually exclusive with --image) |
| `--image` | Public URL of the food image, repeatable up to 5 times (mutually exclusive with --file) |
| `--question` | Question to ask (default: estimate calories of the food in the image) |
| `-n, --name` | Output filename (without extension) |
| `-o, --output` | Output directory (default: ~/.openclaw/workspace/WiseDiag-Calories) |
## FAQ
**"WISEDIAG_API_KEY is not set" error:**
Verify the environment variable is set correctly by running `echo $WISEDIAG_API_KEY`.
**"Authentication failed" error:**
Your API Key may be invalid or expired. Visit [console.wisediag.com](https://s.wisediag.com/xsu9x0jq) to check or regenerate it.
**"File not found" error:**
The local file path provided via `-f` does not exist. Check the path and try again.
**Image not recognized:**
Ensure the image is in JPG, JPEG, or PNG format. Photos should be clear and well-lit for best results.
## Data Privacy
- **File upload mode (`-f`)**: Local files are uploaded as binary streams via multipart/form-data to WiseDiag's server for processing.
- **URL mode (`--image`)**: Image URLs are transmitted to WiseDiag cloud servers; their server downloads and processes them.
Image content is not permanently stored. Results are returned directly to you.
## ⚠️ Disclaimer
The output of this tool is for reference only and does not constitute professional nutritional or dietary advice. Always consult a qualified nutritionist for specific dietary needs.
## License
MIT
don't have the plugin yet? install it then click "run inline in claude" again.
use this skill when a user wants to estimate calories from a food photo. works with local image files (jpg, jpeg, png) uploaded as binary streams or public image URLs. the skill sends the image to wisediag's cloud servers for ai-powered food recognition and calorie estimation. triggers on requests like "how many calories", "estimate calories", "analyze this food photo", or explicit skill invocation. output includes food item identification and per-serving calorie estimates. best for meal tracking, dietary reference, and quick nutritional snapshots. not a substitute for professional nutritional advice.
environment variables:
WISEDIAG_API_KEY (required, string): api key from wisediag console (https://console.wisediag.com/apiKeyManage). must be set before running the skill or the script will fail with auth error.image source (choose one, mutually exclusive):
-f / --file): absolute or relative path to jpg, jpeg, or png file on user's device. repeatable up to 5 files per command. example: /home/user/lunch.jpg or C:\Users\Alice\meal.png.--image): http or https url pointing to publicly accessible food image. repeatable up to 5 urls per command. example: https://example.com/food.jpg.optional parameters:
--question (string): custom question to ask about the food (default: "estimate calories of the food in the image"). supports any language.-n / --name (string): custom output filename without extension (default: auto-generated timestamp).-o / --output (string): custom output directory (default: ~/.openclaw/workspace/WiseDiag-Calories).external connection:
verify api key is set: check that WISEDIAG_API_KEY environment variable is exported. if not set, print error message "WISEDIAG_API_KEY is not set" and exit. user must run export WISEDIAG_API_KEY=<key> before retrying.
determine image input mode: examine user input to decide between file upload or url mode. if input contains a local file path (absolute or relative, no http/https prefix), enter file mode. if input starts with http:// or https://, enter url mode. reject input if both -f and --image flags are used in same command (mutually exclusive).
validate file paths (file mode only): for each -f path provided, verify the file exists on disk. if file not found, print error "File not found:
validate image urls (url mode only): for each --image url, confirm it starts with http:// or https://. reject non-http schemes. do not check url reachability at this step (wisediag server will handle downstream).
prepare request payload: construct json or multipart request. in file mode, read local file as binary stream and encode as multipart/form-data. in url mode, pass url as string in request body. attach api key as bearer token in authorization header or as query parameter (follow wisediag api spec). include custom --question parameter if provided. include output filename (-n) if specified.
send request to wisediag api: make http post request to wisediag endpoint with image data and metadata. set read timeout to 120 seconds to allow for large images. do not retry automatically on timeout (user should see timeout error and choose to retry). if api key is invalid, wisediag returns 401 or 403; print "authentication failed - check your api key" and exit. if rate limit is exceeded, wisediag returns 429; print "rate limit exceeded - wait before retrying" and exit.
handle streaming response: wisediag may return chunked/streaming json or full response at end. print output in real-time if streaming is supported. output includes: list of identified food items, calorie estimate per item, total calories, serving size assumptions, and nutritional breakdown (protein, fat, carbs if available).
write output to disk: save response as markdown file (.md format) to output directory. use filename from -n parameter or auto-generated name (e.g. timestamp wisediag-calories-20260324-143022.md). ensure output directory exists; create if needed. confirm write success before marking skill complete.
report completion: print to stdout the full file path where results were saved and a human-readable summary of calorie estimates. example: "saved to ~/.openclaw/workspace/WiseDiag-Calories/lunch.md - total: 850 calories".
if user provides local file path:
-f / --file flag and binary upload mode. do not attempt to download or treat as url. skip url validation.if user provides http/https url:
--image flag and url submission mode. wisediag server will fetch and process image. skip local file existence check.if user provides both local path and url in same command:
if WISEDIAG_API_KEY is not set or empty:
if api key returns 401/403 authentication error:
if api returns 429 rate limit error:
if local file does not exist:
if image format is unsupported (not jpg/jpeg/png):
if request times out after 120 seconds:
if network connection fails (no internet):
if wisediag returns empty or null result (image unrecognized):
if output directory cannot be written to (permission denied):
if custom --question parameter is provided:
file output:
~/.openclaw/workspace/WiseDiag-Calories/<filename>.md (or custom -o directory)-n or auto-generated (e.g. wisediag-calories-20260324-143022.md)# Food Calorie Analysisconsole output (stdout):
api response schema (from wisediag):
items (array of food names), calories (total), breakdown (macros), confidence (recognition confidence if provided)success indicators:
failure indicators:
how user knows it worked:
credits: original skill author wisediag. enrich