How to Deploy a Self-Hosted AI Assistant on Windows 11 and Connect It to an LLM API
This guide walks through setting up a self-hosted AI assistant on Windows 11, from installing a JavaScript runtime and initializing the assistant to configuring and testing an online large language model (LLM) API. It also covers common setup issues, API key protection, local access controls, and routine maintenance.
1. How the Setup Works
A self-hosted AI assistant runs on your computer and typically provides a chat interface, command-line tools, configuration management, and optional task modules. Compared with a browser-only service, a local installation gives you more control over settings and stored data and makes it easier to switch models.
Self-hosting the assistant does not mean running the model locally. If you connect to an online LLM API, the assistant sends requests over the network to the model provider. The local application manages configuration and sessions, provides an interface, and executes authorized tasks. Before setting it up, decide what data can leave your computer. Avoid sending passwords, API keys, or sensitive internal files to an external model service.
The setup follows seven steps:
- Prepare Windows Terminal and the required system environment.
- Install a JavaScript runtime, preferably version 22 or later.
- Install the self-hosted assistant.
- Create a dedicated API key with your model provider.
- Configure the API base URL, model name, and key.
- Start the local service and test a conversation.
- Add access controls, log management, and backups as needed.
2. Check the Prerequisites
Hardware, storage, and network
Use 64-bit Windows 11 with at least 8 GB of RAM. If you use an online model, a typical office PC should be sufficient because the main local workloads are the assistant service and the browser. If you plan to run models, vector search, or file analysis locally, allow for more memory and disk space.
Set aside at least 2 GB of disk space for the initial installation. Storage use will grow with dependencies, logs, chat history, and extensions. For long-term use, place the data directory on a drive with enough free space to accommodate that growth.
Make sure the computer can reach the runtime download source, package repositories, and model API endpoint. If your organization uses a proxy, firewall, or HTTPS inspection, verify that applications launched from the terminal can establish HTTPS connections.
Create a dedicated API key
Open your model provider’s console and create a key in its credentials management settings. Use a separate key for each application and grant only the permissions it needs. Do not include the key in public code, screenshots, articles, or chat messages.
If you suspect a key has been exposed, revoke it immediately and generate a replacement. Review API activity and spending regularly. If your provider supports usage caps, restrictions on where requests can originate, or key expiration, enable them where appropriate.
3. Install the JavaScript Runtime
Check for an existing installation
Open Windows Terminal from the Start menu. If the installer requires elevation, run the terminal as an administrator and approve the User Account Control prompt.
Check whether the runtime and its package manager are already installed. The names below are placeholders; use the commands for your chosen runtime.
runtime --versionpackage-manager --version
If both commands return version numbers, check that the installed runtime meets the assistant’s requirements. If a command is not recognized, download a supported long-term support release from a trusted distribution source and follow the installation wizard.
After installation, close the current terminal and open a new one so it picks up the updated environment variables. Run the version checks again. If the commands still fail, verify that the installation directory is on PATH.
Review script execution settings
Some installers need to run local scripts. If Windows blocks a trusted script, consider adjusting the execution policy for the current user to allow local scripts and require a signature for downloaded scripts. Do not leave security protections disabled just to work around an installation error.
If you are unsure what a script does, download and inspect it before running it. Avoid piping unknown content from the network directly into a shell, especially in production environments.
4. Install the Self-Hosted AI Assistant
Option 1: Use the official Windows installer
If the project provides a Windows installer, use it for the simplest setup. It typically copies the application files, creates shortcuts, and handles basic configuration. Choose a path without special characters, such as:
D:\AI-Assistant
After installation, check that the assistant’s executable is available:
assistant --version
The assistant command is a placeholder for the executable documented by your chosen project. If it returns a version number, the terminal can find the program.
Option 2: Install through a package manager
If the project distributes the assistant through a package manager, follow its documented installation procedure. A global installation might look like this:
package-manager install --global assistant-package
Use the exact package name listed in the official documentation rather than guessing. After installation, open a new terminal and verify the version.
Whichever method you use, record the installed version. It will help you diagnose configuration incompatibilities, dependency conflicts, and upgrade issues.
5. Initialize and Start the Local Service
Run the project’s initialization command. The following is illustrative:
assistant init
Initialization typically creates directories for configuration, data, and logs. Keep them separate so you can manage each type of information independently:
- Configuration: API endpoints, model settings, and other runtime options.
- Data: Conversations, task history, and extension data.
- Logs: Startup messages, errors, and API request status.
If setup asks for a local administrator password, choose a long, unique password. Do not reuse your Windows sign-in password or choose an easily guessed value.
Start the assistant using the command documented by the project:
assistant start
The terminal will usually display a local URL. Open it in a browser to access the web console. If the page does not load, check the startup output for errors and verify that another process is not using the listening port.
6. Configure the LLM API
In the web console or configuration file, look for settings for the API key, base URL, and model name. The following example shows the general structure:
MODEL_API_KEY=replace_with_your_api_keyMODEL_API_BASE=https://example.invalid/v1MODEL_NAME=your_chat_model_name
Use the endpoint and model identifier from your provider’s API documentation and the setting names from the assistant’s documentation. The example URL is not a working endpoint. Never commit a real API key to a repository.
If the assistant supports environment variables, use them rather than putting the key directly in a plain configuration file. For example:
setx MODEL_API_KEY "your_api_key"
setx does not update the current terminal session. Open a new terminal before launching the assistant, or restart the service so it can read the new value. If the key is still reported as missing, check the variable name, its scope, and whether the service was started before the variable was set.
Some assistants also expose settings for request timeouts, maximum output length, temperature, and context window size. Leave these at their defaults until a basic request succeeds, then adjust them as needed for your tasks.
7. Verify That Model Requests Work
In the web console, send a simple prompt:
Describe what you can help me with in three sentences.
A successful response is a basic check that the local service can reach the provider and that the key and model settings work.
Follow up with three types of tests:
- Short text: Confirm that basic chat works.
- Long text: Check for context-length limits and timeouts.
- Structured output: Ask for a list or JSON and check whether the response consistently follows the requested format.
During testing, check whether requests succeed, responses are complete, and latency is within expectations. Look for permission errors or usage-limit messages, and verify that logs do not contain sensitive information.
8. Troubleshoot Common Problems
The terminal does not recognize a command
The runtime or assistant executable may not be on PATH. Open a new terminal, verify the installation directory, and check the environment variable settings.
Dependencies fail to download
Common causes include proxy settings, certificate validation, DNS, and firewall rules. First confirm that HTTPS access works, then check whether the terminal is using the correct proxy settings. Do not disable certificate validation as a workaround.
The API returns an authorization error
Check that the key was copied in full, contains no extra spaces, and has not expired or been revoked. Verify the model identifier and confirm that the key has permission to call that model.
The web console loads, but chat fails
The local interface can be available even when model requests fail. Check the logs for HTTP status codes, timeout details, and provider error messages to distinguish network, permission, and configuration problems.
The port is already in use
Choose a different local listening port or stop the application using the current one. If you change ports, update the browser URL and any applicable firewall rules.
9. Secure and Maintain the Installation
Keep the management console off the public internet unless remote access is necessary. Allow access only from the local computer or a trusted local network. If you need remote access, require authentication and use a secure connection method rather than exposing the management port directly.
Back up configuration and important conversations regularly, and restrict access to the backup files. If logs contain request content, set a retention period so sensitive information is not kept longer than necessary.
Before upgrading, record the current version and back up the data directory. If the upgrade causes problems, that version record will help you roll back or reinstall the appropriate dependencies. Enable extensions one at a time and review their sources and permissions before relying on them.
10. Start With a Minimal Setup
A maintainable Windows 11 deployment is more than a successful installation. It requires a working runtime, an initialized assistant, a verified connection to the model API, and clear rules for protecting credentials and managing data.
For personal use, start with basic chat and confirm that it runs reliably before adding file processing, knowledge retrieval, or automation. For teams and enterprise environments, add role-based permissions, audit logging, network isolation, key rotation, and backup and recovery procedures to retain control over data and operations.
