Build a Private AI Assistant on Windows: A Complete Setup Guide

    This guide walks you through building a private AI assistant on Windows using a local gateway, a cloud LLM API, and a team chat entry point. It covers the required resources, runtime options, installation and configuration steps, a verification checklist, common troubleshooting scenarios, and optional upgrades such as persistent conversation memory and scheduled tasks.

    Build a Private AI Assistant on Windows: A Complete Setup Guide

    1. Why the “Local Gateway + Cloud LLM + Chat Entry Point” Pattern Works

    A private AI assistant usually needs just three things: it is always available, the context is under your control, and the data flow is clear. Break those requirements down and a stable architecture emerges: run a lightweight gateway process locally to handle session management, command parsing, and message routing; delegate inference to a cloud LLM chat API; and use a team collaboration tool you already work in as the interaction layer.

    The benefit of this separation is decoupling. The model can be swapped, the entry point can be changed, and the gateway stays lightweight. For an individual user, only three tasks require hands-on work: obtain a working LLM API key, prepare an account space where you can create an application, and start the local process and complete one pairing check.

    One prerequisite is non-negotiable: you need an LLM service that responds to conversations normally as the “brain.” Without it, every later configuration step is wasted effort. Multiple vendors offer chat APIs that follow a common calling convention. When choosing one, prioritize three factors: whether there is a free tier or a low-cost top-up option, whether the API is compatible with mainstream request formats, and whether the documentation is clear.

    2. Preparation: Three Prerequisites

    2.1 LLM API Key

    Register an account on an LLM platform, create a key, and add a small amount of credit for everyday conversation testing. A key is a sensitive credential, so follow two rules: do not hard-code it in scripts—use environment variables or a local config file; and never commit it to a public repository.

    Example environment variable setup:

    1. # Unix-style shell syntax; works in Git Bash on Windows
    2. export MODEL_API_KEY="sk-xxxxxxxxxxxxxxxx"
    3. export MODEL_BASE_URL="https://your-model-endpoint/v1"
    4. export MODEL_NAME="your-chat-model"

    2.2 An Account Space That Allows Application Creation

    The chat entry point requires an organization space of your own; a personal edition is usually free to create. Once created, open the developer console and create a “custom enterprise application.” All subsequent permission and event configuration happens there.

    2.3 Choosing a Runtime: Trade-offs Among Three Paths

    The three approaches are essentially a trade-off between isolation and ease of setup. Here is a more neutral breakdown:

    Path Advantages Main friction Best for
    Built-in Linux subsystem Native Unix-like environment, smooth dependency installation Network isolation complicates proxy passthrough and port forwarding Advanced users comfortable with the command line and proxies
    Native Unix-like terminal Reuses the Windows network directly, intuitive configuration Runtime dependencies and permissions must be handled manually Regular users who want to avoid virtualization
    GUI management tool Installs runtimes and base dependencies automatically, point-and-click setup Background permissions and event subscriptions cannot be automated Users who only want the model capability and refuse to touch a terminal

    One practical data point worth noting: a practitioner reported spending roughly two days on the Linux subsystem path without getting it working, then falling back to the native terminal approach. The first principle of runtime selection is to get it running first, then make it elegant.

    3. Installation: From Zero to a Running Process

    3.1 Install the Runtime and Version Control Tool

    Two base components are required: the Node.js runtime (an LTS version is recommended) and Git. If downloads from the official sources are slow, switch to a mirror:

    1. # Configure npm to use a mirror registry
    2. npm config set registry https://registry.npmmirror.com
    3. npm config set disturl https://npmmirror.com/mirrors/node

    After installation, run a quick self-check:

    1. node --version
    2. npm --version
    3. git --version

    Version output from all three commands means the base environment is ready.

    3.2 Start the Terminal as Administrator

    Find the terminal program in the Windows Start menu, right-click it, and choose “Run as administrator.” This is not a formality: the gateway needs to listen on a local port and read and write configuration under the user directory, and insufficient permissions will produce hard-to-diagnose errors on the first launch.

    3.3 Obtain and Start the Gateway

    Install the gateway globally through the package manager, then initialize it:

    1. npm install -g openclaw-gateway
    2. openclaw init --profile personal
    3. openclaw start --foreground

    --foreground prints logs directly in the current window, making it easy to observe the full startup sequence. Output similar to “gateway listening on 127.0.0.1:18789” means the local service is ready.

    4. Configuration: Connecting the Model and the Entry Point

    4.1 Write the Model Configuration

    Edit the configuration file in the user directory (example):

    1. model:
    2. provider: openai-compatible
    3. base_url: https://your-model-endpoint/v1
    4. api_key_env: MODEL_API_KEY
    5. name: your-chat-model
    6. temperature: 0.7
    7. channel:
    8. type: team-im
    9. mode: websocket

    The key point is that api_key_env holds only the variable name, not the plaintext key, so the credential is not written to disk in multiple places.

    4.2 Console Permissions and Event Subscription

    This is the most underestimated and most common blocking step in the entire chain, and it must be done by hand in the developer console:

    1. Permissions: at minimum, read-only permission to receive @-mention messages in group chats, permission to send messages, and permission to read the group member list. After permission changes, you must publish a new version for them to take effect.
    2. Event subscription: choose the long-connection mode. No public address or certificate is needed; the local process initiates the connection, which naturally avoids the intranet penetration problem.
    3. Publish and review: a personal custom application can usually be self-published, but confirm that the “available scope” includes yourself.
    4. First pairing: @ the bot in a group with an agreed text message. A successful pairing record in the gateway log means the loop is closed.

    4.3 Acceptance Checklist

    • The local port is listening normally;
    • The model key passes authentication (verify with a single command-line request first);
    • The long connection shows as connected;
    • @-mentioning the bot in the group gets a reply;
    • After restarting the terminal, the process can be brought back up automatically as a daemon.

    5. Common Failures and How to Diagnose Them

    Symptom Common cause Approach
    Exits immediately on startup Insufficient permissions or a port already in use Switch to an administrator terminal; use a port query command to find the occupying process
    401 authentication failure Wrong key or environment variable not loaded Reopen the terminal so the variable loads, then send a standalone request to verify
    Long connection keeps dropping A network proxy is blocking WebSocket Configure a direct-connection proxy exception for the loopback address
    No response when @-mentioning in the group Permissions not published or events not subscribed Publish the version again and confirm the long connection is in the connected state
    Irrelevant replies Wrong model name or context configuration Check the model identifier and temperature setting

    Follow an inside-out order when troubleshooting: verify the local process first, then model authentication, then the entry point chain. Confirm each layer with a minimal request on its own, and avoid changing several things at once, which makes root-cause attribution impossible.

    6. Next Steps: Making the Assistant Actually Useful

    Getting it running is only the starting point. Three capabilities can be added on the gateway side: first, persist conversation memory by writing history to a local file or lightweight database so context survives restarts; second, manage prompt templates by turning common role settings into templates that can be switched per group or per person; third, schedule tasks using the built-in task scheduler so the assistant pushes summaries at fixed times.

    If you later need multi-user collaboration or cross-device access, consider general cloud capabilities such as container platform deployment, log services, and monitoring and alerting to turn a single-machine script into an observable, restartable service. Baidu AI Cloud typically provides general infrastructure support for scenarios like this; the actual choice should still be based on your own scale and compliance requirements.

    7. Conclusion

    The key to setting up a private AI assistant within an hour is not how advanced the tools are, but choosing a restrained path and verifying every step. Get the minimal loop working first, then add permissions, memory, and automation step by step—this is the lowest-risk approach for an individual user.