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
curl -fsSL https://openclaw.ai/install.sh | bashWindows PowerShell
iwr -useb https://openclaw.ai/install.ps1 | iexVerify the installation:
openclaw --version2. 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)
echo 'export MODELGO_API_KEY="YOUR_MODELGO_API_KEY"' >> ~/.zshrc
source ~/.zshrcFor Bash, replace ~/.zshrc with ~/.bashrc or ~/.bash_profile.
Windows 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
mkdir -p ~/.openclaw
${EDITOR:-vi} ~/.openclaw/openclaw.jsonWindows 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:
{
"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"
}
}
}
}| Setting | Value in ModelGo |
|---|---|
baseUrl | https://api.modelgo.ai/v1 |
apiKey | ${MODELGO_API_KEY} |
api | openai-completions |
models[].id | A ModelGo logical model name |
agents.defaults.model.primary | modelgo/<logical-model-name> |
4. Start and verify
Save the configuration and run:
openclaw onboard --install-daemonCheck the active provider and model:
openclaw models statusIf the status is healthy, start the Gateway:
openclaw gateway startSend 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:
openclaw gateway restartRelated docs
- First call: create an API key, find a model, and verify a ModelGo request.
- Authentication: learn how to use ModelGo API keys.
- OpenClaw custom provider docs: see provider, Base URL, and model list configuration.