---
title: "OpenClaw integration"
description: "Settings for using OpenClaw with MiniRouter."
canonical_url: "https://minirouter.sh/docs/integrations/openclaw"
markdown_url: "https://minirouter.sh/docs/integrations/openclaw.md"
last_updated: "2026-09-26"
---

# OpenClaw

Run your always-on OpenClaw agent on MiniRouter models.

[Get a key](https://minirouter.sh/key)

[OpenClaw](https://docs.openclaw.ai) is a personal agent that runs as a background Gateway and answers on chat apps. Register MiniRouter as a provider to run it on any model in the [catalog](https://minirouter.sh/models), with [fallbacks](https://minirouter.sh/docs/model-fallbacks) and a hard [spend cap](https://minirouter.sh/docs/rate-limits) for unattended hours.

> **Note:** OpenClaw refs are `provider/model` and split on the first `/`. Keep the `minirouter/` prefix, as in `minirouter/zai/glm-5.3-flash`.

## Quick start

### 1. Install OpenClaw

**macOS / Linux**

```sh
curl -fsSL https://openclaw.ai/install.sh | bash
```

**Windows**

```powershell
iwr -useb https://openclaw.ai/install.ps1 | iex
```

**npm**

```sh
npm install -g openclaw@latest --allow-scripts=openclaw
```

Then set up the Gateway.

```sh
openclaw onboard --install-daemon
```

### 2. Save your key

[Create a key](https://minirouter.sh/key), then add it to OpenClaw's global env file.

```sh
MINIROUTER_KEY=mr-live-YOUR-KEY-HERE
```

> **Tip:** Give the agent its own key with a daily cap. A retry loop then stops at the cap, not at your balance.

### 3. Add the provider

```json
{
  agents: {
    defaults: {
      model: { primary: "minirouter/zai/glm-5.3-flash" }
    }
  },
  models: {
    providers: {
      minirouter: {
        baseUrl: "https://api.minirouter.sh/v1",
        apiKey: "${MINIROUTER_KEY}",
        api: "openai-completions",
        timeoutSeconds: 300,
        // cost is OpenClaw's own accounting field, in USD per million
        // tokens. Copy the current rates for each model you add from
        // https://minirouter.sh/models rather than leaving these stale.
        models: [
          {
            id: "zai/glm-5.3-flash",
            name: "GLM 5.3 Flash (minirouter)",
            reasoning: true,
            input: ["text", "image"],
            cost: { input: 0.1575, output: 0.525 },
            contextWindow: 1000000,
            maxTokens: 131000
          }
        ]
      }
    }
  }
}
```

> **Warning:** OpenClaw runs only models listed under `models.providers.minirouter.models`. Add each one before selecting it.

### 4. Restart and verify

```sh
openclaw gateway restart
openclaw models status
```

Message the agent once, then open [Activity](https://minirouter.sh/dashboard/activity). The request lists its model, tokens and exact cost.

## Add more models

List every model the agent may use, including routers and presets.

```json
{
  models: {
    providers: {
      minirouter: {
        models: [
          { id: "zai/glm-5.3-flash", name: "GLM 5.3 Flash" },
          { id: "openai/gpt-5.6-luna", name: "GPT-5.6 Luna" },
          { id: "minirouter/auto", name: "MiniRouter Auto" },
          { id: "@preset/my-agent", name: "My preset" }
        ]
      }
    }
  }
}
```

| Model ID | Answers with |
| --- | --- |
| `minirouter/auto` | A model [Auto](https://minirouter.sh/docs/auto-router) picks. Tool calls get a tool-capable one. |
| `@preset/my-agent` | Your saved [preset](https://minirouter.sh/docs/presets), editable in the [dashboard](https://minirouter.sh/dashboard/presets). |

Copy rates for OpenClaw's `cost` field from each [model page](https://minirouter.sh/models/zai/glm-5.3-flash).

## Switch models

| Command | Scope |
| --- | --- |
| `/model minirouter/openai/gpt-5.6-luna` | This chat session. |
| `/model minirouter/openai/gpt-5.6-luna -g` | The global default. |
| `openclaw models set minirouter/zai/glm-5.3-flash` | Agent default, from the shell. |
| `openclaw models fallbacks add minirouter/openai/gpt-5.6-luna` | Next model when the primary fails. |

## Run headless

`openclaw agent exec` runs one task without a Gateway, against your normal config. It exits `0` on success.

```sh
openclaw agent exec "Summarize today's unread email" \
  --model minirouter/zai/glm-5.3-flash \
  --fallback minirouter/openai/gpt-5.6-luna \
  --json
```

## Keep spend in check

- [Own key](https://minirouter.sh/dashboard/keys): One key for this agent.
- [Spend cap](https://minirouter.sh/docs/rate-limits): Daily or monthly limit on that key.
- **Utility model**: Set `agents.defaults.utilityModel` to a cheaper MiniRouter model for titles and recaps.
- [Activity](https://minirouter.sh/dashboard/activity): Every request and its cost.

OpenClaw's cost figures come from the `cost` you configure. Your real charge is in [Usage](https://minirouter.sh/dashboard/usage).

## Recommended models

| Model | Why |
| --- | --- |
| [`zai/glm-5.3-flash`](https://minirouter.sh/models/zai/glm-5.3-flash) | Strong agentic performance at a low input rate for repeated tool schemas. |
| [`openai/gpt-5.6-luna`](https://minirouter.sh/models/openai/gpt-5.6-luna) | Low-cost, high-intelligence alternative for routine agent turns. |
| [`deepseek/deepseek-v4-flash-0731`](https://minirouter.sh/models/deepseek/deepseek-v4-flash-0731) | Lowest input rate among the high-scoring long-context candidates. |
| [`tencent/hy3`](https://minirouter.sh/models/tencent/hy3) | Lower-capability fallback with inexpensive input for high-volume loops. |

Browse every model in the [catalog](https://minirouter.sh/models).

## Troubleshooting

### Provider loads but every model call 404s

Paste https://api.minirouter.sh/v1 complete, including the /v1. These clients treat the base URL as the OpenAI-compatible root and append /chat/completions themselves, so trimming the /v1 leaves them calling a path that does not exist.

Error: [400 `invalid_request`](https://minirouter.sh/docs/errors#invalid_request).

### Model not found, or "not allowed by agents.defaults.modelPolicy.allow"

Add the model to models.providers.minirouter.models with a matching id. If modelPolicy.allow is set, add minirouter/* to it. Refs are provider/author/name, e.g. minirouter/zai/glm-5.3-flash.

### Credits gone overnight with nothing to show

An agent in a retry loop spends at machine speed. Set dailyLimitNano on the key the agent uses — one key per agent, so a runaway is contained to that key rather than the whole balance.

Error: [402 `insufficient_credits`](https://minirouter.sh/docs/errors#insufficient_credits).

### 401 on every request

Wrong or rotated key. Keys start with mr-live-; after a rotation the old key keeps working for 24 hours, then dies.

Error: [401 `invalid_api_key`](https://minirouter.sh/docs/errors#invalid_api_key).

### The agent goes quiet mid-conversation in a chat channel

The balance reached $0 mid-stream. The stream ends with a terminal error naming the exact charge for tokens already delivered — but you are reading it inside WhatsApp or Telegram, where there is no UI but the message itself, which is why that error carries a URL.

Error: [402 `insufficient_credits`](https://minirouter.sh/docs/errors#insufficient_credits).

Every error code, with its fix: [Errors](https://minirouter.sh/docs/errors).

## Next steps

- [Guardrails](https://minirouter.sh/docs/guardrails): Budgets and model lists per key.
- [Rate limits](https://minirouter.sh/docs/rate-limits): Cap spend and requests per key.
- [Personal agents](https://minirouter.sh/use/personal-agents): Models and spend for always-on agents.
