CometAPI × OpenClaw

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.

~/.openclaw/openclaw.json
# 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" }]
      }
    }
  }
}
00 — Start here

Guide scope
and prerequisites

Guide headline

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

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.

Quick commands
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.

01 — Provider setup notes

Why three providers
for one CometAPI key

API-shape based provider routing
OpenClaw routes by API compatibility (not vendor label alone), so use separate providers for openai-completions, anthropic-messages, and google-generative-ai.
Single key, multi-provider config
Keep a single COMETAPI_KEY and reuse it across cometapi-openai, cometapi-claude, and cometapi-google blocks. Use explicit provider/model references everywhere.
Current flow verification
Run onboarding once, restart gateway after changes, then validate with models status, provider-scoped models list, and doctor diagnostics.
02 — Wire it into OpenClaw

Install, onboard, configure,
verify, switch

Version-aware notes

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.

01 Install or update OpenClaw
Recommended: curl -fsSL https://openclaw.ai/install.sh | bash. Or npm install -g openclaw@latest if you keep a global npm install.
02 Run onboarding once
Run: openclaw onboard --install-daemon. In Model/Auth choose Skip for base install, keep default workspace unless needed, and let wizard finish daemon + health check.
03 Store COMETAPI_KEY
For daemon installs, append COMETAPI_KEY to ~/.openclaw/.env and chmod 600. Keep using shell/service secrets workflows if you already have one.
04 Add CometAPI providers in openclaw.json
Add cometapi-openai (openai-completions), cometapi-claude (anthropic-messages), and cometapi-google (google-generative-ai), then set primary to cometapi-claude/claude-sonnet-4-6.
05 Restart and verify
Run openclaw gateway restart, then openclaw models status, openclaw models list --provider cometapi-claude, and openclaw doctor. Expect no config schema/auth errors for CometAPI providers.
06 Switch models with provider/model
Set default with openclaw models set cometapi-claude/claude-sonnet-4-6. In chat, switch via /model cometapi-openai/gpt-5.4 or /model cometapi-google/gemini-3.1-pro-preview.
07 Optional clean reinstall
If repairing an older broken setup, stop gateway, remove ~/.openclaw, rerun onboarding, then re-apply CometAPI config. This resets local config, sessions, logs, and auth state.
Config snippet (merge into openclaw.json)
{
  "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.

03 — Reference pricing

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 tokensOutput / 1M tokensNote
Claude Opus 4.6$4.00$20.00From provided reference
MiniMax-M2.7$0.24$0.96From provided reference
GLM 5 Turbo$0.96$3.26From provided reference
GPT-5.4 pro$24.00$144From provided reference
Gemini 3.1 Pro$1.60$9.60From provided reference
qwen3.5-plus$0.32$1.92From provided reference
Usage cost illustration
Estimated from per-million-token rates versus an illustrative "official channel" reference—For understanding only, not a price guarantee. Always follow live pricing on the CometAPI site.
Rates synced with docs mindset
Input pricing
$4.00 / 1M
Output pricing
$20.00 / 1M
Auto-read from selected model configuration
CometAPI (1M in + 1M out)
$24.00
Official reference (same usage)
$30.00
Illustrative savings
$6.00
~20% below reference (illustrative)
04 — FAQ

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.