Let an AI agent do it
Already use an AI coding agent (any one: Codex, OpenCode, Cursor, another assistant)? Copy this prompt, paste it into that agent and press Enter. It installs OpenClaw, writes the settings, saves your key and tests everything. It will ask you for your API key.
See what the prompt says
# Task: connect OpenClaw to AllModelAPI
You are a coding agent on my computer. Set up **OpenClaw** so it uses **AllModelAPI** as its model provider. Work step by step, tell me briefly what you are doing, and ask me before doing anything not listed here.
## Facts
- Service: AllModelAPI, an API gateway for DeepSeek, Qwen, GLM, Kimi and MiniMax models.
- OpenClaw talks to it with the Chat Completions API.
- Base URL: `https://api.allmodelapi.com/v1`
- Main model: `deepseek-v4-pro` (DeepSeek V4 Pro, 1000K context). Fast background model: `deepseek-flash`.
- Model IDs are case-sensitive. Full list: https://api.allmodelapi.com/v1/models
- API key: not included. **Ask me to paste my AllModelAPI API key** (I can create one at https://allmodelapi.com/customer/api-keys).
- Human guide: https://allmodelapi.com/documentation/openclaw
## Steps
1. Detect my operating system (macOS, Linux or Windows) and shell.
2. Check whether OpenClaw is installed: `openclaw --version`. If it is not, install it with the official command:
- macOS: `curl -fsSL https://openclaw.ai/install.sh | bash`
- Linux: `curl -fsSL https://openclaw.ai/install.sh | bash`
- Windows (PowerShell): `iwr -useb https://openclaw.ai/install.ps1 | iex`
3. Settings file location:
- macOS / Linux: `~/.openclaw/openclaw.json`
- Windows: `%USERPROFILE%\.openclaw\openclaw.json`
4. If the file exists, copy it to `<file>.bak` first. If it contains other settings, **merge**: keep everything unrelated and only add or replace the keys shown below. If it does not exist, create it with exactly this content:
```json
{
"agents": {
"defaults": {
"model": {
"primary": "allmodelapi/deepseek-v4-pro"
}
}
},
"models": {
"mode": "merge",
"providers": {
"allmodelapi": {
"baseUrl": "https://api.allmodelapi.com/v1",
"apiKey": "${ALLMODELAPI_API_KEY}",
"api": "openai-completions",
"models": [
{
"id": "deepseek-v4-pro",
"name": "DeepSeek V4 Pro",
"contextWindow": 1000000,
"maxTokens": 131072
},
{
"id": "qwen4-max",
"name": "Qwen 4 Max",
"contextWindow": 991808,
"maxTokens": 131072
},
{
"id": "glm-5.3",
"name": "GLM 5.3",
"contextWindow": 1000000,
"maxTokens": 128000
},
{
"id": "kimi-k3.1-pro",
"name": "Kimi K3.1 Pro",
"contextWindow": 1048576,
"maxTokens": 131072
},
{
"id": "deepseek-flash",
"name": "DeepSeek V4.1 Flash",
"contextWindow": 1000000,
"maxTokens": 131072
},
{
"id": "qwen3.7-plus",
"name": "Qwen 3.7 Plus",
"contextWindow": 1000000,
"maxTokens": 128000
},
{
"id": "qwen3.8-flash",
"name": "Qwen 3.8 Flash",
"contextWindow": 1000000,
"maxTokens": 128000
},
{
"id": "glm-5.3-flash",
"name": "GLM 5.3 Flash",
"contextWindow": 1000000,
"maxTokens": 128000
},
{
"id": "kimi-k3",
"name": "Kimi K3",
"contextWindow": 1048576,
"maxTokens": 131072
},
{
"id": "MiniMax-M3.1-Flash",
"name": "MiniMax M3.1 Flash",
"contextWindow": 1000000,
"maxTokens": 131072
}
]
}
}
}
}
```
5. API key: Add the line `ALLMODELAPI_API_KEY=<key>` to `~/.openclaw/.env` (`%USERPROFILE%\.openclaw\.env` on Windows). Replace an existing ALLMODELAPI_API_KEY line instead of adding a second one.
6. Verify. Run:
```
openclaw doctor
openclaw models list --provider allmodelapi
openclaw agent --local --model allmodelapi/deepseek-v4-pro --message "Reply with just: OK"
```
A short reply such as "OK" means it works. On 401 re-check the key; on 400 "unknown model" re-check the model ID; on 402 I need more credit.
7. Report: what you changed, where the backup is, and how I start OpenClaw.
## Rules
- Only touch the files named above. Do not remove other providers, models or settings.
- Never print my full API key in your replies or logs, and never put it in a git repository or project file.
- Use JSON that parses: no comments in JSON, no trailing commas.