Add one custom provider to openclaw.json and OpenClaw runs on apimodels — Claude, GPT and Gemini behind a single pay-as-you-go key, no per-vendor subscriptions. About 3 minutes.
| Field | Valor |
|---|---|
| baseUrl | https://api.apimodels.app/v1 |
| api | openai-completions |
| apiKey | Your apimodels API Key (reference it via an env var) |
| Model allowlist | Every model you want must be listed in the models array |
export APIMODELS_API_KEY="sk_…your_apimodels_key…"The config references it as ${APIMODELS_API_KEY}, keeping the key itself out of openclaw.json — that file gets pasted wholesale into help threads all the time; don’t let your key travel with it.
// ~/.openclaw/openclaw.json
{
"agents": {
"defaults": {
"model": { "primary": "apimodels/claude-opus-4-8" }
}
},
"models": {
"mode": "merge",
"providers": {
"apimodels": {
"baseUrl": "https://api.apimodels.app/v1",
"apiKey": "${APIMODELS_API_KEY}",
"api": "openai-completions",
"timeoutSeconds": 300,
"models": [
{
"id": "claude-opus-4-8",
"name": "Claude Opus 4.8",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "gpt-5-5",
"name": "GPT-5.5",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
},
{
"id": "gemini-3-pro-preview",
"name": "Gemini 3 Pro",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}
}curl -s https://api.apimodels.app/v1/chat/completions \
-H "Authorization: Bearer $APIMODELS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 16,
"messages": [{ "role": "user", "content": "Reply with exactly: ok" }]
}'A response containing "ok" means you are through — this hits the same baseUrl over the same OpenAI-compatible wire as the config. Then restart OpenClaw to pick up the change.
| model not allowed | The model is not in the allowlist. Add it to the provider’s models array; the id must match our model name byte-for-byte. |
| 401 / Invalid API key | The env var is not visible to the OpenClaw process (restart it after editing your shell config), or the key is wrong. Verify the key alone with the curl above. |
| Tool calls stall / files never change | You picked a model without tool capability. Use the three models in the example above — function calling is verified on all of them. |
| Prefer the Anthropic-native wire | OpenClaw also supports api: "anthropic-messages" (our /v1/messages endpoint is live too). Unless you have a specific reason, stick with openai-completions — one provider entry covers Claude, GPT and Gemini together. |