integrations/coding agent/OpenClaw

OpenClaw + AIgateway

Add AIgateway as a custom OpenAI-compatible provider — one config block.

OpenClaw is a self-hosted CLI agent. It treats any OpenAI-compatible endpoint as a custom provider, so AIgateway drops in as the brain behind every OpenClaw agent — 1000+ models, one key. OpenClaw doesn't auto-discover models for a custom provider, so you list the slugs you want and pick a default; nothing else changes.

OpenClaw homepage →
Setup

Three steps or fewer.

STEP 01

Non-interactive: one onboard command

The fastest path — writes the provider and sets the default model in one shot, no editor. Pick a model spendable on the $5 signup credit (moonshot/kimi-k2.7-code) so the first call works before you top up. Compatibility stays openai (the default).

openclaw onboard \
  --auth-choice custom-api-key \
  --custom-provider-id aigateway \
  --custom-base-url https://api.aigateway.sh/v1 \
  --custom-api-key sk-aig-... \
  --custom-model-id moonshot/kimi-k2.7-code \
  --custom-compatibility openai
STEP 02

Or edit ~/.openclaw/openclaw.json directly

Declare the provider under models.providers, then point a default at it. Both halves are required — the provider entry registers the model with the runtime, agents.defaults.model.primary makes it the one OpenClaw runs. mode: "merge" preserves any providers you already have.

{
  "models": {
    "mode": "merge",
    "providers": {
      "aigateway": {
        "baseUrl": "https://api.aigateway.sh/v1",
        "apiKey": "${AIGATEWAY_API_KEY}",
        "api": "openai-completions",
        "models": [
          { "id": "moonshot/kimi-k2.7-code", "name": "Kimi K2.7 Code", "input": ["text"], "contextWindow": 262144 },
          { "id": "anthropic/claude-opus-4.7", "name": "Claude Opus 4.7", "input": ["text", "image"], "contextWindow": 200000 }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "aigateway/moonshot/kimi-k2.7-code" }
    }
  }
}
STEP 03

Add more models any time

OpenClaw won't pull our catalog on its own, so add the slugs you want to models[] (openai/gpt-5.4, google/gemini-3.1-pro, …). Switch the active model in-session with /model, or change primary. Every listed model is callable the moment your org has any balance.

Notes
  • There is no `openclaw config add --llms-txt` command — OpenClaw reads llms.txt as documentation, not as a provider feed. Register the provider with the onboard flags or the config block above.
  • Run the onboard command in the same shell where OpenClaw is installed (macOS/Linux/WSL2). The trailing \ is standard bash/zsh line-continuation and runs as one command — just don't leave a space after it. On Windows PowerShell, put it all on one line or swap \ for a backtick (`).
  • api: "openai-completions" maps to our /v1/chat/completions. The fully-qualified model id is provider-id/model-id — e.g. aigateway/moonshot/kimi-k2.7-code (OpenClaw splits on the first slash).
  • Registering the provider never needs a funded model — it writes config without any probe or test call. moonshot/kimi-k2.7-code is on the $5 signup-credit shortlist, so even a brand-new key can make its first request; any topup unlocks the full catalog.
  • For an always-on agent, mint a sub-account key from AIgateway so its long-running spend lands under its own cap and shows up tagged in your dashboard.
More integrations

Same key. Every other tool.