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

# openclaw

[OpenClaw](https://github.com/openclaw/openclaw) is an open-source personal AI agent that runs on your own devices and bridges chat apps (WhatsApp, Telegram, Slack, Discord, iMessage, and more) to a model through a local gateway. It speaks any OpenAI-compatible endpoint, so it can run entirely against local Bonsai — no data leaves your machine.

## Step 1: Serve Bonsai

<CodeGroup>
  ```bash Demo repo server theme={null}
  ./scripts/start_llama_server.sh
  # Base URL: http://localhost:8080/v1
  ```

  ```bash MLX server (Apple Silicon) theme={null}
  ./scripts/start_mlx_server.sh
  # Base URL: http://localhost:8081/v1
  ```
</CodeGroup>

Agentic use stresses tool calling and multi-step instructions; prefer [Bonsai 27B](/models/bonsai-27b) (native tool calling, on by default) or ternary 8B if memory is tight — see [which model for agents](/integrations/overview#which-model-for-agents).

## Step 2: Install OpenClaw

```bash theme={null}
curl -fsSL https://openclaw.ai/install.sh | bash
```

This detects your OS, installs Node if needed, installs OpenClaw, and launches onboarding. See the [install docs](https://docs.openclaw.ai/install) for Windows, Docker, and other options.

## Step 3: Point it at Bonsai

Bonsai's server is a generic OpenAI-compatible endpoint, so configure it as a custom local provider rather than picking a named one. Edit your OpenClaw config (`openclaw config edit`) and add:

```json5 theme={null}
{
  agents: {
    defaults: {
      model: { primary: "bonsai/local-model" },
    },
  },
  models: {
    mode: "merge",
    providers: {
      bonsai: {
        baseUrl: "http://localhost:8080/v1",
        apiKey: "not-needed",
        api: "openai-completions",
        models: [
          {
            id: "local-model",
            name: "Bonsai (local)",
            reasoning: false,
            input: ["text", "image"],
            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
            contextWindow: 262144,
            maxTokens: 8192,
          },
        ],
      },
    },
  },
}
```

* `input: ["text", "image"]` applies to [Bonsai 27B](/models/bonsai-27b); drop `"image"` for the text-only 8B/4B/1.7B sizes.
* `contextWindow` should match whatever you pass to `-c` when starting the server (or the model's max context — see each [model page](/models/bonsai-27b)).
* `models.mode: "merge"` keeps any hosted models you already use (Claude, GPT, etc.) configured as fallbacks alongside Bonsai.

Then set it as the active model:

```bash theme={null}
openclaw models set bonsai/local-model
```

## Step 4: Launch

```bash theme={null}
openclaw
```

Give it a task through whichever channel you've connected. Requests appear in the Bonsai server log, confirming everything is running locally.

<Note>
  OpenClaw's own [local-models guide](https://docs.openclaw.ai/gateway/local-models) recommends running the largest model your hardware can host for agent loops — small or heavily quantized models are more prone to mishandling tool calls and prompt injection. Prefer ternary over 1-bit, and 27B over the smaller Bonsai sizes, for agentic work.
</Note>
