Skip to main content

OpenClaw Setup on Windows with Custom Provider

1. Install OpenClaw

You can install OpenClaw using the official installer or via npm.

Windows (PowerShell)

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

macOS / Linux

curl -fsSL https://openclaw.ai/install.sh | bash
This installs OpenClaw and performs the initial setup automatically.

Option 2: Install via npm

Requires Node.js to be installed.
npm install -g openclaw

Verify Installation

openclaw --version
You should see the installed OpenClaw version displayed.

2. Locate the Configuration File

Open:
C:\Users\<username>\.openclaw\openclaw.json
or
notepad $env:USERPROFILE\.openclaw\openclaw.json
Replace the entire contents of openclaw.json with:
{
  "agents": {
    "defaults": {
      "workspace": "C:\\Users\\<username>\\.openclaw\\workspace",
      "models": {
        "znapai/gpt-5.3-codex": {
          "alias": "GPT"
        }
      },
      "model": {
        "primary": "znapai/gpt-5.3-codex"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "znapai": {
        "baseUrl": "https://api.znapai.com/v1",
        "apiKey": "${ZNAPAI_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "gpt-5.3-codex",
            "name": "GPT-5.3 Codex",
            "contextWindow": 128000,
            "maxTokens": 32000
          }
        ]
      }
    }
  },
  "gateway": {
    "mode": "local",
    "auth": {
      "mode": "token",
      "token": "hello"
    },
    "port": 18789,
    "bind": "loopback",
    "tailscale": {
      "mode": "off",
      "resetOnExit": false
    }
  }
}
If you need to add additional models, ensure you add them to both the agents.defaults.models object and the models.providers.znapai.models array in the JSON file using the same format as gpt-5.3-codex.

3. Configure API Key

Set the API key as an environment variable:

For Current PowerShell Session

$env:ZNAPAI_API_KEY="your-api-key"
Verify:
echo $env:ZNAPAI_API_KEY

Permanent Configuration

[Environment]::SetEnvironmentVariable(
  "ZNAPAI_API_KEY",
  "<your-api-key>",
  "User"
)
Open a new PowerShell window and verify:
echo $env:ZNAPAI_API_KEY

4. Validate Configuration

Get-Content $env:USERPROFILE\.openclaw\openclaw.json | ConvertFrom-Json
No output means the JSON is valid.

5. Start OpenClaw Gateway

openclaw gateway
Expected output:
[gateway] agent model: znapai/gpt-5.3-codex
[gateway] ready

6. Verify Gateway Health

Open another terminal:
openclaw gateway health
Expected:
Gateway Health
OK
Check status:
openclaw gateway status
Expected:
Listening: 127.0.0.1:18789

7. Launch OpenClaw

openclaw
OpenClaw Terminal
Initially, OpenClaw launches into Crestodian, the setup and troubleshooting assistant. Example:
Hi, I'm Crestodian.

- Start me when setup, config, Gateway, model choice, or agent routing feels off.
- Using: znapai/gpt-5.3-codex for fuzzy local planning.
Crestodian is not the main conversational agent. To switch to the actual chat agent, type:
talk to agent
Expected output:
Opening your normal agent TUI.
After switching, you can chat normally with the configured model.

Troubleshooting

JSON Syntax Error

Example:
"apiKey": "${ZNAPAI_API_KEY}"
"api": "openai-completions"
Missing comma. Correct:
"apiKey": "${ZNAPAI_API_KEY}",
"api": "openai-completions"

Unknown Model Error

Unknown model: znapai/gpt-5.3-codex
Ensure:
  • Provider name is znapai
  • Default model is znapai/gpt-5.3-codex
  • Model exists under models.providers.znapai.models[]

Gateway Start Blocked

Gateway start blocked: existing config is missing gateway.mode
Ensure:
"gateway": {
  "mode": "local"
}
exists in the configuration.