Setup Guideline

Manual setup · Windows and macOS

OpenClaw + Space Router

OpenClaw takes custom model providers in its own configuration file. Register Space Router once, point the default agent at it, and every agent you create afterwards inherits the route.

Gateway: https://space.stationine.com · Last checked:

Keep your API key private. Never share a real API key in screenshots, chat messages, repositories, project files, or public documents. If a key has been exposed, revoke or rotate it in Space Router and create a new one.

There is no one-command installer for OpenClaw. Install OpenClaw first by following its own documentation, then come back here to point it at the gateway.

Before you start

You need one Space Router API key, and the key's group decides which models it can call. Create it in the Space Router dashboard under API Keys → Create API Key, choosing the group that matches what you bought.

Key groupapi valueModel slugs
GPT (group 4) openai-completions gpt-6-astra, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, gpt-5.4, gpt-5.4-mini
Claude (group 3) anthropic-messages claude-opus-5, claude-sonnet-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6
Claude Fable 5 (group 5) anthropic-messages claude-fable-5

A key only works inside its own group. A Claude key asking for gpt-5.5, or a Claude key asking for claude-fable-5, gets a hard error rather than a fallback — Fable is a separate purchase. The live catalogue is published at /models.json.

Register the provider

Everything happens in one file, ~/.openclaw/openclaw.json. The whole edit is five steps:

  1. Stop OpenClaw

    Editing the file while it runs is fine, but it will not notice until it restarts, and a half-applied change is confusing to debug.

  2. Open the file

    Create it if it does not exist. It is a single JSON object; if it already has content, you are merging into that object rather than appending a second one.

    open ~/.openclaw/openclaw.json
  3. Add the models block for your key group

    Copy the block below that matches your key. The provider key — space-router — is the name you will refer to the models by, so keep it short.

  4. Add the agents block

    See Select the model. Both blocks are top-level keys of the same object — models and agents sit side by side.

  5. Save and restart OpenClaw

    Then run the check in Verify the connection.

Claude or Fable key

{
    "models": {
      "mode": "merge",
      "providers": {
        "space-router": {
          "baseUrl": "https://space.stationine.com",
          "apiKey": "sk-your-space-router-key",
          "api": "anthropic-messages",
          "models": [
            {
              "id": "claude-sonnet-5",
              "name": "Claude Sonnet 5",
              "contextWindow": 200000,
              "maxTokens": 64000
            }
          ]
        }
      }
    }
  }

GPT key

The OpenAI route needs the /v1 suffix on baseUrl, because OpenClaw appends /chat/completions itself.

{
    "models": {
      "mode": "merge",
      "providers": {
        "space-router": {
          "baseUrl": "https://space.stationine.com/v1",
          "apiKey": "sk-your-space-router-key",
          "api": "openai-completions",
          "models": [
            {
              "id": "gpt-5.6-sol",
              "name": "GPT 5.6 Sol",
              "contextWindow": 128000,
              "maxTokens": 32000
            }
          ]
        }
      }
    }
  }

"mode": "merge" keeps OpenClaw's built-in providers alongside yours; "replace" would drop them. Add one object to the models array for every slug you want to appear in the picker.

Set the context values explicitly. When OpenClaw cannot discover a model's limits, context-budget calculations fall back to 200000 tokens — which silently overestimates a smaller model and causes truncation failures mid-task. The numbers above are examples: set contextWindow and maxTokens to what your model and plan actually serve.

Select the model

Point the default agent at the new provider. The value is providerId/model-id, using the two identifiers exactly as you wrote them above.

{
    "agents": {
      "defaults": {
        "model": {
          "primary": "space-router/claude-sonnet-5"
        }
      }
    }
  }

Both blocks belong in the same openclaw.json object — merge them rather than pasting two separate top-level objects into the file.

baseUrl is also a trust decision

OpenClaw routes model requests through a guarded fetch path, and the baseUrl you configure is what allows that exact scheme://host:port origin through it. Nothing else is trusted as a side effect, which is why a typo in the host does not produce a fallback — it produces a blocked request.

Where the settings live

The main file is ~/.openclaw/openclaw.json. Per-agent overrides live at ~/.openclaw/agents/<agentId>/agent/models.json, and a non-empty baseUrl there takes precedence over the main file — so if your change appears to have no effect, check whether the agent has its own copy.

Verify the connection

Restart OpenClaw so it reloads the configuration, then send one short request such as Reply with OK. A reply proves the base URL, the key, the API format and the model id are all correct together. A config file that parses proves only that it parses.

Troubleshooting

What you seeWhat it means
401 or 403 The key is wrong, revoked, or out of balance. Re-copy it from the dashboard and check for a leading or trailing space.
404 Usually baseUrl and api disagree: /v1 with anthropic-messages, or the gateway root with openai-completions.
The model is not in the picker It has no entry in the provider's models array, or "mode": "replace" removed the list you expected to see.
The change had no effect OpenClaw was not restarted, or a per-agent models.json is overriding the main file.
Truncation or context errors mid-task contextWindow is missing or too large, so the budget fell back to 200000 tokens. Set it to the real limit.

What is Space Router?

Space Router is an AI API relay operated by Station Nine. Its base URL is https://space.stationine.com. It accepts Anthropic Messages requests at POST /v1/messages, OpenAI Chat Completions requests at POST /v1/chat/completions, and OpenAI Responses requests at POST /v1/responses, and it provides OpenAI GPT and Anthropic Claude model families. See the full Space Router overview for service and account details.