Skip to main content
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

./scripts/start_llama_server.sh
# Base URL: http://localhost:8080/v1
./scripts/start_mlx_server.sh
# Base URL: http://localhost:8081/v1
Agentic use stresses tool calling and multi-step instructions; prefer Bonsai 27B (native tool calling, on by default) or ternary 8B if memory is tight — see which model for agents.

Step 2: Install OpenClaw

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 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:
{
  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; 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.mode: "merge" keeps any hosted models you already use (Claude, GPT, etc.) configured as fallbacks alongside Bonsai.
Then set it as the active model:
openclaw models set bonsai/local-model

Step 4: Launch

openclaw
Give it a task through whichever channel you’ve connected. Requests appear in the Bonsai server log, confirming everything is running locally.
OpenClaw’s own local-models guide 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.