Agent guide · rapid-mlx 0.16.2 · ← All agents

Pi Coding Agent

Pi (npm @earendil-works/pi-coding-agent) is a small, fast terminal coding agent. It reads custom OpenAI-compatible providers from ~/.pi/agent/models.json, so pointing it at rapid-mlx is one provider block.

Quick start

Needs: Pi 1.1.0 (npm install -g @earendil-works/pi-coding-agent@1.1.0).

$ rapid-mlx serve qwen3.5-4b-4bit --port 8000
# In another terminal:
$ rapid-mlx agents pi --setup --yes
$ pi --print --no-session --provider rapid-mlx --model qwen3.5-4b-4bit \
    "Use the read tool to read README.md and report its title"

--provider and --model pin the local route even if Pi has other credentials. rapid-mlx agents pi --test runs the integration check.

Wire: /v1/chat/completions (pi's openai-completions API) · Setup: rapid-mlx agents pi --setup
Re-verified 2026-10-11 — Pi 1.1.0 called its read tool and returned a file marker through rapid-mlx on an M2 Pro Mac mini, using qwen3.5-4b-4bit.

Install

$ npm install -g @earendil-works/pi-coding-agent

Setup

$ rapid-mlx serve qwen3.5-4b-4bit

# in another terminal
$ rapid-mlx agents pi --setup --dry-run   # preview only
$ rapid-mlx agents pi --setup             # preview, confirm, write

--setup reads the model id and context window from the running server. It then:

Your other providers are kept. Under the rapid-mlx provider, models are merged by id, so models you added there yourself are kept too. The block it writes:

// ~/.pi/agent/models.json
{
  "providers": {
    "rapid-mlx": {
      "baseUrl": "http://localhost:8000/v1",
      "api": "openai-completions",
      "apiKey": "not-needed",
      "models": [
        {
          "id": "qwen3.5-4b-4bit",
          "name": "qwen3.5-4b-4bit (Rapid-MLX)",
          "contextWindow": 262144,
          "maxTokens": 8192,
          "input": ["text"],
          "reasoning": false
        }
      ]
    }
  }
}

id and contextWindow come from the running server. The values above are for qwen3.5-4b-4bit.

Run

$ pi                                                      # interactive
$ pi --print --no-session --provider rapid-mlx --model qwen3.5-4b-4bit "summarize this repo"

If rapid-mlx is the only provider pi has credentials for, no flags are needed. Otherwise see the first gotcha below. Recommended aliases (per rapid-mlx agents pi): qwen3.6-35b-4bit, qwen3.5-9b-4bit, qwen3-coder-30b-4bit. rapid-mlx start pi starts a recommended model and then runs the same setup.

Gotchas

See also