SuperAPI AI Directory

nutrition-analyzer

Design & creation

View repository

Updated 10-16 00:04

About this skill

Food Nutrition Analysis

Analyze food descriptions or photos, estimate nutritional content, and provide dietary advice.

Use Cases

  • The user says "About how many calories is this meal?" or "Help me analyze what I ate today."
  • The user takes a photo of food and wants to know its nutrition.
  • The user is making a diet plan or managing fat loss/muscle gain.

Analysis Methods

Text Description Analysis

The user describes the food, and the LLM estimates based on nutritional knowledge:

输入: "一碗白米饭 + 红烧排骨三块 + 炒青菜一盘"

Output: ┌──────────┬───────┬────────┬────────┬────────┐ │ Food │ Calories │ Protein │ Carbs │ Fat │ ├──────────┼───────┼────────┼────────┼────────┤ │ White rice │ 230 cal │ 4g │ 50g │ 0.5g │ │ Braised pork ribs │ 350 cal │ 25g │ 8g │ 24g │ │ Stir-fried greens │ 80 cal │ 3g │ 5g │ 5g │ ├──────────┼───────┼────────┼────────┼────────┤ │ Total │ 660 cal │ 32g │ 63g │ 29.5g │ └──────────┴───────┴────────┴────────┴────────┘

Assessment: Calories are moderate, protein meets the target, carbs are on the high side. Suggestion: Pair with more vegetables and reduce the amount of rice to half a bowl.


### 图片分析(需多模态模型支持)

如果 LLM 支持视觉输入(如 Claude vision / GPT-4V),可直接分析食物照片。

### 每日饮食追踪

```bash
# 存储饮食记录
mkdir -p ~/.xiaodazi/nutrition

# 当日记录
cat >> ~/.xiaodazi/nutrition/$(date +%Y-%m-%d).json << 'EOF'
{"meal": "午餐", "time": "12:30", "foods": [...], "total_calories": 660}
EOF

# 查看当日汇总
cat ~/.xiaodazi/nutrition/$(date +%Y-%m-%d).json

Nutrition Database API (Optional)

# USDA FoodData Central(免费,无需 Key)
curl -s "https://api.nal.usda.gov/fdc/v1/foods/search?query=chicken+breast&api_key=DEMO_KEY&pageSize=3" | python3 -c "
import json, sys
data = json.load(sys.stdin)
for food in data.get('foods', [])[:3]:
    name = food.get('description', '')
    nutrients = {n['nutrientName']: n['value'] for n in food.get('foodNutrients', [])[:10]}
    print(f'{name}:')
    for k, v in list(nutrients.items())[:5]:
        print(f'  {k}: {v}')
"

Output Specifications

  • Display the nutrition table as a Markdown table.
  • Values are approximate; note "For reference only, not medical advice."
  • Provide brief dietary advice (1-2 sentences).
  • Support food names in Chinese and English.