Description
The Recipe Generator API is a powerful tool that leverages the capabilities of AI to provide customized recipes based on the ingredients you have at hand. It even accommodates specific dietary preferences such as keto, vegan, or gluten-free, among others.
Endpoint
POST /recipe
Request Body
The request body should be a JSON object with the following keys:
ingredients (required): A string containing a list of the ingredients you have.
diet (optional): A string specifying your dietary preference (e.g., “KETO”, “VEGAN”, “GLUTEN_FREE”, etc.).
strict (optional): An integer (0-3) specifying how strictly the API should adhere to the provided ingredients list.
The response will be a JSON object with a recipe key that contains the AI-generated recipe instructions.
Usage
const body = {
ingredients: "chicken, broccoli, cheddar cheese",
diet: "KETO",
strict: 1
};
Error Handling
In case of an error (e.g., strict value out of range, server error), the API will return a JSON object with an error key containing a string description of the error.