Skip to content

OpenClaw Native Windows Installation and Deployment

OpenClaw Windows Native Installation and Deployment

Section titled “OpenClaw Windows Native Installation and Deployment”

Page Overview

Tutorial: OpenClaw Windows Native Installation and Deployment, plus Connecting Claude API Access via 4All API Aggregation Relay

Section titled “Tutorial: OpenClaw Windows Native Installation and Deployment, plus Connecting Claude API Access via 4All API Aggregation Relay”

OpenClaw (formerly Clawdbot / MoltBot) is an open-source, local-first AI Agent gateway that connects large language models to your local system and messaging platforms (Telegram, WhatsApp, Discord, Feishu, WeCom, etc.), enabling a 24/7 personal AI assistant.

This tutorial will walk you through the full process, from setting up the underlying environment and connecting to LLM APIs, to deploying it as an automated bot in the Feishu workspace, and obtaining a Claude apikey through a custom Base URL + API Key integration to access Claude models.


  • Windows 10 / Windows 11
  • Node.js 22+ LTS
  • Git
  • At least 2GB of free disk space
  • 4All API APIKey
  • Visit the [Node.js official website] https://nodejs.org and download the Windows installer for Node.js 22 LTS (.msi).
  • Run the installer and check “Automatically install the necessary tools”.
  • After installation, close and reopen PowerShell, then verify the installation:
Terminal window
node --version # Should display v22.x.x
npm --version # Should display the version number

Tip: If you get a message saying node is not recognized as a command, manually add C:\Program Files\nodejs\ to the system PATH environment variable, or restart your computer.

Run the following command in PowerShell:

Terminal window
winget install Git.Git

(or download and install it from the [Git official website] https://git-scm.com . On the website, choose the installer based on your computer architecture (for example, Windows x64). Regular users do not need to worry about advanced settings; keep the default options and complete the installation. During installation, choose “Use Git from the command line and also from 3rd-party software”.)

After installation, close and reopen PowerShell, then verify:

Terminal window
git --version

2. Install OpenClaw Natively on Windows via PowerShell

Section titled “2. Install OpenClaw Natively on Windows via PowerShell”

Open PowerShell as administrator (right-click the Start menu → Windows PowerShell (Administrator)), then run the following commands one by one:

Terminal window
# Allow script execution
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Change the npm global install directory (to avoid permission conflicts)
npm config set prefix "C:\npm"
npm config set cache "C:\npm-cache"
# Add the new directory to the user PATH
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\npm", "User")

After the commands finish, close PowerShell and open a new window (so PATH takes effect).

There are two ways to do this; it is recommended to try Method 1 first:

Method 1: One-click installation script

Terminal window
iwr -useb https://openclaw.ai/install.ps1 | iex

Method 2: Manual npm installation (if the one-click script fails)

Terminal window
npm install -g openclaw

Common error fixes:

  • node.exe application error: Temporarily turn off Windows Defender real-time protection and try again.
  • spawn git ENOENT: Git is not installed, or PowerShell has not been restarted. Install Git first, then reopen the window.
  • Permission errors: Run PowerShell as administrator.

The setup wizard will ask you the following questions in sequence:

  • Security confirmation: Use the arrow keys to select “Yes” (confirming that you understand OpenClaw has system access permissions).

  • Installation mode: Choose “QuickStart” to complete the basic configuration quickly.

  • Choose an LLM provider: You can pick any option for now or skip it. You can also choose No to skip this step. We’ll manually configure the 4All API apikey service later.

  • Messaging platform configuration (optional): Telegram / WhatsApp / Discord / DingTalk / Feishu / WeCom / QQ, etc. can be configured later.

  • Shell completion (optional): It is recommended to choose Yes to speed up command entry.

  • Package manager: Choose npm.

  • For the remaining options, choose “No/Default”.

Tip: If you want to configure the API during the setup process, you can skip LLM selection for now and manually edit the configuration file after installation (see the next chapter). This is more flexible.

Open http://127.0.0.1:18789/ in your browser. If it shows “unauthorized”, run the openclaw dashboard command in the terminal, which will print a link containing ?token=...; open that link instead.

Note: If the Gateway fails to install as a background service (administrator privileges required), you can start it manually in foreground mode: openclaw gateway --port 18789


3. Configure 4All API Proxy Access to Obtain Claude APIkey for LLM Services

Section titled “3. Configure 4All API Proxy Access to Obtain Claude APIkey for LLM Services”

To connect Claude through the 4All API proxy (API Proxy / Relay), you need two things:

  • Base URL: the API address provided by the 4All API service
  • API Key: the secret key issued to you by the 4All API service

3.1 Confirm Your Relay Service Information

Section titled “3.1 Confirm Your Relay Service Information”
ItemExampleDescription
Base URLhttps://sg.4All API.comProxy service API address
API Keysk-xxxxxxxxxxxxxxxxThe secret key from the relay service
Supported modelsclaude-sonnet-4-5-20250929, GPT-5, Gemini-3-Pro, etc.Check the 4All API model marketplace for supported models

Key point: The 4All API aggregation service is compatible with both Anthropic native format (anthropic-messages) and OpenAI-compatible format (openai-completions).

By default, OpenClaw’s configuration file is located at: C:\Users\your-username\.openclaw\openclaw.json. Open it with Notepad, VS Code, or any text editor.

Section titled “3.3 Configuration Option A: 4All API Compatible with Anthropic Native Format (Recommended)”

If the service supports Anthropic native API (/v1/messages endpoint), use the anthropic-messages format. This is the recommended option and allows you to use all of Claude’s advanced features. Add or modify the following in openclaw.json:

Clear openclaw.json and paste the following complete version, including "name": "Claude Sonnet 4.5":

{
"models": {
"providers": {
"4All API": {
"api": "anthropic-messages",
"baseUrl": "https://sg.4All API.com",
"apiKey": "sk-在这里填入你在4All API生成的真实密钥",
"headers": {
"anthropic-version": "2023-06-01",
"anthropic-beta": ""
},
"models": [
{
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5",
"contextWindow": 200000,
"maxTokens": 8192,
"reasoning": true
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "4All API/claude-sonnet-4-5-20250929"
}
}
}
}

(Reminder: Don’t forget to replace your sk-... key.)

Save and exit, then go back to PowerShell and run the following again:

Step 1: Reset local mode. Run this command in PowerShell:

Terminal window
openclaw config set gateway.mode local

Step 2: Start the gateway again. Immediately run the startup command:

Terminal window
openclaw gateway --port 18789

Keep this window open, switch to your browser, refresh the Dashboard page (http://127.0.0.1:18789), and send Claude your first message to test it!

Notes:

  • Do not add /v1 to the end of baseUrl. When OpenClaw uses this format, it will automatically append /v1/messages. If the URL already includes /v1, it will become /v1/v1/messages, causing a 404 error.
  • "api": "anthropic-messages" must be set, otherwise it will default to OpenAI-compatible mode.
  • anthropic-version in headers is generally set to "2023-06-01".
  • The model id must match the actual model supported by the relay service.
  • If the relay service is not compatible with the thinking/reasoning feature, you can set anthropic-beta to an empty string in headers to disable it.

3.4 Configuration Option B: 4All API Compatible with OpenAI Format

Section titled “3.4 Configuration Option B: 4All API Compatible with OpenAI Format”

In the latest OpenClaw 2026 version, we must strictly follow the required nested structure, while also adding the new mandatory name field and routing configuration.

Below is the fully refactored and optimized final OpenAI-compatible version. You can copy and use it directly:

{
"gateway": {
"mode": "local"
},
"models": {
"providers": {
"4All API": {
"api": "openai-completions",
"baseUrl": "https://sg.4All API.com/v1",
"apiKey": "sk-xxxxxxxxxxxxxxxx",
"models": [
{
"id": "gpt-4.1",
"name": "GPT-4.1",
"contextWindow": 128000,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "4All API/gpt-4.1"
}
}
}
}

💡 Core Optimization Points of the New JSON Version:

Section titled “💡 Core Optimization Points of the New JSON Version:”
  • Fully adapted to the latest architecture: api, baseUrl, and apiKey are all placed under models.providers.4All API, completely eliminating Unrecognized keys errors.
  • Keep the /v1 suffix: unlike the Anthropic native format, the standard path for OpenAI-compatible interfaces ends with /v1, so "baseUrl": "https://sg.4All API.com/v1" is the correct standard format.
  • Add required fields: "name": "GPT-4.1" is included. Without this field, the Dashboard will fail because it cannot read the display name and will report received undefined.
  • Add context parameters: contextWindow and maxTokens are included so the gateway can manage memory length more precisely.
  • Connect the primary model routing: agents.defaults explicitly sets the default model to 4All API/gpt-4.1, ensuring there is a model ready to handle messages.
Comparison Itemanthropic-messages (Recommended)openai-completions
api field"anthropic-messages""openai-completions"
baseUrl endingDo not add /v1Must include /v1
Prompt CachingSupportedNot supported
Extended ThinkingSupportedNot supported
Tool Calling stabilityBetter (native format)May have compatibility issues
Use caseRelay supports Anthropic native APIRelay supports OpenAI native interface

Recommendation: If both formats are supported, prefer anthropic-messages.

4. Example Configuration File for Automatic Primary/Backup Model Switching with Anthropic

Section titled “4. Example Configuration File for Automatic Primary/Backup Model Switching with Anthropic”

This is the fully compatible openclaw.json for the latest 2026 OpenClaw version. It supports automatic switching between primary and backup models and fixes all format validation requirements.

You can copy it directly and completely overwrite the existing file content:

{
"gateway": {
"mode": "local"
},
"models": {
"providers": {
"4All API": {
"api": "anthropic-messages",
"baseUrl": "https://sg.4All API.com",
"apiKey": "sk-请替换为你的4All API真实密钥",
"headers": {
"anthropic-version": "2023-06-01",
"anthropic-beta": ""
},
"models": [
{
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5",
"contextWindow": 200000,
"maxTokens": 8192,
"reasoning": true
},
{
"id": "claude-opus-4-6",
"name": "Claude Opus 4.6",
"contextWindow": 200000,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "4All API/claude-sonnet-4-5-20250929",
"fallbacks": [
"4All API/claude-opus-4-6"
]
}
}
}
}

⚠️ Important reminder: After pasting, make sure to replace the sk-请替换为你的4All API真实密钥 on line 10 with the actual key you generated.

5. Example Configuration File for a “Dual-Engine” Setup Combining Claude and GPT

Section titled “5. Example Configuration File for a “Dual-Engine” Setup Combining Claude and GPT”

Combining Claude and GPT is one of the most powerful ways to use a platform like 4All API as an aggregation relay. It gives your AI assistant a “dual-engine” setup that can handle complex tasks while maintaining excellent stability.

One core logic point is especially important: Claude (Anthropic protocol, without /v1) and GPT (OpenAI protocol, with /v1) use completely different underlying communication formats. In the latest OpenClaw 2026 version, we cannot mix them in the same bucket; we must split them into two separate “providers”.

Below is the carefully tuned “Claude + GPT dual-engine final version” openclaw.json configuration. You can directly add it to your Zhihu tutorial as an advanced feature example:

{
"gateway": {
"mode": "local"
},
"models": {
"providers": {
"4All API-claude": {
"api": "anthropic-messages",
"baseUrl": "https://sg.4All API.com",
"apiKey": "sk-请替换为你的4All API真实密钥",
"headers": {
"anthropic-version": "2023-06-01",
"anthropic-beta": ""
},
"models": [
{
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5",
"contextWindow": 200000,
"maxTokens": 8192,
"reasoning": true
}
]
},
"4All API-gpt": {
"api": "openai-completions",
"baseUrl": "https://sg.4All API.com/v1",
"apiKey": "sk-请替换为你的4All API真实密钥",
"models": [
{
"id": "gpt-4.1",
"name": "GPT-4.1",
"contextWindow": 128000,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "4All API-claude/claude-sonnet-4-5-20250929",
"fallbacks": [
"4All API-gpt/gpt-4.1"
]
}
}
}
}

(Reminder: Don’t forget to replace your sk-... key.)

Save and exit, then go back to PowerShell and run the following again:

Step 1: Reset local mode. Run this command in PowerShell:

Terminal window
openclaw config set gateway.mode local

Step 2: Start the gateway again. Immediately run the startup command:

Terminal window
openclaw gateway --port 18789

Keep this window open, switch to your browser, refresh the Dashboard page (http://127.0.0.1:18789), and send Claude your first message to test it!

💡 Key Highlights of the Dual-Engine Setup

Section titled “💡 Key Highlights of the Dual-Engine Setup”

When explaining this code to readers, you can distill the following highly attractive “hardcore selling points”:

  • Protocol isolation, no interference: We cleverly define two independent channels under providers: 4All API-claude and 4All API-gpt. One uses the native Anthropic protocol for peak performance, while the other uses the standard OpenAI-compatible protocol.
  • Shared balance, seamless integration: Although split into two channels, they both point to sg.4All API.com and use the same apiKey, consuming the same account balance, which makes management extremely convenient.
  • Enterprise-grade disaster recovery: In agents.defaults, we set the widely recognized strongest model for coding and logic, Claude Sonnet 4.5, as the absolute primary (primary). At the same time, GPT-4.1 is placed in the backup pool (fallbacks). If Claude’s interface experiences a major network fluctuation one day, the system will switch to GPT-4.1 within milliseconds and continue answering for you, ensuring your Feishu bot never goes down 24/7!
  • "mode": "local": Explicitly tells OpenClaw to run in “local mode.” This is the key switch for resolving frequent Gateway start blocked errors right after installation.

2. Service Provider and Network Channel (providers.4All API)

Section titled “2. Service Provider and Network Channel (providers.4All API)”

This is the bridge connecting the local gateway and the 4All API relay service:

  • "4All API": The custom provider name prefix defined in the configuration, which will be used when calling models later.
  • "api": "anthropic-messages": Specifies the communication protocol format. Using Anthropic native protocol ensures full access to Claude’s advanced features, such as Prompt Caching.
  • "baseUrl": The server endpoint address of 4All API. Note that /v1 should not be added at the end; the system will append it automatically.
  • "apiKey": The dedicated secret key used for authentication (obtained from the platform).
  • "headers": Request header parameters. "anthropic-beta": "" is intentionally set to an empty string; this is an advanced troubleshooting technique used to suppress beta features not supported by some relay services and prevent 400 compatibility errors.

3. Detailed Model Definition (models array)

Section titled “3. Detailed Model Definition (models array)”

In this array, we register two specific models (Sonnet and Opus):

  • "id": The actual request ID of the LLM on the backend (for example, claude-sonnet-4-5-20250929), which must exactly match the model library supported by the platform.
  • "name": (Required in the new version) The display name shown to users in the Dashboard. If you don’t fill this in, it will cause an undefined error.
  • "contextWindow": The size of the model’s context window (Claude models usually support 200,000 tokens). This lets the gateway know when to truncate conversation history.
  • "maxTokens": The maximum number of tokens allowed in a single response.
  • "reasoning": true: A capability flag telling the Agent that this model supports advanced logical reasoning and thinking.

4. Automated Scheduling Strategy (agents.defaults)

Section titled “4. Automated Scheduling Strategy (agents.defaults)”

The core strategy area that keeps your AI assistant online:

  • "primary": Sets the default main working model (format: provider name/model ID). Here it is set to the more cost-effective Sonnet.
  • "fallbacks": Backup model pool. When the primary model experiences network fluctuations, API rate limiting, or becomes unavailable, the system will automatically and seamlessly switch to a backup model in the array (such as Opus) to continue responding, ensuring 24/7 service stability.

5.1 Use Different Models for Multiple Agents

Section titled “5.1 Use Different Models for Multiple Agents”

Assign different models to different tasks to balance cost and performance. For example: use Opus for complex tasks and Sonnet for everyday chat. This is usually configured separately for each Agent in the Dashboard.

If you want to quickly switch the primary model from the command line, use:

Terminal window
openclaw models set <model_id>

5.3 Configure Messaging Platforms (Optional)

Section titled “5.3 Configure Messaging Platforms (Optional)”

After installation, you can add messaging platforms at any time. Enter the following command in the terminal and follow the prompts:

Terminal window
openclaw configure

1. Example: Deep Integration with the Feishu Workspace

Section titled “1. Example: Deep Integration with the Feishu Workspace”
    1. Create a Feishu app: Log in to the Feishu Open Platform, enter the developer console, click to create an enterprise self-built app, and fill in the bot’s name and description.
    1. Enable basic permissions: In the app settings, add bot capabilities. Go to Permission Management, search for IM:, and enable all message-related permissions. Then click Create Version and confirm publishing (the version number can be 1.0.0).
    1. Open the configuration terminal: Return to the PowerShell terminal and enter the openclaw configuration command to re-enter the settings interface. Choose to configure the communication channel and add Feishu; the system will automatically install the Feishu plugin via npm.
    1. Bind Feishu credentials: Copy the App Secret and App ID provided by the Feishu developer console and paste them into the PowerShell terminal in sequence.
    1. Set the communication protocol: Choose the simplest WebSocket mode. Based on your actual needs, configure private chat and group chat access permissions (for example, choose Open to allow everyone on the team to use it).
    1. Configure event callbacks: Return to the Feishu developer console. In the Events and Callbacks module, switch the subscription method to long connection, and search for and add the Receive Message event.
    1. Add the remaining permissions and publish: Go back to Feishu Permission Management, and enable additional permissions such as Get bot basic information. Finally, be sure to publish a new version again so all settings take effect.

    1. Final integration test: Open the Feishu app or desktop client, search for and open the bot app you just created in the message list. Try sending a direct message, or add it to a group chat and mention it to ask a question, then confirm that the response latency and logic are working properly.
    1. Expand automation skills: Once basic conversation is working, you can return to the OpenClaw configuration interface and install more automation skills for it (for example, AI image generation, automated information gathering, etc.). It is strongly recommended to install only official or trusted third-party skill plugins to protect your API quota and data security.

CommandPurpose
openclaw gateway statusCheck gateway status
op