create_recipe
Create a new recipe or update an existing one by specifying ingredients and gram amounts; Cronometer calculates the nutrition totals for you.
Instructions
Create a recipe from ingredients, or update one by passing recipe_id.
Cronometer sums the nutrients from the ingredients itself, so unlike add_custom_food you give foods and amounts, not nutrient values. Use search_foods to find each ingredient's food_id and measure_id first.
Cronometer locks a recipe's serving type when it is created and it cannot be changed afterwards, so choose deliberately:
"weight" (default) measures the recipe in grams. Portions log as plain grams in every client, including the mobile app's own entry screen. The ingredient list is recorded in the notes rather than as editable ingredients, because Cronometer will not compute a correct weight from ingredients that use non-weight measures.
"servings" keeps an editable ingredient list in Cronometer, but the mobile app then offers only a 1 g serving and hides the amount field. Logging through this server is still correct in grams.
cooked_grams is the weight of the finished dish. Give it whenever the food was baked or simmered: nutrients are stored per 100 g, and a dish that lost water is denser than its raw ingredients, so without it a portion weighed off the plate logs too little.
Updating with recipe_id replaces the whole ingredient list, so pass every ingredient, not only new ones. Recipes are removed with retire_custom_food, the same as custom foods.
Args: name: Recipe name. ingredients: List of {"food_id": int, "grams": float, "measure_id": int (optional)}. servings: How many portions the batch makes. notes: Free-text note stored on the recipe. recipe_id: Existing recipe to update in place. serving_type: "weight" or "servings". Cannot be changed later. cooked_grams: Weight of the finished dish, if it lost water in cooking.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| notes | No | ||
| servings | No | ||
| recipe_id | No | ||
| ingredients | Yes | ||
| cooked_grams | No | ||
| serving_type | No | weight |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |