Self-Hosted AI Assistant on Windows 11: Complete Setup Guide

    This guide walks you through building a self-hosted AI assistant on Windows 11, using a local control plane paired with a remote inference backend. It covers the layered architecture, environment requirements, API key setup, installation and verification steps, model service configuration, and practical operations such as skill extensions, multi-channel access, security, cost control, and troubleshooting.

    1. Why Choose a Self-Hosted AI Assistant

    Public cloud LLM services are mature, but more developers and enterprise users are asking a new question: does conversation data have to leave the local machine? Self-hosted AI assistant platforms answer by keeping the control plane local and connecting the inference plane on demand. These platforms typically share three traits: data and configuration are stored locally, the model backend can be swapped freely, and a unified gateway connects multiple messaging entry points.

    Self-hosting does not mean running the model locally. Most personal devices lack the compute to run large models, so the practical setup is a local console plus a remote model service. This article uses Windows 11 to show how to build that architecture, with a free-tier model from a model service platform as the inference backend example.

    2. Architecture and Prerequisites

    2.1 Logical Layers

    • Access layer: web console, terminal interface, and instant messaging bot adapters.
    • Orchestration layer: session management, skill (tool) scheduling, and prompt templates.
    • Model layer: inference services called over standard HTTP APIs, authenticated with a key.
    • Storage layer: local configuration files and a local database that hold sessions and credentials.

    2.2 Environment Requirements

    64-bit Windows 11 or Windows 10, 8GB or more of RAM recommended, and at least 2GB of free disk space. You also need access to code hosting sites and model service sites. If your network is restricted, prepare a working mirror channel first instead of repeatedly retrying the official source.

    2.3 Getting a Model Service Key

    Register an account on the model provider’s open platform, go to the key management page, and create a key. Keys usually start with a fixed prefix and should be stored securely offline. When choosing a provider, look at three things: whether a free or trial quota is offered, whether it is compatible with the common OpenAI-style API, and whether the context length is enough for long-document processing. Never hardcode the key into a script or commit it to a repository. Put it in a local environment variable or a separate configuration file, and restrict file permissions.

    3. Installation Steps

    3.1 Open an Administrator Terminal

    Press Win + X and choose the terminal with administrator privileges. The install script writes a system-level Node.js runtime, and a normal session will fail because the directory is not writable.

    3.2 Adjust the Script Execution Policy

    PowerShell blocks unsigned scripts by default, so allow local scripts for the current user:

    1. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

    Type Y to confirm. This setting affects only the current user; do not change -Scope to AllUsers, which would weaken security for the whole machine.

    3.3 Run the One-Click Install

    The official install script detects and installs Node.js 22 or later, then pulls the platform core files:

    1. iwr -useb https://<official-install-script-url> | iex

    If the download is slow or interrupted, rerun it with the mirror URL; the install logic is the same. The process takes about 3 to 10 minutes, so keep the window open. If it fails, the usual causes are a proxy that is not taking effect or a Node.js version that is too old. Install the runtime manually and rerun the script.

    3.4 Verify the Installation

    1. openclaw --version
    2. openclaw doctor

    The first command prints the version if the install succeeded. The second checks the runtime, port usage, and configuration file integrity, and is the first place to look when troubleshooting.

    4. Connecting the Model Service

    After initialization, put the key and API base URL into the configuration file or environment variables, and set the model ID to the model name you chose:

    1. {
    2. "provider": "openai-compatible",
    3. "baseUrl": "https://<model-service-api-url>/v1",
    4. "apiKey": "${MODEL_API_KEY}",
    5. "model": "glm-4.7-flash",
    6. "temperature": 0.7
    7. }

    Then start the service and open the local console to run a connectivity test. If authentication fails, check whether the key picked up stray spaces or line breaks. If the request times out, it is usually an outbound network issue; configure a proxy for the model domain specifically rather than a global proxy.

    5. Advanced Optimization and Operations

    • Skill extensions: capabilities such as file reading and web search are mounted as plugins; enabling only what you need keeps context from bloating.
    • Multiple entry points: connect messaging platforms through adapters, with a separate token and rate limit for each bot.
    • Security baseline: the console listens only on the loopback address; if you need LAN access, enable a strong password and add authentication at the reverse proxy layer.
    • Cost control: set context truncation and call rate limits per session to avoid burning through quota during long conversations.
    • Observability: send runtime logs to a local log service and use monitoring alerts to watch failure rates and response latency.

    6. Common Issues

    A permission error from the install script usually means the terminal was not run as administrator. If the port is in use after startup, change the listening port in the configuration file. A 404 on model calls typically means the API base URL is missing the version path. When the quota runs out, switch to a backup model instead of retrying repeatedly.

    7. Conclusion

    The value of a self-hosted AI assistant is returning control of data boundaries and model choice to the user. Once you have these steps down, you can extend the setup on a container platform or object storage to build stable personal AI assistant infrastructure.