### Setup Initial Administrator Account Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx POST /api/v1/auth/setup request and response examples for creating the initial administrator account. The request includes user credentials, and the response confirms success and provides user details. ```json { "email": "admin@example.com", "display_name": "Administrator", "password": "SecureAdminPass123" } { "success": true, "user": { "user_id": "abc123", "email": "admin@example.com", "display_name": "Administrator", "is_admin": true, "is_active": true } } ``` -------------------------------- ### Check Initial Admin Setup Status Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx GET /api/v1/auth/status endpoint response examples. Shows the structure for indicating if initial administrator setup is required and the multi-user mode status. ```json { "setup_required": true, "multiuser_enabled": true, "strict_password_checking": true, "admin_email": "admin@example.com" } { "setup_required": false, "multiuser_enabled": true, "strict_password_checking": true, "admin_email": null } ``` -------------------------------- ### Install Model via Heuristic Import Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Use the `ModelInstallService` to install models, for example, by providing a URL for heuristic import. ```python job = mm.install.heuristic_import(`https://civitai.com/models/58390/detail-tweaker-lora-lora`) ``` -------------------------------- ### Build Installer Zip Source: https://github.com/invoke-ai/invokeai/wiki/Release-Checklist Build the frontend, package the InvokeAI distribution as a wheel, and then bundle the wheel into a .zip file with an installer script. ```bash make installer-zip ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Setup/dev-environment.mdx Navigate to the docs directory and install the necessary Node.js dependencies for the documentation site. ```shell cd docs pnpm install ``` -------------------------------- ### Installer Methods Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Methods for managing model installations and files. ```APIDOC ## unconditionally_delete(key) ### Description This method is similar to `unregister()`, but also unconditionally deletes the corresponding model weights file(s), regardless of whether they are inside or outside the InvokeAI models hierarchy. ### Method Not specified (assumed to be a Python method call) ### Endpoint N/A (Python method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python installer.unconditionally_delete(key='model_key') ``` ### Response None explicitly mentioned, likely void or status indicator. ``` ```APIDOC ## download_and_cache(remote_source, [access_token], [timeout]) ### Description This utility routine downloads a file from a remote source, caches it, and returns the path to the cached file. It does not determine the model type or register it. It can be used for any file type. The file is stored in `INVOKEAI_ROOT/models/.cache`. If the file exists in the cache, its path is returned without redownloading. ### Method Not specified (assumed to be a Python method call) ### Endpoint N/A (Python method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python path = installer.download_and_cache(remote_source='http://example.com/model.pth', access_token='your_token', timeout=300) ``` ### Response - **path** (string) - The path to the cached file. ``` ```APIDOC ## start(invoker) ### Description The `start` method is called during API initialization. It synchronizes the model record store database with the current state of the disk by calling `sync_to_config()`. ### Method Not specified (assumed to be a Python method call) ### Endpoint N/A (Python method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python installer.start(invoker=api_invoker) ``` ### Response None explicitly mentioned. ``` -------------------------------- ### Initial Admin Setup Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx Initial admin setup. This endpoint is unauthenticated. ```APIDOC ## POST /api/v1/auth/setup ### Description Initial admin setup. This endpoint is unauthenticated. ### Method POST ### Endpoint /api/v1/auth/setup ### Parameters None ### Request Body - **email** (string) - Required - Administrator's email. - **display_name** (string) - Required - Administrator's display name. - **password** (string) - Required - Administrator's password. ### Request Example ```json { "email": "admin@example.com", "display_name": "Administrator", "password": "SecureAdminPass123" } ``` ### Response #### Success Response - **success** (boolean) - Indicates if the setup was successful. - **user** (object) - Details of the created admin user. #### Response Example ```json { "success": true, "user": { "user_id": "abc123", "email": "admin@example.com", "display_name": "Administrator", "is_admin": true, "is_active": true } } ``` ``` -------------------------------- ### Customize InvokeAI Docker Environment Source: https://github.com/invoke-ai/invokeai/blob/main/docker/README.md Navigate to the `docker` directory, copy the sample environment file, and edit it to customize your InvokeAI Docker setup. Then, execute the `run.sh` script to build and start the container. ```bash cd docker cp .env.sample .env # edit .env to your liking if you need to; it is well commented. ./run.sh ``` -------------------------------- ### Example of Combinatorial Growth Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/concepts/dynamic-prompting.mdx Illustrates how quickly the number of prompt combinations can increase with multiple dynamic groups. It is recommended to start with a small 'Max Prompts' setting. ```text a {red|green|blue} balloon in {morning mist|golden hour|rain} ``` -------------------------------- ### Create Installation Directory (Linux/MacOS) Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/start-here/manual.mdx Creates and navigates to the InvokeAI installation directory on Linux and MacOS. ```bash mkdir ~/invokeai cd ~/invokeai ``` -------------------------------- ### Install Models from Various Sources Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Illustrates basic usage of `installer.install_model()` with different `ModelSource` types, including local files, local directories, HuggingFace repositories (with options for subfolders and variants), and URLs. It also shows how to wait for installations to complete and check their status. ```python from invokeai.app.services.model_install import ( LocalModelSource, HFModelSource, URLModelSource, ) source1 = LocalModelSource(path='/opt/models/sushi.safetensors') # a local safetensors file source2 = LocalModelSource(path='/opt/models/sushi_diffusers') # a local diffusers folder source3 = HFModelSource(repo_id='runwayml/stable-diffusion-v1-5') # a repo_id source4 = HFModelSource(repo_id='runwayml/stable-diffusion-v1-5', subfolder='vae') # a subfolder within a repo_id source5 = HFModelSource(repo_id='runwayml/stable-diffusion-v1-5', variant='fp16') # a named variant of a HF model source6 = HFModelSource(repo_id='runwayml/stable-diffusion-v1-5', subfolder='OrangeMix/OrangeMix1.ckpt') # path to an individual model file source7 = URLModelSource(url='https://civitai.com/api/download/models/63006') # model located at a URL source8 = URLModelSource(url='https://civitai.com/api/download/models/63006', access_token='letmein') # with an access token for source in [source1, source2, source3, source4, source5, source6, source7]: install_job = installer.install_model(source) source2job = installer.wait_for_installs(timeout=120) for source in sources: job = source2job[source] if job.complete: model_config = job.config_out model_key = model_config.key print(f"{source} installed as {model_key}") elif job.errored: print(f"{source}: {job.error_type}.\nStack trace: {job.error}") ``` -------------------------------- ### Install Model from Path Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Install a model from the specified path by copying it into the InvokeAI models directory and registering it. Overrides can be provided. ```python key = installer.install_path(model_path, config) ``` -------------------------------- ### Install Documentation Dependencies with Make Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Documentation/index.mdx Use this command to install all necessary dependencies for the documentation site when using the Makefile. ```shell make docs-install ``` -------------------------------- ### Installer Methods Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Core methods provided by the installer class for managing installation jobs. ```APIDOC ## Installer Methods ### `wait_for_installs([timeout])` Blocks until all pending installs complete or error. Returns a list of completed jobs. Optional `timeout` specifies maximum wait time. `timeout=0` (default) blocks indefinitely. ### `wait_for_job(job, [timeout])` Blocks until a specific job completes or errors. Returns the job. Optional `timeout` specifies maximum wait time. `timeout=0` (default) blocks indefinitely. ### `list_jobs()` Returns a list of all active and complete `ModelInstallJobs`. ### `get_job_by_source(source)` Returns a list of `ModelInstallJob` objects matching the provided model source. ### `get_job_by_id(id)` Returns a list of `ModelInstallJob` objects matching the provided model ID. ### `cancel_job(job)` Cancels the specified job. ### `prune_jobs` Removes jobs in a terminal state (complete, errored, cancelled) from the lists returned by `list_jobs()` and `get_job()`. ``` -------------------------------- ### InvokeAI Multi-User Configuration Example Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/admin-guide.mdx A complete example of the `invokeai.yaml` configuration file, demonstrating settings for multi-user mode, server host and port, and performance optimizations. ```yaml # invokeai.yaml - Multi-user configuration # Internal metadata - do not edit: schema_version: 4.0.2 # Put user settings here multiuser: true # Server host: "0.0.0.0" port: 9090 # Performance enable_partial_loading: true precision: float16 pytorch_cuda_alloc_conf: "backend:cudaMallocAsync" hashing_algorithm: blake3_multi ``` -------------------------------- ### Start Documentation Development Server Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Setup/dev-environment.mdx Start the local development server for the documentation site. This provides hot-reloading for changes made to the markdown files. ```shell pnpm run dev ``` -------------------------------- ### Install Model Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx Installs a model. Requires administrator privileges. ```APIDOC ## POST /api/v2/models/install ### Description Installs a model. Requires administrator privileges. ### Method POST ### Endpoint /api/v2/models/install ### Parameters None ### Request Body - **model_url** (string) - Required - The URL of the model to install. ### Request Example ```json { "model_url": "http://example.com/models/model.ckpt" } ``` ### Response #### Success Response - **message** (string) - A confirmation message. #### Response Example ```json { "message": "Model installation initiated." } ``` ``` -------------------------------- ### Installing Test Dependencies Source: https://github.com/invoke-ai/invokeai/blob/main/invokeai/backend/model_manager/README.md Install the necessary dependencies for running the test suite, including development and test packages. ```bash uv pip install -e ".[dev,test]" ``` -------------------------------- ### Create Installation Directory (Windows) Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/start-here/manual.mdx Creates and navigates to the InvokeAI installation directory on Windows. ```powershell mkdir $Home/invokeai cd $Home/invokeai ``` -------------------------------- ### Install Documentation Dependencies Manually Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Documentation/index.mdx Installs all required dependencies for the documentation site using pnpm within the 'docs' directory. ```shell pnpm install ``` -------------------------------- ### Model Installation API Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx The `import_model()` method is the core of the installer. It accepts various sources for models and returns a `ModelInstallJob` to track progress. ```APIDOC ## POST /api/v1/models/install ### Description Installs a model from a specified source. Supports local files, Hugging Face repositories, and URLs. ### Method POST ### Endpoint /api/v1/models/install ### Parameters #### Request Body - **source** (ModelSource) - Required - The source of the model (LocalModelSource, HFModelSource, URLModelSource). - **config** (Dict[str, Any]) - Optional - Override model attributes. ### Request Example ```json { "source": { "type": "HFModelSource", "repo_id": "runwayml/stable-diffusion-v1-5" } } ``` ### Response #### Success Response (200) - **job_id** (str) - The ID of the model installation job. - **status** (str) - The current status of the job. #### Response Example ```json { "job_id": "install-job-12345", "status": "pending" } ``` ``` -------------------------------- ### List All Model Installation Jobs Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Retrieve a list of all active and completed model installation jobs. ```python jobs = installer.list_jobs() ``` -------------------------------- ### Install InvokeAI with Torch Backend Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/start-here/manual.mdx Installs the InvokeAI package and specified version using uv pip, with a specified torch backend for GPU acceleration. Replace with the appropriate backend identifier (e.g., cu128, cpu, rocm6.3). ```sh uv pip install == --python 3.12 --python-preference only-managed --torch-backend= --force-reinstall ``` -------------------------------- ### Get Current User API Response Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx Example JSON response for the Get Current User endpoint, detailing user attributes. ```json { "user_id": "abc123", "email": "user@example.com", "display_name": "John Doe", "is_admin": false, "is_active": true, "created_at": "2024-01-15T10:00:00Z", "updated_at": "2024-01-15T10:00:00Z", "last_login_at": "2024-01-15T15:30:00Z" } ``` -------------------------------- ### Run Documentation Development Server with Make Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Documentation/index.mdx Starts the local development server for the documentation site using the Makefile. Access the site at http://localhost:4321. ```shell make docs-dev ``` -------------------------------- ### Install and Pull Git LFS Source: https://github.com/invoke-ai/invokeai/blob/main/tests/model_identification/README.md Commands to install Git Large File Storage (LFS) and pull down test model files. This is a one-time setup. ```bash git lfs install git lfs pull ``` -------------------------------- ### Get Job by Model ID Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Retrieve a list of model installation jobs corresponding to a specific model ID. ```python jobs = installer.get_job_by_id(id) ``` -------------------------------- ### Initialize ModelInstallService Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Demonstrates the pattern for creating a new ModelInstallService instance. Ensure all required services like configuration, record store, and download queue are initialized first. ```python from invokeai.app.services.config import get_config from invokeai.app.services.model_records import ModelRecordServiceSQL from invokeai.app.services.model_install import ModelInstallService from invokeai.app.services.download import DownloadQueueService from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase from invokeai.backend.util.logging import InvokeAILogger config = get_config() logger = InvokeAILogger.get_logger(config=config) db = SqliteDatabase(config.db_path, logger) record_store = ModelRecordServiceSQL(db, logger) queue = DownloadQueueService() queue.start() installer = ModelInstallService(app_config=config, record_store=record_store, download_queue=queue ) installer.start() ``` -------------------------------- ### Preview Documentation with Make Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Documentation/index.mdx Use this command from the repository root to preview the built documentation locally. ```sh make docs-preview ``` -------------------------------- ### Get Jobs by Model Source Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Retrieve a list of model installation jobs corresponding to a specific model source. ```python jobs = installer.get_job_by_source(source) ``` -------------------------------- ### Get One Board API Response Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx Example JSON response for retrieving a specific image board's details. ```json { "board_id": "8b31a33d-0acb-46fe-8612-83601481cf2c", "board_name": "Testing Board", "user_id": "3c59a0ba-f4c7-4275-b96f-82179e8aaff8", "created_at": "2026-03-09 16:10:47.095", "updated_at": "2026-03-09 16:10:55", "deleted_at": null, "cover_image_name": "08689e4b-f084-4c49-83a8-4fc1edb167c4.png", "archived": false, "board_visibility": "shared", "image_count": 55, "asset_count": 0, "owner_username": null } ``` -------------------------------- ### Copy Environment Sample (Windows) Source: https://github.com/invoke-ai/invokeai/blob/main/docker/README.md On Windows, use the `copy` command to create the `.env` file from the sample. ```cmd copy example.env .env ``` -------------------------------- ### Create Conda Environment for PyTorch Source: https://github.com/invoke-ai/invokeai/blob/main/invokeai/backend/image_util/normal_bae/nets/submodules/efficientnet_repo/README.md Sets up a Conda environment named 'torch-env' and installs PyTorch with CUDA support. This is the recommended environment setup for this project. ```bash conda create -n torch-env conda activate torch-env conda install -c pytorch pytorch torchvision cudatoolkit=10.2 ``` -------------------------------- ### ModelInstallService Initialization Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Demonstrates how to initialize a new ModelInstallService instance. ```APIDOC ## ModelInstallService Initialization ### Description This section shows how to manually initialize the `ModelInstallService` if you need to create a new installer instance, rather than using the default one provided at API startup. ### Initialization Pattern ```python from invokeai.app.services.config import get_config from invokeai.app.services.model_records import ModelRecordServiceSQL from invokeai.app.services.model_install import ModelInstallService from invokeai.app.services.download import DownloadQueueService from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase from invokeai.backend.util.logging import InvokeAILogger config = get_config() logger = InvokeAILogger.get_logger(config=config) db = SqliteDatabase(config.db_path, logger) record_store = ModelRecordServiceSQL(db, logger) queue = DownloadQueueService() queue.start() installer = ModelInstallService(app_config=config, record_store=record_store, download_queue=queue ) installer.start() ``` ### `ModelInstallService` Constructor Parameters | **Argument** | **Type** | **Description** | |------------------|------------------------------|------------------------------| | `app_config` | InvokeAIAppConfig | InvokeAI app configuration object | | `record_store` | ModelRecordServiceBase | Config record storage database | | `download_queue` | DownloadQueueServiceBase | Download queue object | |`session` | Optional[requests.Session] | Swap in a different Session object (usually for debugging) | ``` -------------------------------- ### Python API call for image generation Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Guides/recall-api.mdx Integrate image generation into your Python applications using the requests library. This example shows basic parameter setup and response handling. ```python import requests API_URL = "http://localhost:9090/api/v1/recall/default" params = { "positive_prompt": "a serene forest", "negative_prompt": "people, buildings", "steps": 25, "cfg_scale": 7.0, "seed": 42, } response = requests.post(API_URL, json=params) result = response.json() print(f"Status: {result['status']}") print(f"Updated {result['updated_count']} parameters") ``` -------------------------------- ### Build Documentation with Make Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Documentation/index.mdx Use this command from the repository root to build the documentation. It sets the DEPLOY_TARGET environment variable to 'custom'. ```sh make docs-build ``` -------------------------------- ### Run InvokeAI with NVIDIA GPU (CUDA) Source: https://github.com/invoke-ai/invokeai/blob/main/docker/README.md Use this command to quickly start InvokeAI in a Docker container with NVIDIA GPU support. Ensure Docker and NVIDIA container toolkit are installed and configured. ```bash docker run --runtime=nvidia --gpus=all --publish 9090:9090 ghcr.io/invoke-ai/invokeai ``` -------------------------------- ### Install Build Tools on Debian Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/configuration/patchmatch.mdx Update package lists and install essential build tools on Debian systems. Required before installing OpenCV. ```bash sudo apt update # Update package lists sudo apt install build-essential ``` -------------------------------- ### Initialize Download Queue with Event Handlers Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Instantiate the DownloadQueueService, providing a list of event handlers that will be applied to all jobs submitted to this queue. This example also shows how to log download events. ```python from invokeai.app.services.download_manager import DownloadQueueService def log_download_event(job: DownloadJobBase): logger.info(f'job={job.id}: status={job.status}') queue = DownloadQueueService( event_handlers=[log_download_event] ) ``` -------------------------------- ### Example __init__.py for Node Loading Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/invocations.mdx This Python file is used within a node's subfolder to import and expose specific Invocation classes. Only classes imported here will be loaded by InvokeAI. ```python from .cool_node import ResizeInvocation ``` -------------------------------- ### Model Installation Events Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Events related to the model installation process. ```APIDOC ## Model Installation Events ### `model_install_error` Emitted if the installation process fails. The payload contains `source`, `error_type`, and `error`. ### `model_install_cancelled` Issued if the model installation or any of its file downloads are cancelled. The payload contains `source`. ``` -------------------------------- ### Waiting for Installs Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Blocks until all queued install jobs are completed or have errored. ```APIDOC ## GET /api/v1/models/installs/wait ### Description Waits for all currently queued model installation jobs to complete or error out. ### Method GET ### Endpoint /api/v1/models/installs/wait ### Query Parameters - **timeout** (int) - Optional - Maximum time in seconds to wait for installs to complete. ### Response #### Success Response (200) - **results** (Dict[str, ModelInstallJob]) - A dictionary mapping each source to its corresponding `ModelInstallJob` status. - **ModelInstallJob**: - **complete** (bool) - True if the job completed successfully. - **errored** (bool) - True if the job encountered an error. - **error_type** (str) - The type of error encountered, if `errored` is true. - **error** (str) - Detailed error message, if `errored` is true. - **config_out** (ModelConfig) - The configuration of the installed model, if `complete` is true. #### Response Example ```json { "results": { "HFModelSource(repo_id='runwayml/stable-diffusion-v1-5')": { "complete": true, "errored": false, "error_type": null, "error": null, "config_out": { "key": "stable-diffusion-v1-5", "name": "Stable Diffusion v1.5", "description": "..." } } } } ``` ``` -------------------------------- ### Install Linux Dependencies for OpenCV Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/start-here/system-requirements.mdx On Debian-based systems, you'll need to install libglib2.0-0 and libgl1-mesa-glx for OpenCV to function correctly. This command updates package lists and installs the required libraries. ```bash sudo apt update && sudo apt install -y libglib2.0-0 libgl1-mesa-glx ``` -------------------------------- ### Installer Access Properties Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Properties providing access to core installer components. ```APIDOC ## Installer Access Properties ### `installer.app_config` Provides access to the installer's `InvokeAIAppConfig` object. ### `installer.record_store` Provides access to the installer's `ModelRecordServiceBase` object. ### `installer.event_bus` Provides access to the installer's `EventServiceBase` object. ``` -------------------------------- ### Preview Documentation Manually Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Documentation/index.mdx Run this command within the 'docs' directory to preview the built documentation. The preview URL will be available on the same port as the dev server. ```sh pnpm run preview ``` -------------------------------- ### Cancel a Model Installation Job Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Cancel the specified model installation job. ```python jobs = installer.cancel_job(job) ``` -------------------------------- ### Example invokeai.yaml Configuration Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/configuration/invokeai-yaml.mdx This snippet shows the basic structure of the `invokeai.yaml` file, including internal metadata and user-configurable settings for host, models directory, and precision. ```yaml # Internal metadata - do not edit: schema_version: 4.0.2 # Put user settings here - see https://invoke.ai/configuration/invokeai-yaml/: host: 0.0.0.0 # serve the app on your local network models_dir: D:\\invokeai\\models # store models on an external drive precision: float16 # always use fp16 precision ``` -------------------------------- ### Model Install Service Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Functionality provided by the ModelInstallService for managing model installations. ```APIDOC ## Model Install Service Functionality ### Description The `ModelInstallService` class provides comprehensive functionality for managing AI model installations within InvokeAI. It supports registering local models, installing local models by moving them, probing model details, interfacing with the event bus for status updates, downloading models from URLs, and handling HuggingFace repositories. ### Functionality - **Register Model**: Register a model config record for a model already on the local filesystem. - **Install Local Model**: Install a local model by moving it to the InvokeAI `models_dir`. - **Probe Model**: Determine a model's type, base type, and other key information. - **Event Bus Interface**: Provide status updates on download, installation, and registration processes. - **Download and Install**: Download a model from a URL and install it in `models_dir`. - **HuggingFace Handling**: Special handling for `repo_ids` to recursively download repository contents, including variants like fp16. - **Metadata Saving**: Save tags and metadata about the model into the InvokeAI database when fetching from sources like HuggingFace. ``` -------------------------------- ### Create Installer Script Source: https://github.com/invoke-ai/invokeai/wiki/Release-Checklist Generate the final tagging and zip file for the release. This script is used when releasing from the main branch. ```bash create_installer.sh ``` -------------------------------- ### Submit Download Job Manually Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Create a DownloadJobRemoteSource object and submit it to the queue. The `start=True` argument initiates the job immediately. ```python job = DownloadJobRemoteSource( source='http://www.civitai.com/models/13456', destination='/tmp/models/', event_handlers=[my_handler1, my_handler2], # if desired ) queue.submit_download_job(job, start=True) ``` -------------------------------- ### Setup Administrator Account Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/features/Multi-User Mode/api-guide.mdx Creates the initial administrator account. This endpoint is unauthenticated and only works if no admin exists. ```APIDOC ## POST /api/v1/auth/setup ### Description Creates the initial administrator account. This endpoint is unauthenticated and only works if no admin exists. ### Method POST ### Endpoint /api/v1/auth/setup ### Parameters None ### Request Body - **email** (string) - Required - The email address for the administrator. - **display_name** (string) - Required - The display name for the administrator. - **password** (string) - Required - The password for the administrator. ### Request Example ```json { "email": "admin@example.com", "display_name": "Administrator", "password": "SecureAdminPass123" } ``` ### Response #### Success Response - **success** (boolean) - Indicates if the setup was successful. - **user** (object) - Details of the created user. - **user_id** (string) - The unique identifier for the user. - **email** (string) - The user's email address. - **display_name** (string) - The user's display name. - **is_admin** (boolean) - Indicates if the user is an administrator. - **is_active** (boolean) - Indicates if the user account is active. #### Response Example ```json { "success": true, "user": { "user_id": "abc123", "email": "admin@example.com", "display_name": "Administrator", "is_admin": true, "is_active": true } } ``` ``` -------------------------------- ### Model Install Job Status Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx Information on how to track the status of a model installation job. ```APIDOC ## Model Install Job Status Poll the `ModelInstallJob` object returned by `import_model()` to check the install status. ### `status` attribute An `InstallStatus` enum with values: `WAITING`, `DOWNLOADING`, `RUNNING`, `COMPLETED`, `ERROR`, `CANCELLED`. ### Convenience Properties - `waiting` (boolean) - `downloading` (boolean) - `running` (boolean) - `complete` (boolean) - `errored` (boolean) - `cancelled` (boolean) - `in_terminal_state` (boolean): True if the job is in `COMPLETED`, `ERROR`, or `CANCELLED` state. ``` -------------------------------- ### Define and Add a Starter Model Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Guides/models.mdx Define a new model as a `StarterModel` object and append it to the `STARTER_MODELS` list. Ensure the `source` points to the HuggingFace repository. ```python newmodel_main = StarterModel( name="NewModel Main", base=BaseModelType.NewModel, source="organization/newmodel-main", # HuggingFace repo description="NewModel main transformer.", type=ModelType.Main, ) STARTER_MODELS.append(newmodel_main) ``` -------------------------------- ### Install OpenCV on macOS Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/configuration/patchmatch.mdx Use Homebrew to install OpenCV on macOS. This is a prerequisite for pypatchmatch. ```bash brew install opencv ``` -------------------------------- ### Example Node Pack Directory Structure Source: https://github.com/invoke-ai/invokeai/blob/main/invokeai/app/invocations/custom_nodes/README.md Illustrates the required directory layout for a custom node pack to be recognized by InvokeAI. ```python . ├── __init__.py # Invoke-managed custom node loader │ ├── cool_node │ ├── __init__.py # see example below │ └── cool_node.py │ └── my_node_pack ├── __init__.py # see example below ├── tasty_node.py ├── bodacious_node.py ├── utils.py └── extra_nodes └── fancy_node.py ``` -------------------------------- ### Install pypatchmatch Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/configuration/patchmatch.mdx Install the pypatchmatch Python library using pip. This is a core dependency for InvokeAI. ```bash pip install pypatchmatch ``` -------------------------------- ### Initialize Model Sync on API Startup Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/development/Architecture/model-manager.mdx The `start` method is invoked during API initialization to synchronize the model record store database with the current state of model files on disk. ```python installer.start(invoker) ``` -------------------------------- ### Define External Starter Model Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/contributing/external-providers.md Example of defining a new external starter model with its properties, capabilities, and default settings. Ensure the 'source' field is stable and unique. ```python new_external_model = StarterModel( name="Provider Model Name", base=BaseModelType.External, source="external://openai/my-model-id", description=( "Provider model (external API). " "Requires a configured OpenAI API key and may incur provider usage costs." ), type=ModelType.ExternalImageGenerator, format=ModelFormat.ExternalApi, capabilities=ExternalModelCapabilities( modes=["txt2img", "img2img", "inpaint"], supports_negative_prompt=False, supports_seed=False, supports_guidance=False, supports_steps=False, supports_reference_images=True, max_images_per_request=4, ), default_settings=ExternalApiModelDefaultSettings( width=1024, height=1024, num_images=1, ), ) ``` -------------------------------- ### Install OpenCV on Debian Source: https://github.com/invoke-ai/invokeai/blob/main/docs/src/content/docs/configuration/patchmatch.mdx Install OpenCV and its development libraries on Debian systems. This is necessary for pypatchmatch. ```bash sudo apt install python3-opencv libopencv-dev ```