bots-garden/mini-mepublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
run-with-mlx-serve.md · 31 lines · 3.1 KBmarkdown
Blame HistoryOpen raw

How to run mini-me on MLX-Serve

This guide shows how to point mm at MLX-Serve, a local model server for Apple Silicon (MLX, no Python), through its OpenAI-compatible endpoint. It assumes MLX-Serve is installed (the app, or brew install mlx-serve for the server only) and that you know how to build mm.

Steps

  1. Download a model and start the server. mlx-serve serve serves every downloaded model on 0.0.0.0:11234 and loads a model on the first request that names it:

    mlx-serve pull lmstudio-community/gemma-4-E4B-it-MLX-8bit
    mlx-serve serve          # or open the MLX-Serve app
    
  2. Run the demo configuration from its directory:

    cd demos/mlx-gemma-4-e4b
    ../../mm                 # finds .mm/agent.yaml
    
  3. Check the banner. provider: mlxserve confirms the provider. When the model is loaded, ctx: 101376 (/v1/models) is the window MLX-Serve serves it with. When it is not loaded yet, the window is unknown at start-up and mm learns it before the next question, once the first answer has loaded the model.

Variants

  • Another model. Set model: to the id exactly as GET /v1/models lists it (curl -s localhost:11234/v1/models). Check the start-up warnings: a model MLX-Serve does not have is not an error on its side — it answers with its default model under the name you asked for. The only sign is the warning model "…" is not downloaded — mlx-serve pull ….
  • Write the file with the wizard. mm init --provider mlxserve lists the server's models and reads the chosen one's family, window, chat template (/api/show) and its own sampling (gen_temperature, gen_top_p, gen_top_k in /v1/models). --check asks the model one question. See How to create an agent.
  • Let mm pull the model. With autoPull: true, mm downloads a model the server does not list at start-up, through POST /api/pull (Ollama's wire, which MLX-Serve speaks), and shows the progress. See autoPull.
  • Reasoning. MLX-Serve reasons when either chat_template_kwargs.enable_thinking or reasoning_effort says so. To turn it off for every turn, say no to both in sampling — or leave both out: Gemma 4 does not reason by default. See How to turn a model's reasoning off.
  • From a container or a Docker sandbox. MLX-Serve listens on all interfaces by default, so with no baseUrl answering, mm falls back to http://host.docker.internal:11234/v1 by itself. In a sandbox, allow localhost:11234 in the network policy.
  • A protected MLX-Serve. A server started with --api-key KEY checks the key for every caller but localhost — a container or a sandbox is not localhost. Export it in MLX_SERVE_API_KEY (mm's name for it; or name another variable under apiKeyEnv). A refused key is a start-up warning naming the variable.
  • Free the memory. /unload and the unload_model tool unload the model through POST /v1/unload-model. See How to free a model's memory.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# How to run mini-me on MLX-Serve

This guide shows how to point `mm` at [MLX-Serve](https://github.com/ddalcu/mlx-serve), a local model server for Apple Silicon (MLX, no Python), through its OpenAI-compatible endpoint. It assumes MLX-Serve is installed (the app, or `brew install mlx-serve` for the server only) and that you know how to build `mm`.

## Steps

1. Download a model and start the server. `mlx-serve serve` serves every downloaded model on `0.0.0.0:11234` and loads a model on the first request that names it:

   ```bash
   mlx-serve pull lmstudio-community/gemma-4-E4B-it-MLX-8bit
   mlx-serve serve          # or open the MLX-Serve app
   ```

2. Run the demo configuration from its directory:

   ```bash
   cd demos/mlx-gemma-4-e4b
   ../../mm                 # finds .mm/agent.yaml
   ```

3. Check the banner. `provider: mlxserve` confirms the provider. When the model is loaded, `ctx: 101376 (/v1/models)` is the window MLX-Serve serves it with. When it is not loaded yet, the window is unknown at start-up and `mm` learns it before the next question, once the first answer has loaded the model.

## Variants

- **Another model.** Set `model:` to the id exactly as `GET /v1/models` lists it (`curl -s localhost:11234/v1/models`). **Check the start-up warnings:** a model MLX-Serve does not have is not an error on its side — it answers with its default model under the name you asked for. The only sign is the warning `model "…" is not downloaded — mlx-serve pull …`.
- **Write the file with the wizard.** `mm init --provider mlxserve` lists the server's models and reads the chosen one's family, window, chat template (`/api/show`) and its own sampling (`gen_temperature`, `gen_top_p`, `gen_top_k` in `/v1/models`). `--check` asks the model one question. See [How to create an agent](create-an-agent.md).
- **Let mm pull the model.** With `autoPull: true`, mm downloads a model the server does not list at start-up, through `POST /api/pull` (Ollama's wire, which MLX-Serve speaks), and shows the progress. See [`autoPull`](../reference/configuration.md).
- **Reasoning.** MLX-Serve reasons when **either** `chat_template_kwargs.enable_thinking` **or** `reasoning_effort` says so. To turn it off for every turn, say no to both in `sampling` — or leave both out: Gemma 4 does not reason by default. See [How to turn a model's reasoning off](turn-reasoning-off.md).
- **From a container or a Docker sandbox.** MLX-Serve listens on all interfaces by default, so with no `baseUrl` answering, `mm` falls back to `http://host.docker.internal:11234/v1` by itself. In a sandbox, allow `localhost:11234` in the network policy.
- **A protected MLX-Serve.** A server started with `--api-key KEY` checks the key for every caller but localhost — a container or a sandbox is not localhost. Export it in `MLX_SERVE_API_KEY` (mm's name for it; or name another variable under `apiKeyEnv`). A refused key is a start-up warning naming the variable.
- **Free the memory.** `/unload` and the `unload_model` tool unload the model through `POST /v1/unload-model`. See [How to free a model's memory](unload-a-model.md).