Self-Hosted AI Assistant on Windows 11: Installation and Free Model API Setup
Learn how to install a self-hosted AI assistant on Windows 11, connect it to an OpenAI-compatible model API, and verify that the setup works. The guide covers system requirements, PowerShell configuration, installation, troubleshooting, and practical guidance for protecting data and API keys.
1. Overview
As large language models evolve, more developers want a personal AI assistant they can control: conversation data stays on their own machine, model providers can be changed, and capabilities can be extended as needed. A self-hosted AI assistant provides an alternative to relying entirely on a closed web service.
These platforms commonly offer:
- Local data storage: Conversation history and configuration files are stored on the user’s machine.
- Support for multiple models: Providers can be connected through an OpenAI-compatible API or a vendor SDK.
- Multiple interfaces: Many platforms include a web console and command-line interface, while some also support messaging integrations.
- Extensible capabilities: Plugins may add features such as file processing, web search, and scheduled tasks.
This guide walks through the full setup on 64-bit Windows 11, from preparing the system and installing the platform to configuring and testing a model API. It also covers using a mirror as an alternative when the default installation source is slow or unavailable.
2. Before You Begin
Check system requirements
Before installing, confirm that your system meets these baseline requirements:
- Operating system: 64-bit Windows 11. 64-bit Windows 10 may also work.
- Memory: At least 8 GB. 16 GB is recommended if you plan to run a vector database or persistent background services locally.
- Disk space: At least 2 GB for the runtime, dependencies, and logs.
- Network access: Installation requires access to the code hosting platform and package sources. If the default sources are unavailable or slow, use a suitable mirror.
Obtain a model API key
The self-hosted platform does not include model capabilities by itself; it needs to connect to an external model service. For example, a lightweight Flash-series model from a model provider may offer a free usage allowance suitable for personal, low-volume use. Availability and terms depend on the provider.
To obtain an API key:
- Register with a model provider and complete any required account verification.
- Open the API key management section of its console.
- Create a new API key. Some providers issue keys with an
sk-prefix. - Copy the key and store it securely. Many services display the full key only once.
Security note: Do not hard-code API keys in scripts or commit them to a repository. Store them in environment variables or the platform’s encrypted configuration, and rotate them periodically.
Open PowerShell as an administrator
The following setup may require changing the PowerShell execution policy and installing system-level dependencies.
- Press Win + X and select Terminal (Admin) or Windows PowerShell (Admin).
- If prompted by User Account Control (UAC), confirm the request.
3. Installation
Allow PowerShell scripts to run
By default, Windows restricts the execution of unsigned scripts. In an elevated PowerShell window, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
The parameters mean:
RemoteSignedallows local scripts to run, while scripts downloaded from the internet must have a trusted signature.-Scope CurrentUserapplies the setting only to the current user rather than changing the policy for the entire system.
Enter Y to confirm. To review the current policy settings, run:
Get-ExecutionPolicy -List
Run the installation script
Self-hosted platforms often provide a one-command PowerShell installer. The script typically checks for and installs a Node.js 22+ runtime, retrieves the platform files, and creates environment variables and a launch entry point.
Use the official installation source when it is reachable:
iwr -useb <official script URL> | iex
If the official source is slow or times out, use a suitable mirror:
iwr -useb <mirror script URL> | iex
Here, iwr is an alias for Invoke-WebRequest, and -useb selects its basic parsing mode. The downloaded script is piped to iex, an alias for Invoke-Expression, which executes it.
Security note: Before running a download-and-execute command, open the script URL in a browser and review its contents. Inspecting installation scripts is a basic supply-chain security practice.
Installation usually takes 3–10 minutes, depending on network conditions. Keep the terminal open while the process runs. If it fails, check connectivity and try again; installation scripts are often designed to be idempotent.
Verify the installation
Run the platform’s version command, commonly in the form <platform command> -v or <platform command> version. If it prints a version number, the core components are installed.
Next, start the platform and check whether the service is listening on its default local port. If it provides a web console, try opening its local address in a browser.
4. Connect and Configure a Model
Configure the model provider
Configure the model during the platform’s first-run setup or by editing its configuration file. You will typically need:
- API base URL: The endpoint for the provider’s API, such as its OpenAI-compatible API URL.
- API key: The key you obtained from the provider.
- Model name: The exact identifier for the model you intend to use, such as a lightweight Flash-series model.
Example JSON configuration:
{"provider": "openai-compatible","baseUrl": "https://<provider-compatible API host>/v1","apiKey": "sk-****************","model": "glm-flash-style-model"}
Replace the placeholders with values from the provider’s API documentation. The model identifier shown above is illustrative; use the exact name supported by your provider.
Test the connection
After saving the configuration, send a simple prompt from the web console or a terminal session. A normal response confirms that the connection is working.
If an error occurs, check the following:
- 401 or 403: The API key may be incorrect or expired. Generate a new key and update the configuration.
- 404: Check the model name and base URL against the provider’s API documentation.
- Timeout: Check network connectivity and proxy settings. If the default installation or access source is unreliable, consider switching to a mirror.
5. Best Practices
Add capabilities gradually
Once the platform is running reliably, enable optional plugins such as file processing or web search as needed. Add and test them one at a time to avoid loading too many plugins at once, which can make the context larger and responses slower.
Protect data and credentials
- Back up the local data directory and configuration files regularly.
- Keep API keys private, out of source control, and rotated periodically.
- If you expose the service to a local network or the public internet, enable access authentication and restrict access by source IP.
Manage model costs and switching
Free usage allowances may be suitable for light personal use. If usage increases, you can switch to a higher-performance paid model from the same provider or select another provider. With a self-hosted setup, changing models generally requires updating a small amount of configuration, while conversation history and established workflows can remain in place.
6. Summary
This guide covered the self-hosted AI assistant setup process: checking system requirements, adjusting the PowerShell execution policy, running the installer, obtaining an API key, connecting a model, and testing the configuration.
The main benefits of this approach are local data storage, the flexibility to switch model providers, and the ability to add capabilities through extensions. For developers who want more control over privacy and their personal AI workflows, it offers a practical, configurable setup. Further options to explore include messaging integrations, scheduled tasks, and RAG-based knowledge bases.
