OpenClaw

OpenClaw is an open-source, self-hosted personal AI assistant. Add a custom provider to call models through ModelGo's OpenAI-compatible API.

Before you start

  • Install Node.js 22.22.3 or later.
  • Create an API key in the ModelGo Console.
  • Confirm a logical model name allowed for the API key in the Model Catalog.

1. Install OpenClaw

macOS / Linux

bash
curl -fsSL https://openclaw.ai/install.sh | bash

Windows PowerShell

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

Verify the installation:

bash
openclaw --version

2. Set the API key

OpenClaw can read a provider API key from an environment variable. Set your ModelGo API key as MODELGO_API_KEY:

macOS / Linux (zsh)

bash
echo 'export MODELGO_API_KEY="YOUR_MODELGO_API_KEY"' >> ~/.zshrc
source ~/.zshrc

For Bash, replace ~/.zshrc with ~/.bashrc or ~/.bash_profile.

Windows PowerShell

powershell
[Environment]::SetEnvironmentVariable("MODELGO_API_KEY", "YOUR_MODELGO_API_KEY", "User")
$env:MODELGO_API_KEY = [Environment]::GetEnvironmentVariable("MODELGO_API_KEY", "User")

3. Configure the ModelGo provider

Create and open the OpenClaw configuration file:

macOS / Linux

bash
mkdir -p ~/.openclaw
${EDITOR:-vi} ~/.openclaw/openclaw.json

Windows PowerShell

powershell
New-Item -ItemType Directory -Force "$env:USERPROFILE\.openclaw"
notepad "$env:USERPROFILE\.openclaw\openclaw.json"

Paste the following into openclaw.json, replacing YOUR_MODELGO_MODEL with a logical model name from the Model Catalog:

json
{
  "models": {
    "mode": "merge",
    "providers": {
      "modelgo": {
        "baseUrl": "https://api.modelgo.ai/v1",
        "apiKey": "${MODELGO_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "YOUR_MODELGO_MODEL",
            "name": "YOUR_MODELGO_MODEL",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 128000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "modelgo/YOUR_MODELGO_MODEL"
      }
    }
  }
}
SettingValue in ModelGo
baseUrlhttps://api.modelgo.ai/v1
apiKey${MODELGO_API_KEY}
apiopenai-completions
models[].idA ModelGo logical model name
agents.defaults.model.primarymodelgo/<logical-model-name>

4. Start and verify

Save the configuration and run:

bash
openclaw onboard --install-daemon

Check the active provider and model:

bash
openclaw models status

If the status is healthy, start the Gateway:

bash
openclaw gateway start

Send a simple message in OpenClaw, such as “Describe this project in three sentences.” A normal response confirms the ModelGo connection.

Troubleshooting

Model not found

Make sure models.providers.modelgo.models[].id matches the model name in agents.defaults.model.primary, which must use the modelgo/<model-name> format.

401 or authentication failed

Check that MODELGO_API_KEY exists in the current terminal and that apiKey is ${MODELGO_API_KEY} with no extra spaces.

403 or model unavailable

Confirm that the model ID is a logical ModelGo model allowed by the policy attached to the API key.

404 or incorrect endpoint path

Set baseUrl to https://api.modelgo.ai/v1; do not use a full /chat/completions URL. OpenClaw appends the path for openai-completions.

Gateway did not load the new configuration

Restart the Gateway after editing the file:

bash
openclaw gateway restart

Related docs