Coding agents

OpenClaw

Connect OpenClaw to RealRelay.ai as a custom OpenAI-compatible provider: install it, add a models.providers entry, check the Gateway sees it and choose models.

Protocol
OpenAI Chat Completions
Base URL
https://www.realrelay.ai/v1
Official docs
docs.openclaw.ai
Checked against the tool’s docs
2026-10
Experimental. Not yet run end to end against RealRelay.ai. The steps follow the tool’s own documentation; if one fails, contact support with the error.

Overview

OpenClaw is a self-hosted assistant. A background process called the Gateway runs on your own machine, keeps memory and sessions there, and answers you through the dashboard or chat apps you connect. RealRelay.ai is not one of its built-in providers, so you add it as a custom provider that uses the OpenAI Chat Completions API (/v1/chat/completions).

  • An API key from the API keys page of the console.

  • The base URL with /v1 at the end. OpenClaw adds /chat/completions to it.

  • A model ID exactly as GET /v1/models lists it, for example z-ai/glm-5.2. Pick one that supports tool calling.

This setup follows OpenClaw's documentation but has not yet been run end to end against RealRelay.ai. Run the checks under Verify before you rely on it.

Install

Use OpenClaw's installer. It installs Node.js if it is missing, installs OpenClaw, and then starts the setup wizard. You can finish the wizard with any provider and switch to RealRelay.ai afterwards, or close it and follow the next section.

macOS · Linux · WSL2
curl -fsSL https://openclaw.ai/install.sh | bash
Windows PowerShell
iwr -useb https://openclaw.ai/install.ps1 | iex

OpenClaw also ships a Windows desktop app, the Windows Hub. Its download links are on the install page.

npm (Node.js 24.16+)
npm install -g openclaw@latest --allow-scripts=openclawopenclaw onboard --install-daemon

On npm 11.15 or older, leave out --allow-scripts=openclaw.

--install-daemon installs the Gateway as a background service, so it keeps running after you close the terminal.

Configure

You can edit the config file yourself, which gives you full control over the model list, or let the setup wizard write it.

  1. 1

    Store the key where the Gateway can read it

    The Gateway runs as a background service and does not see variables you export in a terminal. Put the key in OpenClaw's own environment file instead. Replace sk-*** with your key.

    ~/.openclaw/.env
    REALRELAY_API_KEY=sk-***
  2. 2

    Add the provider

    Merge this into ~/.openclaw/openclaw.json. The file is JSON5, so comments and trailing commas are allowed. Keep the other settings the wizard wrote.

    ~/.openclaw/openclaw.json
    1{2  models: {3    mode: "merge",4    providers: {5      realrelay: {6        baseUrl: "https://www.realrelay.ai/v1",7        apiKey: "${REALRELAY_API_KEY}",8        api: "openai-completions",9        models: [10          {11            id: "z-ai/glm-5.2",12            name: "z-ai/glm-5.2",13            reasoning: false,14            input: ["text"],15            contextWindow: 200000,16            maxTokens: 32768,17          },18        ],19      },20    },21  },22  agents: {23    defaults: {24      model: { primary: "realrelay/z-ai/glm-5.2" },25    },26  },27}
  3. 3

    Restart the Gateway

    The Gateway watches the config file and applies most changes by itself. It reads the environment file when it starts, so restart it once after adding the key.

    Terminal
    openclaw gateway restart

Run openclaw onboard and choose the custom provider option, or pass everything at once. With --secret-input-mode ref the wizard stores a reference to CUSTOM_API_KEY instead of the key itself.

Terminal
1export CUSTOM_API_KEY="sk-***"2openclaw onboard --non-interactive --accept-risk \3  --auth-choice custom-api-key \4  --custom-base-url "https://www.realrelay.ai/v1" \5  --custom-model-id "z-ai/glm-5.2" \6  --custom-compatibility openai \7  --custom-text-input \8  --secret-input-mode ref

Then add the same variable to the environment file, so the background Gateway can resolve it, and restart the Gateway. The wizard chooses the provider name itself; openclaw models list shows it.

~/.openclaw/.env
CUSTOM_API_KEY=sk-***
  • realrelay is the provider name. You can choose another, but it must match the prefix in agents.defaults.model.primary.

  • mode: "merge" adds RealRelay.ai next to OpenClaw's built-in providers instead of replacing them.

  • "${REALRELAY_API_KEY}" is read from the environment when the Gateway loads the config, so the key never sits in openclaw.json.

  • api: "openai-completions" sends Chat Completions requests. Leave it as is: most models on RealRelay.ai are served on that endpoint only.

  • contextWindow and maxTokens tell OpenClaw how much the model can take and return. RealRelay.ai does not report these, so set them from the model's catalog page. The values shown are safe for z-ai/glm-5.2.

  • The primary model has to appear in the provider's models list. Listing it only under agents.defaults.models does not make it available.

Verify

  1. 1

    Call the endpoint directly

    Run this with your key. A JSON reply with a choices array means the address, key and model work.

    Terminal
    1curl -sS "https://www.realrelay.ai/v1/chat/completions" \2  -H "Authorization: Bearer sk-***" \3  -H "content-type: application/json" \4  -d '{"model": "z-ai/glm-5.2", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with OK"}]}'
  2. 2

    Check the Gateway and the model list

    openclaw gateway status should report a running Gateway. openclaw models status shows the default model, which should start with realrelay/, and openclaw models list should include your model. openclaw dashboard opens the dashboard in your browser.

    Terminal
    1openclaw gateway status2openclaw models status3openclaw models list4openclaw dashboard
  3. 3

    Send a message

    In the dashboard chat, send a short message. A reply confirms the whole path, and the request appears in the console's usage logs.

Models

In a chat, /model followed by a model reference switches the current session. To change the default for new sessions, use openclaw models set. A reference is the provider name, a slash, then the full RealRelay.ai model ID, so it contains two slashes.

OpenClaw chat
/model realrelay/z-ai/glm-5.2
Terminal
openclaw models set realrelay/z-ai/glm-5.2

OpenClaw only offers models you have listed under the provider. Add one entry per model you want, each with its own limits:

~/.openclaw/openclaw.json → models.providers.realrelay.models
{ id: "z-ai/glm-5.2", name: "z-ai/glm-5.2", contextWindow: 200000, maxTokens: 32768 },{ id: "deepseek/deepseek-v4-pro", name: "deepseek/deepseek-v4-pro", contextWindow: 200000, maxTokens: 32768 },

If you leave out contextWindow, OpenClaw assumes 200,000 tokens. If you leave out maxTokens, it sends no output limit and the model's default applies. Which models suit an agent is covered under Choosing a model.

Troubleshooting

  • 401 or "Invalid token". The Gateway cannot see the key. Check that it is in ~/.openclaw/.env, not only exported in your terminal, and restart the Gateway. A .env file in your working directory does not count: OpenClaw ignores provider keys there.

  • 404. The baseUrl is missing /v1, or already ends in /chat/completions. It should end in /v1 and nothing else.

  • "Unknown model" or the default is not used. The prefix of primary does not match the provider name, or the model is missing from the provider's models list. Model IDs are case-sensitive.

  • A session keeps the old model after you change the default. Existing sessions stay on the model they started with. Run /model default in that session.

  • 400 mentioning reasoning_effort on a model you marked reasoning: true. Turn that field off for the model:

    ~/.openclaw/openclaw.json → models.providers.realrelay.models
    1{2  id: "z-ai/glm-5.2",3  reasoning: true,4  compat: { supportsReasoningEffort: false },5},
  • Context errors on long chats. contextWindow is larger than the model's real limit. Lower it to the value on the model's catalog page.

  • Nothing obvious in the dashboard. Stop the background service with openclaw gateway stop, then run the Gateway in the foreground to watch its log. Start the service again with openclaw gateway start when you are done.

    Terminal
    openclaw gateway --port 18789