aimldocs
Integrations

OpenClaw

Add ai.ml to OpenClaw as a custom model provider.

OpenClaw supports custom model providers. This guide uses its OpenAI Chat Completions client against /v1/chat/completions.

With the CLI

npx @aiml/cli setup openclaw

By hand

Merge this into ~/.openclaw/openclaw.json (or $OPENCLAW_CONFIG_PATH):

cookbook/integrations/openclaw/openclaw.json
{
  "models": {
    "mode": "merge",
    "providers": {
      "aiml": {
        "baseUrl": "https://api.ai.ml/v1",
        "apiKey": "${AIML_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "anthropic/claude-sonnet-4.6",
            "name": "anthropic/claude-sonnet-4.6"
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "aiml/anthropic/claude-sonnet-4.6"
      }
    }
  }
}

Put the key in ~/.openclaw/.env. The config refers to it as ${AIML_API_KEY}, so it never sits in the config file itself:

cookbook/integrations/openclaw/openclaw.env
AIML_API_KEY="aiml-live-…"
  • OpenClaw validates its config strictly, and a key it does not know stops its gateway. Run openclaw config validate after editing.
  • models.mode: "merge" keeps OpenClaw's built-in providers alongside this one.
  • Model references are aiml/<model id>, so aiml/anthropic/claude-sonnet-4.6. Add more entries under models, with contextWindow and maxTokens taken from GET /v1/models.
  • If your config file has comments, aiml setup leaves it alone and prints the block to add by hand. Rewriting the file would lose the comments.

Verified with OpenClaw 2026.9.7.

On this page