bots-garden/mini-mepublic Fork
⑂ v2.1.0
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-llama-cpp.md · 82 lines · 7.1 KBmarkdown
Blame HistoryOpen raw

How to run mini-me on llama.cpp instead of Docker Model Runner

This guide shows how to point mm at a llama-server you start yourself. It assumes you already know how to build mm and how to obtain a GGUF model.

Steps

  1. Start llama-server with a chat template and tool calling enabled. --jinja is mandatory: without it the server refuses the tools parameter and the agent cannot run a single command. Give the served model an alias with -a, because llama-server routes requests on the model field:

    llama-server -hf jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M \
                 -a jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M \
                 --jinja -c 32768
    

    llama-server listens on 127.0.0.1:9931 since llama.cpp b11521 (2026-10-09); older builds and the official Docker images use 8080. mm tries both: 9931 first, then 8080 (see Variants).

  2. Use the shipped llama.cpp configuration file. Its model: key must match the -a alias above:

    ./mm agent.llamacpp.yaml
    
  3. Check the banner. provider: llamacpp confirms the provider, and ctx: 32768 (/props) confirms the agent read the served context size from the server's /props endpoint.

Let mm start llama-server

Instead of step 1, mm can start the server itself when nothing answers — and stop it when you quit:

provider: llamacpp
model: "ggml-org/gemma-3-1b-it-GGUF:Q4_K_M"   # a Hugging Face repo:quant
llamacpp:
  autoStart: true
$ mm
🦙 starting llama-server on 127.0.0.1:9931 (pid 74312, log ~/.cache/mm/llama-server/127.0.0.1-9931/llama-server.log)
🦙 ggml-org/gemma-3-1b-it-GGUF:Q4_K_M loaded
…
> /quit
🧹 unloaded ggml-org/gemma-3-1b-it-GGUF:Q4_K_M
🦙 stopped llama-server (pid 74312)
  • When. Only when the agent's address is on this machine (no baseUrl, or 127.0.0.1 / localhost), AGENT_BASE_URL is not set, and nothing answers there, nor on 8080, nor at the fallback (the host's server, seen from a container). A server already running — yours, the Llama app's — is used as before, and never stopped.

  • How. llama-server --host 127.0.0.1 --port <the agent's port> --models-preset <file> in router mode (or llama serve … when only the llama command is installed). The preset file names the agent's model, so a model missing from the Hugging Face cache is downloaded on its first load. mm waits until the model is loaded (spinner, up to startTimeout, 15 minutes by default) — a large download does not hit the first question's timeout. The server's output goes to the log file named on the first line.

  • Several sessions. A second mm on the same address shares the server (🦙 llama-server already started by mm …). Quitting keeps it while another session uses it (kept running: 1 other mm session(s) use it); the last one stops it. A session that crashed leaves a lease the next mm removes.

  • Launch settings. Each optional key is one llama-server flag; a key left out is not passed, llama-server keeps its default. The router hands the model settings on to the model it loads (the banner then shows ctx: 32768 (/props)). The values the Llama app starts its server with:

    llamacpp:
      autoStart: true
      ctxSize: 32768            # --ctx-size (default: the model's own)
      modelsMax: 0              # --models-max: 0 = no limit (default 4)
      modelsMemoryMargin: 1024  # --models-memory-margin, MiB kept free (default 0 = off)
      fitTarget: 1024           # --fit-target, MiB per device (default 1024)
      sleepIdleSeconds: 300     # --sleep-idle-seconds: free the model when idle (default -1 = never)
      specDefault: true         # --spec-default: default speculative decoding
      serverArgs: [--no-webui]  # any other flag, after the ones above
    

    A negative value is a configuration error naming the key (-1 is allowed for sleepIdleSeconds).

  • Other settings. server: the executable's path when it is not on the PATH; startTimeout:. mm init asks, for a llamacpp agent on this machine, whether mm may start the server (default yes) and whether to write the launch settings below (default no).

  • Limits. The server lists the models it knew when it started: a second session with another model finds it missing (a warning) until the sessions using the server have quit. Ctrl-C or SIGTERM during the start stops it.

Variants

  • llama-server on 8080. An older build, the official Docker image or a server started with --port 8080: nothing to set. When baseUrl is llama-server's default (http://127.0.0.1:9931/v1, or no baseUrl at all) and does not answer, mm tries http://127.0.0.1:8080/v1 before the container address. mm init and mm acp-create list the models from whichever answers.
  • Different port or host. Set baseUrl in the YAML to http://<host>:<port>/v1, or override it for one run with AGENT_BASE_URL=http://<host>:<port>/v1 ./mm agent.llamacpp.yaml. An environment override is taken as-is, without the fallback probe.
  • From a container or a Docker Sandbox. When baseUrl does not answer, mm tries http://host.docker.internal:9931/v1, llama-server on the host (a llama-server on 8080 there needs baseUrl: http://host.docker.internal:8080/v1). Start it there with --host 0.0.0.0: by default it listens on the loopback only, which a container on Linux or a sandbox cannot reach. In a sandbox, also allow the port: sbx policy allow network host.docker.internal:9931. fallback: "" turns the fallback off. See run mini-me in a container and run mini-me in a Docker Sandbox.
  • autoPull: true. llama-server cannot download a model over its API: it serves the one it was started with. -hf <repo>:<quant> (step 1) is what downloads it. With autoPull on and a model: the server does not list, mm says so at start-up and goes on. See autoPull.
  • Server started with --api-key. Export the key in LLAMA_API_KEY (the provider's default variable) or name another variable under apiKeyEnv. The key itself never goes in the YAML.
  • Keep agent.yaml and switch provider for one run. AGENT_PROVIDER=llamacpp ./mm works as long as agent.yaml leaves baseUrl empty; an explicit DMR URL in the file would still be honoured and point at port 12434.
  • Router mode (several models behind one port, such as the Llama app). A plain /props then describes the router, not a model. mm asks /props?model=<model> first, so the banner shows the model's window and no false "no chat template" warning; mm init reads the model's facts the same way.
  • The served window is smaller than contextWindow. mm warns at start-up (contextWindow N is larger than the M tokens the server serves …); restart llama-server with a larger --ctx-size, or lower contextWindow.
  • The server hides /props (a reverse proxy, for instance). Set contextWindow to the value you started the server with, otherwise the banner shows ctx: unknown.

See also

 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# How to run mini-me on llama.cpp instead of Docker Model Runner

This guide shows how to point `mm` at a `llama-server` you start yourself. It assumes you already know how to build `mm` and how to obtain a GGUF model.

## Steps

1. Start `llama-server` with a chat template and tool calling enabled. `--jinja` is mandatory: without it the server refuses the `tools` parameter and the agent cannot run a single command. Give the served model an alias with `-a`, because `llama-server` routes requests on the `model` field:

   ```bash
   llama-server -hf jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M \
                -a jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M \
                --jinja -c 32768
   ```

   llama-server listens on `127.0.0.1:9931` since llama.cpp b11521 (2026-10-09); older builds and the official Docker images use `8080`. mm tries both: `9931` first, then `8080` (see Variants).

2. Use the shipped llama.cpp configuration file. Its `model:` key must match the `-a` alias above:

   ```bash
   ./mm agent.llamacpp.yaml
   ```

3. Check the banner. `provider: llamacpp` confirms the provider, and `ctx: 32768 (/props)` confirms the agent read the served context size from the server's `/props` endpoint.

## Let mm start llama-server

Instead of step 1, mm can start the server itself when nothing answers — and stop it when you quit:

```yaml
provider: llamacpp
model: "ggml-org/gemma-3-1b-it-GGUF:Q4_K_M"   # a Hugging Face repo:quant
llamacpp:
  autoStart: true
```

```text
$ mm
🦙 starting llama-server on 127.0.0.1:9931 (pid 74312, log ~/.cache/mm/llama-server/127.0.0.1-9931/llama-server.log)
🦙 ggml-org/gemma-3-1b-it-GGUF:Q4_K_M loaded
…
> /quit
🧹 unloaded ggml-org/gemma-3-1b-it-GGUF:Q4_K_M
🦙 stopped llama-server (pid 74312)
```

- **When.** Only when the agent's address is on this machine (no `baseUrl`, or `127.0.0.1` / `localhost`), `AGENT_BASE_URL` is not set, and nothing answers there, nor on `8080`, nor at the `fallback` (the host's server, seen from a container). A server already running — yours, the Llama app's — is used as before, and never stopped.
- **How.** `llama-server --host 127.0.0.1 --port <the agent's port> --models-preset <file>` in router mode (or `llama serve …` when only the `llama` command is installed). The preset file names the agent's model, so a model missing from the Hugging Face cache is downloaded on its first load. mm waits until the model is loaded (spinner, up to `startTimeout`, 15 minutes by default) — a large download does not hit the first question's timeout. The server's output goes to the log file named on the first line.
- **Several sessions.** A second mm on the same address shares the server (`🦙 llama-server already started by mm …`). Quitting keeps it while another session uses it (`kept running: 1 other mm session(s) use it`); the last one stops it. A session that crashed leaves a lease the next mm removes.
- **Launch settings.** Each optional key is one llama-server flag; a key left out is not passed, llama-server keeps its default. The router hands the model settings on to the model it loads (the banner then shows `ctx: 32768 (/props)`). The values the Llama app starts its server with:

  ```yaml
  llamacpp:
    autoStart: true
    ctxSize: 32768            # --ctx-size (default: the model's own)
    modelsMax: 0              # --models-max: 0 = no limit (default 4)
    modelsMemoryMargin: 1024  # --models-memory-margin, MiB kept free (default 0 = off)
    fitTarget: 1024           # --fit-target, MiB per device (default 1024)
    sleepIdleSeconds: 300     # --sleep-idle-seconds: free the model when idle (default -1 = never)
    specDefault: true         # --spec-default: default speculative decoding
    serverArgs: [--no-webui]  # any other flag, after the ones above
  ```

  A negative value is a configuration error naming the key (`-1` is allowed for `sleepIdleSeconds`).
- **Other settings.** `server:` the executable's path when it is not on the `PATH`; `startTimeout:`. `mm init` asks, for a llamacpp agent on this machine, whether mm may start the server (default yes) and whether to write the launch settings below (default no).
- **Limits.** The server lists the models it knew when it started: a second session with another model finds it missing (a warning) until the sessions using the server have quit. Ctrl-C or SIGTERM during the start stops it.

## Variants

- **llama-server on 8080.** An older build, the official Docker image or a server started with `--port 8080`: nothing to set. When `baseUrl` is llama-server's default (`http://127.0.0.1:9931/v1`, or no `baseUrl` at all) and does not answer, mm tries `http://127.0.0.1:8080/v1` before the container address. `mm init` and `mm acp-create` list the models from whichever answers.
- **Different port or host.** Set `baseUrl` in the YAML to `http://<host>:<port>/v1`, or override it for one run with `AGENT_BASE_URL=http://<host>:<port>/v1 ./mm agent.llamacpp.yaml`. An environment override is taken as-is, without the fallback probe.
- **From a container or a Docker Sandbox.** When `baseUrl` does not answer, mm tries `http://host.docker.internal:9931/v1`, llama-server on the host (a llama-server on `8080` there needs `baseUrl: http://host.docker.internal:8080/v1`). Start it there with `--host 0.0.0.0`: by default it listens on the loopback only, which a container on Linux or a sandbox cannot reach. In a sandbox, also allow the port: `sbx policy allow network host.docker.internal:9931`. `fallback: ""` turns the fallback off. See [run mini-me in a container](run-in-a-container.md) and [run mini-me in a Docker Sandbox](run-in-a-docker-sandbox.md).
- **`autoPull: true`.** llama-server cannot download a model over its API: it serves the one it was started with. `-hf <repo>:<quant>` (step 1) is what downloads it. With `autoPull` on and a `model:` the server does not list, mm says so at start-up and goes on. See [`autoPull`](../reference/configuration.md).
- **Server started with `--api-key`.** Export the key in `LLAMA_API_KEY` (the provider's default variable) or name another variable under `apiKeyEnv`. The key itself never goes in the YAML.
- **Keep `agent.yaml` and switch provider for one run.** `AGENT_PROVIDER=llamacpp ./mm` works as long as `agent.yaml` leaves `baseUrl` empty; an explicit DMR URL in the file would still be honoured and point at port 12434.
- **Router mode (several models behind one port, such as the Llama app).** A plain `/props` then describes the router, not a model. mm asks `/props?model=<model>` first, so the banner shows the model's window and no false "no chat template" warning; `mm init` reads the model's facts the same way.
- **The served window is smaller than `contextWindow`.** mm warns at start-up (`contextWindow N is larger than the M tokens the server serves …`); restart llama-server with a larger `--ctx-size`, or lower `contextWindow`.
- **The server hides `/props`** (a reverse proxy, for instance). Set `contextWindow` to the value you started the server with, otherwise the banner shows `ctx: unknown`.

## See also

- Every key of the file: [configuration reference](../reference/configuration.md)
- Why one provider implementation serves both servers: [providers](../explanation/providers.md)