Food intelligence
Use FoodAPI for decisions — not only storage. Pick the right reasoning goal for the job.
What you can build
Ingredient parsers, “can I cook this?” checkers, dietary transformers, and recommendation surfaces backed by the same deterministic reasoner.
Choose the right capability
- Normalize — raw text → canonical ingredient id (not a reasoning goal).
- FEASIBILITY — can this pantry cook this recipe?
- ANALYSIS — structured insights + dietary violations.
- TRANSFORM — substitution / diet plan (proposal).
- RECOMMENDATION — rank alternative recipes.
Full field reference: Reasoning. This guide shows how the pieces fit together.
1. Normalize ingredient text
n = client.ingredients.normalize("2 tbsp olive oil")
print(n.canonical_name, n.quantity, n.unit, n.ingredient_id, n.confidence){
"canonical_name": "olive oil",
"quantity": 2.0,
"unit": "tbsp",
"confidence": 0.97,
"match_strategy": "alias",
"ingredient_id": "…"
}2. Feasibility with pantry
Pass pantry item ids into reason with goal FEASIBILITY. Full workflow: Pantry & kitchen.
result = client.reason(
recipe_id=recipe_id,
goal="FEASIBILITY",
pantry_item_ids=pantry_item_ids,
)
print(result.feasibility_score, result.missing_ingredients)3. Analyze, transform, recommend
The same reason endpoint switches behavior via goal. Transforms and recommendations return structured plans — not opaque scores alone.
analysis = client.reason(
recipe_id=recipe_id,
goal="ANALYSIS",
dietary_preferences=["VEGETARIAN"],
)
print(analysis.dietary_violations)
result = client.reason(
recipe_id=recipe_id,
goal="TRANSFORM",
dietary_preferences=["VEGETARIAN"],
)
for step in result.transformation_plan:
print(step.from_name, "→", step.to_name, step.reason)
recs = client.reason(
recipe_id=recipe_id,
goal="RECOMMENDATION",
dietary_preferences=["VEGETARIAN"],
)
print([a.title for a in recs.alternative_recipes[:3]])Next
What are you building?