Skip to content
Connect a clientOpenClaw

OpenClaw

new

Local gateway assistant with a custom Guard provider.

Set up with your own AI
Model protocol

OpenClaw is a local gateway assistant: it installs on your own machine and decides for itself which model provider to call. A third-party address and key are described in its own configuration.

bash
npm install -g openclaw@latest --allow-scripts=openclaw

Settings live in ~/.openclaw/openclaw.json, JSON5 with comments, and the gateway re-reads the file on its own. Your address goes into the models.providers section: the baseUrl, apiKey and api fields plus a model list. The api field picks the protocol; without it openai-completions is used.

json5
// ~/.openclaw/openclaw.json
{
  models: {
    mode: "merge",
    providers: {
      guard: {
        baseUrl: "https://api.guardrelay.ai/v1",
        apiKey: "${GUARD_API_KEY}",
        api: "openai-completions",
        models: [{ id: "claude-sonnet-5", name: "Claude Sonnet 5" }],
      },
    },
  },
  agents: { defaults: { model: { primary: "guard/claude-sonnet-5" } } },
}
json5
// ~/.openclaw/openclaw.json
{
  models: {
    mode: "merge",
    providers: {
      guard: {
        baseUrl: "https://api.guardrelay.ai/v1",
        apiKey: "${GUARD_API_KEY}",
        api: "openai-completions",
        models: [{ id: "k3", name: "Kimi K3", maxTokens: 8192 }],
      },
    },
  },
  agents: { defaults: { model: { primary: "guard/k3" } } },
}
json5
// ~/.openclaw/openclaw.json
{
  models: {
    mode: "merge",
    providers: {
      guard: {
        baseUrl: "https://api.guardrelay.ai/v1",
        apiKey: "${GUARD_API_KEY}",
        api: "openai-completions",
        models: [{ id: "cursor-grok-4.6-medium", name: "Grok 4.6", maxTokens: 8192 }],
      },
    },
  },
  agents: { defaults: { model: { primary: "guard/cursor-grok-4.6-medium" } } },
}
json5
// ~/.openclaw/openclaw.json
{
  models: {
    mode: "merge",
    providers: {
      guard: {
        baseUrl: "https://api.guardrelay.ai/v1",
        apiKey: "${GUARD_API_KEY}",
        api: "openai-completions",
        models: [{ id: "composer-2.5", name: "Composer 2.5", maxTokens: 8192 }],
      },
    },
  },
  agents: { defaults: { model: { primary: "guard/composer-2.5" } } },
}

A model is named as a provider and model pair, so primary carries guard/ plus the exact id. The default can also be changed with openclaw models set guard/<exact id>, and openclaw models list shows what was picked up.

The contextWindow, cost, input and reasoning fields on a model are optional. Without contextWindow the window stays unknown and the client budgets against its own fallback, so it is better to state it. The key can stay as the ${GUARD_API_KEY} substitution: the value is then taken from the environment or from ~/.openclaw/.env.

The same key also works over the Anthropic Messages protocol: put anthropic-messages in api, and then write the address without /v1, because the client appends the version itself. For Guard the variant above is enough.

For Kimi keep openai-completions, and then /v1 in the address is required.

Documentation sections

On this page