Connect OpenClaw to GPTsAPI
GPTsAPI is compatible with OpenAI's /v1/chat/completions endpoint and connects to OpenClaw using the openai-completions API type.
Configuration steps
Sign up to GPTsAPI and create an API Key
Sign up or log in to GPTsAPI, top up your balance, then visit the API Keys page to create and copy your key. All tools share the same key.
Export your API Key as an environment variable
Save the key in your shell profile instead of hardcoding it in config files. If you manage Gateway with systemd, put it under Environment= in the service unit.
# ~/.bashrc or ~/.zshrc export GPTSAPI_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" source ~/.bashrcEdit openclaw.json
Add the gptsapi provider and model allowlist to
~/.openclaw/openclaw.json."defaults": { "model": { "primary": "gptsapi/claude-sonnet-5-5", "models": { "gptsapi/claude-sonnet-5-5": {} } }, "mode": "merge", "providers": { "gptsapi": { "baseUrl": "https://api.gptsapi.net/v1", "apiKey": "${GPTSAPI_KEY}", "api": "openai-completions", "models": [ { "id": "claude-sonnet-5-5", "name": "Claude Sonnet via gptsapi", "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 8192, "cost": { "input": 0.003, "output": 0.015, "cacheRead": 0, "cacheWrite": 0 } } ] } } }The cost field is only used for OpenClaw usage tracking; adjust it to match actual pricing.
Validate configuration
If gptsapi/claude-sonnet-5-5 appears in the output, your config is valid.
openclaw doctor openclaw models listRestart Gateway
After restarting, messages from all channels (WhatsApp, Telegram, Slack, etc.) will route through GPTsAPI.
openclaw gateway restart
Optional: Switch primary model
Switch the primary model from the CLI:
openclaw models set gptsapi/claude-sonnet-5-5Or send /model gptsapi/claude-sonnet-5-5 directly in chat.
Optional: Configure fallback
If you have keys from additional providers, you can define a fallback order so OpenClaw automatically tries the next provider on rate limits or outages.
Verify your connection
Send a message in any channel. Getting a reply confirms it works.
If there is no reply, check these items in order:
- Model missing from list → Ensure defaults.model.models or providers.gptsapi.models includes the exact GPTsAPI model id
- Model call rejected → Setting defaults.model.models enables allowlist mode and blocks unlisted models
- Environment variable not loaded → Make sure the Gateway process can read GPTSAPI_KEY, and run openclaw doctor first