Configure
OpenClaw with
via CometAPI
Use CometAPI as a custom model provider for OpenClaw: one API, 500+ models, up to 20% off. This guide is aligned with the current OpenClaw onboarding flow (2026.3.8+) and covers install, provider config, verification, and model switching.
# Sample only—verify against your OpenClaw version before production
{
"agents": {
"defaults": {
"model": {
"primary": "cometapi-claude/claude-sonnet-4-6"
}
}
},
"models": {
"mode": "merge",
"providers": {
"cometapi-openai": {
"baseUrl": "https://api.cometapi.com/v1",
"apiKey": "${COMETAPI_KEY}",
"api": "openai-completions",
"models": [{ "id": "gpt-5.4", "name": "GPT-5.4" }]
},
"cometapi-claude": {
"baseUrl": "https://api.cometapi.com",
"apiKey": "${COMETAPI_KEY}",
"api": "anthropic-messages",
"models": [{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" }]
},
"cometapi-google": {
"baseUrl": "https://api.cometapi.com/v1beta",
"apiKey": "${COMETAPI_KEY}",
"api": "google-generative-ai",
"models": [{ "id": "gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro" }]
}
}
}
}Guide scope
and prerequisites
Configure OpenClaw with CometAPI
Use CometAPI as a custom model provider for OpenClaw to access 500+ models in one API, with up to 20% off on supported routes. This page follows the current OpenClaw onboarding flow (2026.3.8+).
Prerequisites
Node.js >= 22 and a CometAPI API Key are required. For daemon installs, store COMETAPI_KEY in ~/.openclaw/.env so openclaw.json can reference ${COMETAPI_KEY} without hardcoding secrets.
openclaw onboard --install-daemon openclaw gateway status openclaw dashboard printf 'COMETAPI_KEY=%s\n' 'your_cometapi_key' >> ~/.openclaw/.env chmod 600 ~/.openclaw/.env
After adding ~/.openclaw/.env or editing provider config, restart once with openclaw gateway restart, then run diagnostics. Use full provider/model refs in all commands and sessions. For version drift, re-check the Configuration Reference.
Why three providers
for one CometAPI key
Install, onboard, configure,
verify, switch
OpenClaw uses ~/.openclaw/openclaw.json as the source config you edit. Custom providers are materialized into per-agent models.json files under ~/.openclaw/agents/<agentId>/. Re-check keys and behavior after upgrades using the Configuration Reference and Environment Variables guides. Treat CometAPI base URLs as defined only in the live documentation.
{
"agents": {
"defaults": {
"model": {
"primary": "cometapi-claude/claude-sonnet-4-6"
}
}
},
"models": {
"mode": "merge",
"providers": {
"cometapi-openai": {
"baseUrl": "https://api.cometapi.com/v1",
"apiKey": "${COMETAPI_KEY}",
"api": "openai-completions",
"models": [{ "id": "gpt-5.4", "name": "GPT-5.4" }]
},
"cometapi-claude": {
"baseUrl": "https://api.cometapi.com",
"apiKey": "${COMETAPI_KEY}",
"api": "anthropic-messages",
"models": [{ "id": "claude-sonnet-4-6", "name": "Claude Sonnet 4.6" }]
},
"cometapi-google": {
"baseUrl": "https://api.cometapi.com/v1beta",
"apiKey": "${COMETAPI_KEY}",
"api": "google-generative-ai",
"models": [{ "id": "gemini-3.1-pro-preview", "name": "Gemini 3.1 Pro" }]
}
}
}
}Basic setup does not require manually creating auth-profiles.json. Use ${COMETAPI_KEY} in providers and inject the variable through ~/.openclaw/.env, shell, or service manager.
Live rates live
on the CometAPI site
The table below uses illustrative per-million-token numbers. Model catalog, discounts, and SLAs are whatever CometAPI's docs and console show right now.
| Model (sample) | Input / 1M tokens | Output / 1M tokens | Note |
|---|---|---|---|
| Claude Opus 4.6 | $4.00 | $20.00 | From provided reference |
| MiniMax-M2.7 | $0.24 | $0.96 | From provided reference |
| GLM 5 Turbo | $0.96 | $3.26 | From provided reference |
| GPT-5.4 pro | $24.00 | $144 | From provided reference |
| Gemini 3.1 Pro | $1.60 | $9.60 | From provided reference |
| qwen3.5-plus | $0.32 | $1.92 | From provided reference |
Check these
before you integrate
Do I need auth-profiles.json for this setup?
No for the basic setup. OpenClaw can resolve provider apiKey from models.providers.*.apiKey via ${COMETAPI_KEY}. Use auth-profiles.json only for per-profile stored secrets or rotation.
Why are there 3 provider entries for one vendor?
OpenClaw routes by API format compatibility. Keep separate entries for openai-completions, anthropic-messages, and google-generative-ai if you need all three API families.
Where is config actually edited and materialized?
Edit ~/.openclaw/openclaw.json. Custom providers are materialized into per-agent models.json under ~/.openclaw/agents/<agentId>/ after sync/load.
Which model IDs are used in this guide?
gpt-5.4, claude-sonnet-4-6, and gemini-3.1-pro-preview. You can add any model from the CometAPI models page to the matching provider block.