AI
AI-powered endpoints for the Smart Recipe Book
These are authenticated endpoints. You can visit authentication to register an account.
These endpoints provide AI-powered recipe features. They are mock/algorithmic — no real LLM is used. Students POST to them and receive structured responses.
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /recipe-book/ai/substitutions | Get ingredient substitution suggestions |
| POST | /recipe-book/ai/scale | Scale recipe ingredients |
| POST | /recipe-book/ai/generate | Generate a recipe from a text prompt |
Get ingredient substitutions
Get substitution suggestions for an ingredient. The API has a built-in map of common ingredients. For unknown ingredients, generic suggestions are returned.
Supported ingredients with curated substitutions: butter, egg, milk, flour, sugar, sour cream, cream, heavy cream, soy sauce, bread crumbs, garlic, onion, vegetable oil, baking powder, cornstarch.
Scale recipe ingredients
Scale recipe ingredients by a target serving size. This uses real math — each ingredient quantity is multiplied by the scale factor (targetServings / originalServings). The response includes cooking tips based on the scale factor.
Generate recipe
Generate a mock recipe from a text prompt. The generated recipe incorporates the user's prompt in the title and description but uses template data for ingredients and instructions.
The generated recipe is not saved automatically. To save it, POST the generated data to POST /recipe-book/recipes.