A FastAPI project that helps users create recipes from their available ingredients, reducing food waste and inspiring creative cooking.
Econome solves a problem I often face myself; not knowing what to cook with leftover ingredients. Using Mistral's SDK it generates recipes from both text descriptions and images of ingredients (e.g the inside of a fridge).
- Recipe generation from text input
- Recipe generation from images (using Mistral's Vision API)
- Recipe storage and management (CRUD operations)
- Optional recipe illustrations using FAL.ai
- Python 3.13
- FastAPI
- Mistral SDK
- MongoDB (to enable faster prototyping)
- Modern UV package manager
- Extensive logging and exception handling
- Docker
- Mistral API key
- FAL.ai API key (optional, for flux recipe illustrations)
- Create a
.env
file in the project root:
MISTRAL_KEY=<your-mistral-key>
FAL_KEY=<your-fal-key> # Optional
- Start the application from the top level:
> docker compose up
The server will be available at 0.0.0.0:8000
Generates a recipe and optional illustration from a list of ingredients.
[
{
"name": "sirloin steak",
"quantity": "500g"
},
{
"name": "bell peppers",
"quantity": "2"
},
{
"name": "soy sauce",
"quantity": "500ml"
},
{
"name": "oyster sauce",
"quantity": "500ml"
},
{
"name": "sesame oil",
"quantity": "500ml"
}
]
{
"meal": "Soy-Sesame Beef Stir-Fry",
"steps": [
{
"content": "Cut the 500g of sirloin steak into thin strips, ensuring you're cutting against the grain for tenderness."
},
{
"content": "Slice the 2 bell peppers into thin strips as well, then set them aside."
},
{
"content": "In a bowl, mix together 250ml of soy sauce and 250ml of oyster sauce. This will be your sauce base."
},
{
"content": "Heat a large pan or wok over medium-high heat and add 1 tablespoon of the 500ml of sesame oil."
},
{
"content": "Once the oil is hot, add the beef strips and cook until browned and cooked through. Remove the beef from the pan and set it aside."
},
{
"content": "In the same pan, add another tablespoon of sesame oil. Add the sliced bell peppers and cook until they begin to soften."
},
{
"content": "Pour the soy and oyster sauce mixture into the pan with the peppers. Stir well to combine."
},
{
"content": "Return the cooked beef to the pan and stir to coat everything evenly in the sauce."
},
{
"content": "Cook for an additional 2-3 minutes to allow the flavors to meld together."
},
{
"content": "Drizzle a small amount of sesame oil over the top before serving for added flavor."
},
{
"content": "Serve hot with steamed rice or noodles."
}
],
"image_url": "https://fal.media/files/panda/T4KFDFAcIle1MAcGh6GHY_f5a4d26c3ca44e81b135171a389d48be.jpg"
}
-
Generate Recipe from Image [POST /api/recipes/vision]
Generate a recipe from an image of ingredients -
Save Recipe [POST /api/recipes/save]
Store a recipe in the database -
Delete Recipe [DELETE /api/recipes]
Remove a recipe from storage -
Get Recipe [GET /api/recipes/{id}]
Retrieve a specific recipe by ID -
List Recipes [GET /api/recipes/]
Retrieve all saved recipes
For the best testing experience, you can access the interactive API documentation at:
- Swagger UI Documentation - Interactive API testing interface
- ReDoc Documentation - Alternative documentation viewer
To test the API:
- Start the server using
docker compose up
- Navigate to
http://localhost:8000/docs
- Click on any endpoint to expand it
- Click "Try it out" and input your test data
- Execute the request and view the results