Integrations

OpenClaw

Run your always-on OpenClaw agent on MiniRouter models.

OpenClaw 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, with fallbacks and a hard spend cap for unattended hours.

1. Install OpenClaw

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

Then set up the Gateway.

Terminal
openclaw onboard --install-daemon

2. Save your key

Create a key, then add it to OpenClaw's global env file.

~/.openclaw/.env
MINIROUTER_KEY=mr-live-YOUR-KEY-HERE

3. Add the provider

~/.openclaw/openclaw.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
          }
        ]
      }
    }
  }
}

4. Restart and verify

Terminal
openclaw gateway restart
openclaw models status

Message the agent once, then open Activity. The request lists its model, tokens and exact cost.

Add more models

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

~/.openclaw/openclaw.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" }
        ]
      }
    }
  }
}
minirouter/auto
A model Auto picks. Tool calls get a tool-capable one.
@preset/my-agent
Your saved preset, editable in the dashboard.

Copy rates for OpenClaw's cost field from each model page.

Switch models

/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.

Terminal
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

OpenClaw's cost figures come from the cost you configure. Your real charge is in Usage.

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.

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.

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.

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.

Every error code, with its fix: Errors.

Next steps

Esc