# OpenClaw

Run OpenClaw on models you pay for in DA.

OpenClaw takes custom providers in `~/.openclaw/openclaw.json`. OpenDunes goes in as one, and OpenClaw sends each request to [`POST /v1/chat/completions`](/docs/reference/chat-completions).

1. [Install OpenClaw](#1-install-openclaw).
2. [Add OpenDunes as a provider](#2-add-opendunes-as-a-provider).
3. [Set the default model](#3-set-the-default-model).
4. [Check the setup](#4-check-the-setup).

## 1. Install OpenClaw

OpenClaw needs Node 24.16 or later.

| On | Install line |
|---|---|
| macOS, Linux, WSL | `curl -fsSL https://openclaw.ai/install.sh \| bash` |
| Windows, PowerShell | `iwr -useb https://openclaw.ai/install.ps1 \| iex` |

Create an API key for OpenClaw alone, and cap it on *API Keys* ([API keys](/docs/api-keys) shows how). Put it in your shell profile, `~/.zshrc` or `~/.bashrc`, as `export OPENDUNES_API_KEY="…"`.

## 2. Add OpenDunes as a provider

`openclaw.json` is JSON5: keys need no quotes, and a comment is allowed. Add OpenDunes under `models.providers`, with each model you want OpenClaw to offer:

```json5
{
  models: {
    mode: "merge",
    providers: {
      opendunes: {
        baseUrl: "https://opendunes.com/v1",
        apiKey: "${OPENDUNES_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "anthropic/claude-sonnet-4.5",
            name: "Claude Sonnet 4.5",
            input: ["text", "image"],
            contextWindow: 1000000,
            maxTokens: 64000,
          },
          {
            id: "anthropic/claude-opus-5.5",
            name: "Claude Opus 5.5",
            input: ["text", "image"],
            contextWindow: 1000000,
            maxTokens: 128000,
          },
        ],
      },
    },
  },
}
```

| Key | Holds |
|---|---|
| `baseUrl` | the address, with `/v1` |
| `apiKey` | `${OPENDUNES_API_KEY}`: OpenClaw reads the key from the environment, and the file never holds it |
| `api` | `openai-completions`: the chat completions shape |
| `models[].id` | the model ID, as it stands in [Models](/docs/models) |
| `contextWindow`, `maxTokens` | how much the model reads and writes, from its page in Models |
| `mode` | `merge`: OpenDunes joins the providers OpenClaw already knows |

## 3. Set the default model

A model is named by the provider, a slash, then its ID. In the same file, add:

```json5
{
  agents: {
    defaults: {
      model: {
        primary: "opendunes/anthropic/claude-sonnet-4.5",
      },
    },
  },
}
```

`openclaw models set opendunes/anthropic/claude-opus-5.5` switches the default later without editing the file. Each model is charged at its own rate, shown on its page in Models.

## 4. Check the setup

```bash
openclaw models list --provider opendunes
openclaw models status
```

The list shows the models you added; `models status` shows the default model and whether its key is set. Start OpenClaw with `openclaw`, send one short task, then open *Activity*, in the app on opendunes.com: the request is there, with its charge in DA.

<div class="watch-out">
<p>If <code>OPENDUNES_API_KEY</code> is not set where OpenClaw runs, <code>${OPENDUNES_API_KEY}</code> stays as it is and OpenClaw warns: requests then get a 401. A service started at login does not read your shell profile.</p>
</div>

## Errors

| Status | Means | Do |
|---|---|---|
| 401 | the key is missing, wrong, paused, revoked or expired | check `OPENDUNES_API_KEY` where OpenClaw runs |
| 402 | the balance is at zero or below, cannot pay the request's hold, or the key's cap is spent | make a deposit, or raise the cap |
| 404 | the model ID is not on sale | copy the ID from Models into `models[].id` |

Every other status: [Errors and retries](/docs/errors-and-retries). Other terminal agents: [Coding agents](/docs/coding-agents).

Next: [OpenCode](/docs/cookbook/opencode) · [Hermes Agent](/docs/cookbook/hermes-agent)
