How to Deploy a Self-Hosted AI Assistant on Windows 11: A Step-by-Step Guide
A self-hosted AI assistant keeps the chat interface, task orchestration, configuration data, and tool permissions on your own machine, while the model itself runs behind a standard API interface. This guide compares three popular open-source options—Open WebUI, LibreChat, and Dify—explains why Open WebUI is the easiest choice for a single-machine setup, and walks through the full deployment process on Windows 11: preparing Python and credentials, creating a directory structure and virtual environment, installing Open WebUI with pip, and configuring environment variables and a startup script. By the end, you will have a working assistant running locally on 127.0.0.1:8080, with chat history and configuration stored on your own disk.
Part 1: Choosing an Approach
A self-hosted AI assistant means the chat interface, task orchestration, configuration data, and tool permissions run on your own computer or internal server, while the model itself is connected through a standard interface to an external service. In this setup, chat history and system configuration stay on your local machine, you can switch between different models per task, and migrating to a home server or office workstation later is straightforward.
Two concepts need to be distinguished. A self-hosted assistant can run on your local machine, but model inference is usually still performed by a remote service. If you require that no data leaves your machine at all, you must additionally deploy a local model, which raises the requirements for VRAM, memory, and compute significantly.
There are three common open-source options. Here is how they compare:
| Project | Deployment Method | Main Dependencies | Complexity | Best For |
|---|---|---|---|---|
| Open WebUI | pip or Docker | Python 3.11, or Docker Desktop | Low | Single-user setup, quick connection to OpenAI-compatible APIs |
| LibreChat | Docker Compose or Node.js from source | Docker Desktop, or Node.js with MongoDB | Medium | Multi-model chat with multiple user accounts |
| Dify | Docker Compose | Docker Desktop plus several supporting services | High | Workflow orchestration and knowledge base applications |
This guide uses Open WebUI because it requires the fewest installation steps and supports OpenAI-compatible interfaces out of the box. The commands below assume the pip installation method.
Part 2: Prerequisites
2.1 Hardware and Disk
- OS: 64-bit Windows 11
- Memory: at least 8GB; 16GB recommended if you run a browser and other applications at the same time
- Disk: dependencies are large, so reserve at least 10GB of free space
- Network: access to the model service endpoint and the PyPI package repository
- Company devices: confirm first whether your endpoint security policy restricts script execution, port listening, or external network access
2.2 Check Python, pip, and Git
Open a regular (non-admin) PowerShell window and run:
python --versionpip --versiongit --version
Python should report a 3.11.x version. Git is only needed for source-based installs or updates; you can skip it when installing Open WebUI with pip.
If you see “‘python’ is not recognized as an internal or external command,” or typing python opens the Microsoft Store, fix it in this order:
- Open “Settings > Apps > Advanced app settings > App execution aliases” and turn off the python.exe alias;
- Download the official Python 3.11 installer from python.org and check “Add python.exe to PATH” during installation;
- Close all terminal windows and open a new regular terminal;
- Run
py -0to list installed Python versions, then runpy -3.11 --versionto confirm 3.11 works.
2.3 Prepare Model Service Credentials
Before connecting a model, complete the following in your provider’s console:
- Create an access key and set its expiration and permission scope;
- Note the OpenAI-compatible endpoint URL, usually ending in
/v1—check your provider’s documentation for the exact address; - Note the model IDs you plan to use;
- Save the key in a password manager;
- Never send the key through group chats or ticketing systems, and never commit it to a public repository.
If a key is ever exposed, revoke it in the console immediately and generate a new one.
Part 3: Create Directories and a Virtual Environment
Run the following commands to create the directory structure and set up an isolated Python virtual environment:
mkdir D:\AI-Assistant\appmkdir D:\AI-Assistant\datamkdir D:\AI-Assistant\logsmkdir D:\AI-Assistant\backupmkdir D:\AI-Assistant\skillscd D:\AI-Assistant\apppy -3.11 -m venv venv.\venv\Scripts\Activate.ps1python -m pip install --upgrade pip
After activation, a (venv) prefix appears in your prompt. Running python --version again should display 3.11.x.
If PowerShell blocks script execution, run:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
This only affects the current user. To revert, run Set-ExecutionPolicy -Scope CurrentUser Restricted. If you use cmd, the activation command is .\venv\Scripts\activate.bat.
Program files go in app, configuration and business data in data, logs in logs, and backups in backup. This way, upgrading or reinstalling the program never touches your data directory.
Part 4: Install Open WebUI
Inside the activated virtual environment, run:
pip install open-webuiopen-webui --helppip show open-webui
The first command takes a while because it downloads many dependencies. pip show displays the installed version number—record it so you can roll back later if needed.
If the installation fails, troubleshoot as follows:
- “No matching distribution” or a Python version error: your virtual environment is not 3.11. Delete the
venvdirectory and recreate it withpy -3.11 -m venv venv; - A compile error mentioning “Microsoft Visual C++ 14.0 or greater”: install Microsoft C++ Build Tools, then rerun the installation command;
- Network timeouts: verify you can reach PyPI. If you are behind a corporate proxy, set the
HTTPS_PROXYenvironment variable in the terminal first, then retry.
To undo the installation, run deactivate to exit the virtual environment, then delete D:\AI-Assistant\app\venv after confirming the path. The data directory will not be affected.
Part 5: Configuration and Startup
5.1 Set the API Key and Session Secret
Open the Start menu, search for “Edit environment variables for your account,” and create the following entries under “User variables”:
- Variable name
OPENAI_API_KEY, with your provider’s access key as the value; - Variable name
WEBUI_SECRET_KEY, with a random string as the value.
Generate a random string with:
python -c "import secrets; print(secrets.token_urlsafe(32))"
WEBUI_SECRET_KEY is used to sign login sessions. After changing it, all users must log in again.
Once the user variables are set, close all terminal windows and open a new terminal for the changes to take effect.
5.2 Write a Startup Script
Create start.ps1 in D:\AI-Assistant\app with the following content:
$env:DATA_DIR = "D:\AI-Assistant\data"$env:OPENAI_API_BASE_URL = "https://api.openai.com/v1".\venv\Scripts\Activate.ps1open-webui serve --host 127.0.0.1 --port 8080 2>&1 | Tee-Object -FilePath "D:\AI-Assistant\logs\webui.log" -Append
Replace OPENAI_API_BASE_URL with the address given in your provider’s documentation. The example https://api.openai.com/v1 is only a format reference. The script does not store any keys—keys remain only in your user variables.
Start the service with:
powershell -ExecutionPolicy Bypass -File D:\AI-Assistant\app\start.ps1
The --host 127.0.0.1 argument means the service listens only on localhost. Logs are displayed in the terminal window and appended to D:\AI-Assistant\logs\webui.log.
Once started, open http://127.0.0.1:8080 in your browser. The first account you register automatically becomes the administrator, so use a strong password for it.
