Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(api): expose the models directory path

joshistoast00daa0a7a8e1
diff --git a/invokeai/app/api/routers/model_manager.py b/invokeai/app/api/routers/model_manager.py
index bdd2e40644..24acb154b5 100644
--- a/invokeai/app/api/routers/model_manager.py
+++ b/invokeai/app/api/routers/model_manager.py
@@ -218,6 +218,20 @@ async def list_missing_models() -> ModelsList:
return ModelsList(models=missing_models)
+@model_manager_router.get(
+ "/models_dir",
+ operation_id="get_models_dir",
+ responses={200: {"description": "The absolute path of the models directory"}},
+)
+async def get_models_dir() -> str:
+ """Get the absolute path of the directory managed models are stored in.
+
+ Model config `path` values are relative to this directory unless they are
+ absolute (in-place installs from outside it).
+ """
+ return ApiDependencies.invoker.services.configuration.models_path.resolve().as_posix()
+
+
@model_manager_router.get(
"/get_by_attrs",
operation_id="get_model_records_by_attrs",