Use ApexApi in OpenClaw

OpenClaw runs chat agents across Discord, WhatsApp and Telegram. Point its model provider at ApexApi and the agents can use anything in our catalog.

1. Get your API key

Create a key in your dashboard. It starts with ak-.

2. Export your key

export APEXAPI_API_KEY=ak-your-key-here

3. Add ApexApi to openclaw.json

Edit ~/.openclaw/openclaw.json:

{
  "models": {
    "mode": "merge",
    "providers": {
      "apexapi": {
        "baseUrl": "https://api.apexapi.dev/v1",
        "apiKey": "${APEXAPI_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "anthropic/claude-sonnet-4.6",
            "name": "Claude Sonnet 4.6",
            "contextWindow": 200000,
            "maxTokens": 32000
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "apexapi/anthropic/claude-sonnet-4.6" }
    }
  }
}

The ID must match the catalog exactly, in provider/model format. Browse all IDs on the models page.

Copy each model's real context window from the models page so OpenClaw budgets prompts correctly.

4. Restart OpenClaw

Restart the OpenClaw service and your agents answer through ApexApi.

Troubleshooting

  • 401 Unauthorized: the key wasn't pasted correctly or has been revoked.
  • Model not found: the model ID doesn't match a catalog ID. Copy it verbatim from the models page.
  • Connection fails: make sure the base URL is exactly https://api.apexapi.dev/v1 (no trailing slash after v1) and your balance is positive.
  • Anything else: check the error codes reference; streaming and tool calling are fully supported on /v1/chat/completions.