OpenClaw adds OpenAI- or Anthropic-compatible gateways through models.providers. This guide follows the current OpenClaw model provider documentation.
Install
macOS, Linux, or WSL:
curl -fsSL https://openclaw.ai/install.sh | bash
Windows PowerShell:
iwr -useb https://openclaw.ai/install.ps1 | iex
After onboarding, verify the installation:
openclaw --version
openclaw doctor
openclaw gateway status
Configure OpenAI-compatible models
Set the key in the environment that starts the Gateway:
export NBILITY_API_KEY="YOUR_API_KEY"
Edit ~/.openclaw/openclaw.json:
{
"models": {
"mode": "merge",
"providers": {
"nbility": {
"baseUrl": "https://api.nbility.ai/v1",
"apiKey": "${NBILITY_API_KEY}",
"api": "openai-completions",
"models": [
{ "id": "gpt-5.4", "name": "GPT-5.4" },
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" }
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "nbility/gpt-5.4",
"fallbacks": ["nbility/claude-sonnet-4-6"]
}
}
}
}
This uses Chat Completions compatibility for a mixed model catalog. Use Models as the source of truth for IDs.
Use native Claude format
To explicitly use Anthropic Messages, define a separate provider:
{
"models": {
"mode": "merge",
"providers": {
"nbility-claude": {
"baseUrl": "https://api.nbility.ai",
"apiKey": "${NBILITY_API_KEY}",
"api": "anthropic-messages",
"models": [
{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" }
]
}
}
},
"agents": {
"defaults": {
"model": { "primary": "nbility-claude/claude-sonnet-4-6" }
}
}
}
The Anthropic Base URL omits /v1; the OpenAI-compatible Base URL includes it.
Capability metadata
Custom models default to text-only. Declare image input only for a verified vision model:
{ "id": "YOUR_VISION_MODEL", "name": "Vision Model", "input": ["text", "image"] }
contextWindow, maxTokens, reasoning, and cost are optional. Add them only when their values are verified.
Apply and troubleshoot
openclaw models list
openclaw models set nbility/gpt-5.4
openclaw doctor
openclaw gateway restart
openclaw gateway status
401: the Gateway service process, not only your interactive shell, must receiveNBILITY_API_KEY.- Model missing: a custom provider needs a non-empty
modelslist and matchingprovider/modelreferences. - Image rejected: add
input: ["text", "image"]only to a vision-capable model. - Config unchanged: run
openclaw doctor, restart the Gateway, and remove duplicate provider definitions. 404: check theapiand Base URL combination, especially/v1for Anthropic format.
Do not put the real key directly in JSON. Environment interpolation reduces accidental exposure; production deployments can use OpenClaw SecretRef.