> ## Documentation Index
> Fetch the complete documentation index at: https://docs.redpill.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenClaw

> Use RedPill as the main model provider for OpenClaw

OpenClaw supports named OpenAI-compatible providers in its gateway configuration.

## Configure

Export the key where the OpenClaw gateway process can read it:

```bash theme={null}
export REDPILL_AI_API_KEY="YOUR_API_KEY"
```

Merge this provider into `~/.openclaw/openclaw.json`:

```json5 ~/.openclaw/openclaw.json theme={null}
{
  agents: {
    defaults: {
      model: { primary: "redpill/z-ai/glm-5.2" },
    },
  },
  models: {
    mode: "merge",
    providers: {
      redpill: {
        baseUrl: "https://api.redpill.ai/v1",
        apiKey: "${REDPILL_AI_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "z-ai/glm-5.2",
            name: "GLM 5.2",
            reasoning: true,
            input: ["text"],
            contextWindow: 1048576,
            maxTokens: 131072,
          },
        ],
      },
    },
  },
}
```

Keep existing agent, channel, tool, and provider settings when merging this block.

## Validate

```bash theme={null}
openclaw config validate
openclaw models list
```

Confirm that `redpill/z-ai/glm-5.2` appears, then run one harmless tool task before allowing
unattended work. The gateway hot-applies model configuration by default; restart it only when config
watching is disabled.

## Privacy and rollback

This changes OpenClaw's main model loop. Image, speech, embedding, search, browser, and other
specialized providers remain separate.

For confidential-only routing, change `baseUrl` to `https://tee.redpill.ai/v1` and select an
`is_tee: true` model. To roll back, first restore `agents.defaults.model.primary`, then remove
`models.providers.redpill`.

## Troubleshooting

| Symptom                   | Check                                                                               |
| ------------------------- | ----------------------------------------------------------------------------------- |
| Configuration is rejected | Run `openclaw config validate` and preserve JSON5 syntax.                           |
| RedPill model is missing  | Confirm `models.mode` is `merge` and list models again.                             |
| Key is unavailable        | Export `REDPILL_AI_API_KEY` for the gateway process, not only an interactive shell. |

## References

* [OpenClaw model providers](https://docs.openclaw.ai/concepts/model-providers)
* [OpenClaw configuration](https://docs.openclaw.ai/gateway/configuration)
* [RedPill model catalog](/api-reference/models)
