Skip to main content
This page gets you from zero to a running Bonsai 2 model on macOS, Linux, or Windows. One script installs build tools, downloads the model weights and pre-built inference binaries, and leaves you ready to chat. Prerequisites: git, curl, and enough disk for the model you pick (see the lineup). Everything else, including Python tooling and the inference engine, is installed by the setup script.
If you skip step 2, setup uses its default, BONSAI_MODEL=27B: Ternary Bonsai 2 27B, a 7.8 GB download (the PQ2_0 packing plus the vision projector), and the MLX pack as well on Apple Silicon. The smaller sizes are 9B (about 3 GB), 4B (about 1.5 GB), and 2B (under 1 GB).
Setting this up with an AI coding agent? Point it at AGENTS.md in the repo: hardware-specific knobs, defaults, and what to ask you.

Install and run

1

Clone the repo

2

Choose your model (optional)

Not sure which to pick? 27B is the highest quality and the default. 9B is the laptop sweet spot. 4B and 2B are for phones, edge devices, and the tightest memory budgets. Every size takes images, calls tools, and thinks by default.
3

Run setup

Setup installs and downloads only; it doesn’t start anything. Re-running it is safe: it skips steps that are already done. To download a different size later, change BONSAI_MODEL and run ./scripts/download_models.sh (or re-run setup).
4

Chat

On Apple Silicon you can also run through MLX:
Set BONSAI_MODEL on these commands too if you chose a size other than 27B. The model thinks before it answers. For a short direct reply, add --no-think to run_mlx.sh; on the 9B, 4B, and 2B, BONSAI_THINKING=0 does the same for every launcher.

Start a server instead

Prefer a browser UI or an API endpoint? The repo ships an OpenAI-compatible server:
That gives you chat, vision, and tool calling in one place. Tools such as Hermes connect to the same endpoint. For a full ChatGPT-style interface on the 27B, ./scripts/start_openwebui.sh starts the server and Open WebUI together. See Run the server for flags, sampling defaults, and API examples.

What setup actually does

Even on a fresh machine, setup.sh / setup.ps1:
  1. Installs system build tools (Xcode Command Line Tools on macOS, build-essential on Linux)
  2. Installs uv and creates a Python virtualenv in .venv/
  3. Downloads the selected model from Hugging Face into models/: the PQ2_0 GGUF, its vision projector, and on Apple Silicon the MLX pack
  4. Downloads pre-built llama.cpp binaries for your platform into bin/, pinned to a tested release; if no archive matches your platform, setup stops and points you at the build scripts
  5. On Apple Silicon, creates a second virtualenv, .venv-vlm/, with the pinned mlx-vlm runtime that loads Bonsai 2 natively
  6. Installs Open WebUI and the code-interpreter venv (.venv-jupyter) for the agentic demo, a few GB more and most of the wait; skip with BONSAI_OPENWEBUI=0 and BONSAI_CODE_INTERPRETER=0
Nothing is installed system-wide except the build tools. uv goes into ~/.local/bin, and everything else lives inside the Bonsai-demo directory, so deleting it removes the rest.

Next steps

Run the server

The OpenAI-compatible endpoint, its defaults, and API examples.

Connect your tools

Hermes, LM Studio, and anything OpenAI-compatible.

Pick the right model

Size and format trade-offs with real numbers.

Troubleshooting

Port conflicts, slow generation, models that won’t load.