athanor 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +201 -0
- package/LICENSE +201 -0
- package/README.md +627 -0
- package/bin/athanor +2 -0
- package/dist/adapters/__fixtures.d.ts +4 -0
- package/dist/adapters/__fixtures.d.ts.map +1 -0
- package/dist/adapters/__fixtures.js +29 -0
- package/dist/adapters/__fixtures.js.map +1 -0
- package/dist/adapters/health.d.ts +9 -0
- package/dist/adapters/health.d.ts.map +1 -0
- package/dist/adapters/health.js +44 -0
- package/dist/adapters/health.js.map +1 -0
- package/dist/adapters/index.d.ts +13 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +59 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/llama.d.ts +10 -0
- package/dist/adapters/llama.d.ts.map +1 -0
- package/dist/adapters/llama.js +28 -0
- package/dist/adapters/llama.js.map +1 -0
- package/dist/adapters/mlx.d.ts +11 -0
- package/dist/adapters/mlx.d.ts.map +1 -0
- package/dist/adapters/mlx.js +54 -0
- package/dist/adapters/mlx.js.map +1 -0
- package/dist/app/models.d.ts +22 -0
- package/dist/app/models.d.ts.map +1 -0
- package/dist/app/models.js +81 -0
- package/dist/app/models.js.map +1 -0
- package/dist/cli/commands.d.ts +6 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +50 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +16 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/format.d.ts +6 -0
- package/dist/cli/format.d.ts.map +1 -0
- package/dist/cli/format.js +59 -0
- package/dist/cli/format.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +214 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/model-commands.d.ts +13 -0
- package/dist/cli/model-commands.d.ts.map +1 -0
- package/dist/cli/model-commands.js +201 -0
- package/dist/cli/model-commands.js.map +1 -0
- package/dist/cli/preset-commands.d.ts +7 -0
- package/dist/cli/preset-commands.d.ts.map +1 -0
- package/dist/cli/preset-commands.js +78 -0
- package/dist/cli/preset-commands.js.map +1 -0
- package/dist/cli/pull-renderer.d.ts +7 -0
- package/dist/cli/pull-renderer.d.ts.map +1 -0
- package/dist/cli/pull-renderer.js +109 -0
- package/dist/cli/pull-renderer.js.map +1 -0
- package/dist/cli/shared.d.ts +6 -0
- package/dist/cli/shared.d.ts.map +1 -0
- package/dist/cli/shared.js +7 -0
- package/dist/cli/shared.js.map +1 -0
- package/dist/cli/style.d.ts +29 -0
- package/dist/cli/style.d.ts.map +1 -0
- package/dist/cli/style.js +63 -0
- package/dist/cli/style.js.map +1 -0
- package/dist/cli/system-commands.d.ts +16 -0
- package/dist/cli/system-commands.d.ts.map +1 -0
- package/dist/cli/system-commands.js +109 -0
- package/dist/cli/system-commands.js.map +1 -0
- package/dist/config/index.d.ts +52 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +223 -0
- package/dist/config/index.js.map +1 -0
- package/dist/control/server.d.ts +4 -0
- package/dist/control/server.d.ts.map +1 -0
- package/dist/control/server.js +84 -0
- package/dist/control/server.js.map +1 -0
- package/dist/discovery/ingest.d.ts +8 -0
- package/dist/discovery/ingest.d.ts.map +1 -0
- package/dist/discovery/ingest.js +18 -0
- package/dist/discovery/ingest.js.map +1 -0
- package/dist/discovery/scanner.d.ts +8 -0
- package/dist/discovery/scanner.d.ts.map +1 -0
- package/dist/discovery/scanner.js +261 -0
- package/dist/discovery/scanner.js.map +1 -0
- package/dist/discovery/watcher.d.ts +15 -0
- package/dist/discovery/watcher.d.ts.map +1 -0
- package/dist/discovery/watcher.js +71 -0
- package/dist/discovery/watcher.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/index.js.map +1 -0
- package/dist/presets/edit.d.ts +14 -0
- package/dist/presets/edit.d.ts.map +1 -0
- package/dist/presets/edit.js +105 -0
- package/dist/presets/edit.js.map +1 -0
- package/dist/presets/recipes.d.ts +12 -0
- package/dist/presets/recipes.d.ts.map +1 -0
- package/dist/presets/recipes.js +91 -0
- package/dist/presets/recipes.js.map +1 -0
- package/dist/pull/api.d.ts +14 -0
- package/dist/pull/api.d.ts.map +1 -0
- package/dist/pull/api.js +29 -0
- package/dist/pull/api.js.map +1 -0
- package/dist/pull/download.d.ts +46 -0
- package/dist/pull/download.d.ts.map +1 -0
- package/dist/pull/download.js +133 -0
- package/dist/pull/download.js.map +1 -0
- package/dist/pull/hf.d.ts +16 -0
- package/dist/pull/hf.d.ts.map +1 -0
- package/dist/pull/hf.js +50 -0
- package/dist/pull/hf.js.map +1 -0
- package/dist/pull/hf_pull.py +137 -0
- package/dist/pull/resolve-python.d.ts +11 -0
- package/dist/pull/resolve-python.d.ts.map +1 -0
- package/dist/pull/resolve-python.js +81 -0
- package/dist/pull/resolve-python.js.map +1 -0
- package/dist/pull/suggestions.d.ts +11 -0
- package/dist/pull/suggestions.d.ts.map +1 -0
- package/dist/pull/suggestions.js +24 -0
- package/dist/pull/suggestions.js.map +1 -0
- package/dist/registry/index.d.ts +28 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +125 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/materialize.d.ts +19 -0
- package/dist/registry/materialize.d.ts.map +1 -0
- package/dist/registry/materialize.js +96 -0
- package/dist/registry/materialize.js.map +1 -0
- package/dist/registry/sort.d.ts +4 -0
- package/dist/registry/sort.d.ts.map +1 -0
- package/dist/registry/sort.js +20 -0
- package/dist/registry/sort.js.map +1 -0
- package/dist/router/server.d.ts +10 -0
- package/dist/router/server.d.ts.map +1 -0
- package/dist/router/server.js +158 -0
- package/dist/router/server.js.map +1 -0
- package/dist/search/format.d.ts +6 -0
- package/dist/search/format.d.ts.map +1 -0
- package/dist/search/format.js +62 -0
- package/dist/search/format.js.map +1 -0
- package/dist/search/hf.d.ts +39 -0
- package/dist/search/hf.d.ts.map +1 -0
- package/dist/search/hf.js +242 -0
- package/dist/search/hf.js.map +1 -0
- package/dist/supervisor/index.d.ts +18 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +149 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/supervisor/inflight.d.ts +6 -0
- package/dist/supervisor/inflight.d.ts.map +1 -0
- package/dist/supervisor/inflight.js +66 -0
- package/dist/supervisor/inflight.js.map +1 -0
- package/dist/supervisor/logs.d.ts +7 -0
- package/dist/supervisor/logs.d.ts.map +1 -0
- package/dist/supervisor/logs.js +31 -0
- package/dist/supervisor/logs.js.map +1 -0
- package/dist/supervisor/metrics.d.ts +26 -0
- package/dist/supervisor/metrics.d.ts.map +1 -0
- package/dist/supervisor/metrics.js +156 -0
- package/dist/supervisor/metrics.js.map +1 -0
- package/dist/supervisor/policies.d.ts +6 -0
- package/dist/supervisor/policies.d.ts.map +1 -0
- package/dist/supervisor/policies.js +17 -0
- package/dist/supervisor/policies.js.map +1 -0
- package/dist/supervisor/state.d.ts +5 -0
- package/dist/supervisor/state.d.ts.map +1 -0
- package/dist/supervisor/state.js +34 -0
- package/dist/supervisor/state.js.map +1 -0
- package/dist/sync/pi.d.ts +15 -0
- package/dist/sync/pi.d.ts.map +1 -0
- package/dist/sync/pi.js +228 -0
- package/dist/sync/pi.js.map +1 -0
- package/dist/types/index.d.ts +87 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/App.d.ts +7 -0
- package/dist/ui/App.d.ts.map +1 -0
- package/dist/ui/App.js +218 -0
- package/dist/ui/App.js.map +1 -0
- package/dist/ui/Banner.d.ts +9 -0
- package/dist/ui/Banner.d.ts.map +1 -0
- package/dist/ui/Banner.js +58 -0
- package/dist/ui/Banner.js.map +1 -0
- package/dist/ui/LogFocus.d.ts +13 -0
- package/dist/ui/LogFocus.d.ts.map +1 -0
- package/dist/ui/LogFocus.js +92 -0
- package/dist/ui/LogFocus.js.map +1 -0
- package/dist/ui/LogTail.d.ts +7 -0
- package/dist/ui/LogTail.d.ts.map +1 -0
- package/dist/ui/LogTail.js +22 -0
- package/dist/ui/LogTail.js.map +1 -0
- package/dist/ui/ModelList.d.ts +16 -0
- package/dist/ui/ModelList.d.ts.map +1 -0
- package/dist/ui/ModelList.js +91 -0
- package/dist/ui/ModelList.js.map +1 -0
- package/dist/ui/PresetEditor.d.ts +7 -0
- package/dist/ui/PresetEditor.d.ts.map +1 -0
- package/dist/ui/PresetEditor.js +149 -0
- package/dist/ui/PresetEditor.js.map +1 -0
- package/dist/ui/PullModal.d.ts +9 -0
- package/dist/ui/PullModal.d.ts.map +1 -0
- package/dist/ui/PullModal.js +139 -0
- package/dist/ui/PullModal.js.map +1 -0
- package/dist/ui/SearchBrowser.d.ts +11 -0
- package/dist/ui/SearchBrowser.d.ts.map +1 -0
- package/dist/ui/SearchBrowser.js +433 -0
- package/dist/ui/SearchBrowser.js.map +1 -0
- package/dist/ui/Suggestions.d.ts +6 -0
- package/dist/ui/Suggestions.d.ts.map +1 -0
- package/dist/ui/Suggestions.js +10 -0
- package/dist/ui/Suggestions.js.map +1 -0
- package/dist/ui/useAppData.d.ts +17 -0
- package/dist/ui/useAppData.d.ts.map +1 -0
- package/dist/ui/useAppData.js +47 -0
- package/dist/ui/useAppData.js.map +1 -0
- package/dist/ui/useAppInput.d.ts +33 -0
- package/dist/ui/useAppInput.d.ts.map +1 -0
- package/dist/ui/useAppInput.js +128 -0
- package/dist/ui/useAppInput.js.map +1 -0
- package/dist/ui/useModelActions.d.ts +18 -0
- package/dist/ui/useModelActions.d.ts.map +1 -0
- package/dist/ui/useModelActions.js +78 -0
- package/dist/ui/useModelActions.js.map +1 -0
- package/dist/ui/useMouseWheel.d.ts +19 -0
- package/dist/ui/useMouseWheel.d.ts.map +1 -0
- package/dist/ui/useMouseWheel.js +92 -0
- package/dist/ui/useMouseWheel.js.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
# athanor
|
|
2
|
+
|
|
3
|
+
**Athanor — personal LLM alchemy.** Discover, download, configure, and switch between MLX and llama.cpp models on Apple Silicon from a single TUI or CLI, while keeping an OpenAI-compatible HTTP endpoint live for downstream tools (pi-agent, editors, etc.).
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- **Discovers** MLX models in your HuggingFace cache and GGUF files in `~/.models`.
|
|
8
|
+
- **Downloads** new models from HuggingFace via the `hf` CLI.
|
|
9
|
+
- **Runs** them via `mlx_lm.server` or `llama-server`, one or more at a time, each on a stable port.
|
|
10
|
+
- **Supervises** the processes as detached children with per-process log files and automatic reattach.
|
|
11
|
+
- **Publishes** them to a pi-agent catalog (`~/.pi/agent/models.json`) as one custom provider per model, leaving your other (cloud, Ollama, etc.) providers alone.
|
|
12
|
+
- **Exposes** an optional local control API so other tools can ask athanor to activate a model on demand.
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- macOS on Apple Silicon
|
|
17
|
+
- Node.js ≥ 18
|
|
18
|
+
- `mlx_lm.server` (from [`mlx-lm`](https://github.com/ml-explore/mlx-lm)) — text-only MLX models
|
|
19
|
+
- `mlx_vlm.server` (from [`mlx-vlm`](https://github.com/Blaizzy/mlx-vlm)) — vision/multimodal MLX models; optional if you never run VLMs
|
|
20
|
+
- `llama-server` (from [`llama.cpp`](https://github.com/ggml-org/llama.cpp))
|
|
21
|
+
- `hf` (from [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/guides/cli)) — only required for `athanor pull`
|
|
22
|
+
|
|
23
|
+
Run `athanor doctor` at any point to verify all four are on your `PATH`.
|
|
24
|
+
|
|
25
|
+
## Agent-assisted setup
|
|
26
|
+
|
|
27
|
+
If you use an AI coding agent (Claude Code, Cursor, Aider, etc.), the fastest path is to open this repo in the agent and ask it to set athanor up for you. `AGENTS.md` has an **Onboarding a user** section written for that case: it tells the agent how to install the CLI (`npm start` vs `npm link`), run `athanor doctor`, install any missing runtime binaries, profile the host (Apple Silicon check, unified memory via `vm_stat`, HF cache size), and pick a starter model sized for the machine.
|
|
28
|
+
|
|
29
|
+
A minimal prompt, once the repo is open:
|
|
30
|
+
|
|
31
|
+
> Set up athanor on this machine. Profile what I have, install anything missing, and suggest a starter model I can actually run.
|
|
32
|
+
|
|
33
|
+
The rest of this README walks the same path manually.
|
|
34
|
+
|
|
35
|
+
## Setup
|
|
36
|
+
|
|
37
|
+
Install the three runtime helpers athanor shells out to. All three land on your `PATH` and can be verified with `athanor doctor`.
|
|
38
|
+
|
|
39
|
+
### mlx-lm (MLX runtime)
|
|
40
|
+
|
|
41
|
+
`mlx-lm` is a Python package; the `mlx_lm.server` entry point is what athanor invokes. A dedicated virtualenv keeps it isolated from your system Python.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# with uv (recommended)
|
|
45
|
+
brew install uv
|
|
46
|
+
uv tool install mlx-lm
|
|
47
|
+
# ⇒ `mlx_lm.server` is now on PATH via ~/.local/bin
|
|
48
|
+
|
|
49
|
+
# or with pipx
|
|
50
|
+
brew install pipx
|
|
51
|
+
pipx install mlx-lm
|
|
52
|
+
|
|
53
|
+
# or with a plain venv
|
|
54
|
+
python3 -m venv ~/.venvs/mlx && source ~/.venvs/mlx/bin/activate
|
|
55
|
+
pip install -U mlx-lm
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Verify:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
mlx_lm.server --help
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
MLX requires Apple Silicon and macOS 13.5+. Models are downloaded to `~/.cache/huggingface/hub` on first use.
|
|
65
|
+
|
|
66
|
+
### mlx-vlm (MLX vision/multimodal runtime)
|
|
67
|
+
|
|
68
|
+
Required only if you flip a model to `mlxFlavor: "vlm"` to feed it actual image input. Athanor defaults every MLX entry to `mlx_lm.server`, which handles text-only chat for most VLM-tagged repos (Qwen2-VL, Qwen2.5-VL, Qwen3-VL, LLaVA, etc.) without torch. Only install this when you actually need vision — and then opt in per model with `athanor flavor <slug> vlm`.
|
|
69
|
+
|
|
70
|
+
`mlx_vlm.server` imports `transformers`' VLM processors, which in turn import PyTorch and Torchvision. Installing `mlx-vlm` alone is not enough; `torch` and `torchvision` must be present in the same environment. With `uv`:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uv tool install mlx-vlm --with torch --with torchvision
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or with pipx:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pipx install mlx-vlm
|
|
80
|
+
pipx inject mlx-vlm torch torchvision
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or with pip into the same venv you used for mlx-lm:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install -U mlx-vlm torch torchvision
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Verify:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
mlx_vlm.server --help
|
|
93
|
+
python3 -c "import torch, torchvision; print(torch.__version__, torchvision.__version__)"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
If `mlx_vlm.server` starts but a request fails with `Qwen3VLVideoProcessor requires the PyTorch library` (or similar), torch/torchvision are missing or installed into a different interpreter than `mlx_vlm.server` is using. Re-run the install above into the right environment.
|
|
97
|
+
|
|
98
|
+
### llama.cpp (GGUF runtime)
|
|
99
|
+
|
|
100
|
+
The easiest path on macOS is Homebrew — the bottle is built with Metal enabled, so GPU acceleration works out of the box:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
brew install llama.cpp
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
You can also build from source if you want a specific revision or custom flags:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git clone https://github.com/ggml-org/llama.cpp
|
|
110
|
+
cd llama.cpp
|
|
111
|
+
cmake -B build
|
|
112
|
+
cmake --build build --config Release -j
|
|
113
|
+
# copy or symlink build/bin/llama-server onto your PATH
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Verify:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
llama-server --help
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### hf (HuggingFace CLI — only for `athanor pull`)
|
|
123
|
+
|
|
124
|
+
Needed only if you want athanor to download new models from the Hub. Skip if you'll populate `~/.cache/huggingface/hub` by other means (e.g. `mlx_lm.server --model <repo>` auto-downloads on first use).
|
|
125
|
+
|
|
126
|
+
The Hugging Face Hub team has replaced the legacy `huggingface-cli` command with a new CLI called `hf`. Athanor invokes `hf download`. The recommended install path is the standalone installer, which drops a self-contained `hf` binary onto your `PATH` without touching system Python:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
curl -LsSf https://hf.co/cli/install.sh | bash
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Alternatives:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Homebrew
|
|
136
|
+
brew install hf
|
|
137
|
+
|
|
138
|
+
# via uvx — runs the latest release on demand, no install step
|
|
139
|
+
uvx hf --help
|
|
140
|
+
|
|
141
|
+
# via pip (the `hf` entry point ships with huggingface_hub ≥ 0.34)
|
|
142
|
+
pip install -U huggingface_hub
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Verify:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
hf --help
|
|
149
|
+
# optional: log in if you need access to gated/private repos
|
|
150
|
+
hf auth login
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Final check
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
athanor doctor
|
|
157
|
+
# mlx_lm.server: /Users/you/.local/bin/mlx_lm.server
|
|
158
|
+
# mlx_vlm.server: /Users/you/.local/bin/mlx_vlm.server
|
|
159
|
+
# llama-server: /opt/homebrew/bin/llama-server
|
|
160
|
+
# hf: /Users/you/.local/bin/hf
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Quick start
|
|
164
|
+
|
|
165
|
+
### Fastest path
|
|
166
|
+
|
|
167
|
+
If you want one working local text model quickly on a typical 16 GB+ Apple Silicon Mac:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm install
|
|
171
|
+
npm start -- doctor
|
|
172
|
+
npm start -- pull mlx-community/Qwen3.5-9B-MLX-4bit
|
|
173
|
+
npm start -- start qwen3-5-9b-mlx-4bit
|
|
174
|
+
npm start -- expose qwen3-5-9b-mlx-4bit
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Then in pi-agent, select provider `athanor-mlx-qwen3-5-9b-mlx-4bit` and model `mlx-community/Qwen3.5-9B-MLX-4bit`.
|
|
178
|
+
|
|
179
|
+
If you only want text chat, you do **not** need `mlx_vlm.server`; `mlx_lm.server` is enough even for many VLM-tagged repos when used as text-only models.
|
|
180
|
+
|
|
181
|
+
### Full quick start
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm install
|
|
185
|
+
|
|
186
|
+
# verify external runtime binaries are on PATH
|
|
187
|
+
npm start -- doctor
|
|
188
|
+
|
|
189
|
+
# one-time: ingest whatever's already on disk
|
|
190
|
+
npm start -- scan
|
|
191
|
+
|
|
192
|
+
# see what's in the registry — if empty, this prints curated
|
|
193
|
+
# starter models sized for 8 / 16 / 32 GB Macs that you can copy
|
|
194
|
+
# the `athanor pull ...` line from
|
|
195
|
+
npm start -- ls
|
|
196
|
+
|
|
197
|
+
# pull one and start it (by slug)
|
|
198
|
+
npm start -- pull mlx-community/Qwen3.5-9B-MLX-4bit
|
|
199
|
+
npm start -- start qwen3-5-9b-mlx-4bit
|
|
200
|
+
|
|
201
|
+
# or drop into the TUI (no args) — the empty state has the same
|
|
202
|
+
# suggestions and pulls them inline when you press Enter
|
|
203
|
+
npm start
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`npm start` runs the app via `tsx`, so no build step is needed for development. If you want a compiled build or to install the `athanor` binary globally:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npm run build # emit dist/
|
|
210
|
+
npm link # expose `athanor` on PATH
|
|
211
|
+
athanor ls # now usable directly
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
`bin/athanor` imports `dist/index.js`, so `npm link` requires a prior `npm run build`. Linked mode does not auto-rebuild; re-run the build after pulling changes or stay on `npm start` for the dev loop.
|
|
215
|
+
|
|
216
|
+
## Concepts
|
|
217
|
+
|
|
218
|
+
### Registry
|
|
219
|
+
|
|
220
|
+
`~/.athanor/models.json` is the source of truth. Every model has:
|
|
221
|
+
|
|
222
|
+
| field | purpose |
|
|
223
|
+
| ----------- | ------------------------------------------------------------- |
|
|
224
|
+
| `id` | stable canonical id (HF repo, repo+file, or `local:…`) |
|
|
225
|
+
| `slug` | short user-editable handle (`qwen-32b`) |
|
|
226
|
+
| `path` | on-disk location athanor passes to the runtime |
|
|
227
|
+
| `runtime` | `mlx` or `llama.cpp` |
|
|
228
|
+
| `source` | `{ type: "hf", repo, [revision], [file] }` or `{ type: "local" }` |
|
|
229
|
+
| `port` | **stable** port allocated once per model, never changes |
|
|
230
|
+
| `preset` | per-model overrides that merge on top of global runtime config |
|
|
231
|
+
| `mlxFlavor` | `"lm"` or `"vlm"` — picks which MLX binary to use (MLX only) |
|
|
232
|
+
| `publish` | whether pi-agent sees this model |
|
|
233
|
+
| `piAlias` | the name pi-agent uses (defaults to `slug`) |
|
|
234
|
+
| `tags` | free-form labels (`chat`, `coder`, …) |
|
|
235
|
+
|
|
236
|
+
### Stable per-model ports
|
|
237
|
+
|
|
238
|
+
Each model is bound to a port at first ingest and keeps it forever. This means pi-agent's catalog is configured **once per model**; switching which model is active does not change pi's URLs, only the `status` field athanor writes into each entry.
|
|
239
|
+
|
|
240
|
+
Port range is configurable (`portRange` in `~/.athanor/config.json`, default 8081–8099).
|
|
241
|
+
|
|
242
|
+
### MLX capabilities and flavor routing
|
|
243
|
+
|
|
244
|
+
MLX entries track two independent axes:
|
|
245
|
+
|
|
246
|
+
- `mlxCapabilities` — *what the model advertises*. Detected from the snapshot's `config.json` at scan and pull time, primarily by looking for a `vision_config` block, with fallbacks for known VLM `model_type` values (`qwen2_vl`, `qwen2_5_vl`, `llava*`, `mllama`, `pixtral`, `idefics2/3`, `phi3_v`) and architecture-name patterns such as `Qwen2VLForConditionalGeneration`. Today the only capability is `"vlm"`. Capabilities are refreshed on every scan.
|
|
247
|
+
- `mlxFlavor` — *which server binary to launch*. `"lm"` routes to `mlx_lm.server` (the default, no torch/torchvision required); `"vlm"` routes to `mlx_vlm.server` (requires torch + torchvision; needed for actual image input). Never set automatically — you choose with `athanor flavor <slug> lm|vlm`.
|
|
248
|
+
|
|
249
|
+
The split is deliberate: many VLM-tagged repos (e.g. Qwen2.5-VL, Qwen3-VL-MLX) run fine as text-only under `mlx_lm.server`, which is lighter, faster to load, and doesn't need a PyTorch install. Auto-routing every VLM-capable repo to `mlx_vlm.server` would silently break text-only workflows whenever torch isn't available. So athanor defaults everything to `lm` and leaves the upgrade to you.
|
|
250
|
+
|
|
251
|
+
In `athanor ls` and `athanor show`, entries with `mlxFlavor: "vlm"` display `mlx-vlm` in the runtime column; `athanor show` also prints a `caps` row and, for vision-capable entries still on `lm`, a hint pointing at `athanor flavor <slug> vlm`. In pi-agent, VLM-flavored entries render as `[mlx-vlm] <slug> (athanor)`; the provider id stays `athanor-mlx-<slug>` regardless of flavor, so pi URLs don't churn if a model's flavor is toggled later.
|
|
252
|
+
|
|
253
|
+
### Supervisor and policies
|
|
254
|
+
|
|
255
|
+
The runtime supervisor manages N concurrent child processes. Three policies:
|
|
256
|
+
|
|
257
|
+
- `single-active` (default) — starting a model stops any others.
|
|
258
|
+
- `multi-active-lru` — keep up to `supervisor.maxConcurrent` running; evict the least-recently-started.
|
|
259
|
+
- `manual` — never auto-stop; you decide.
|
|
260
|
+
|
|
261
|
+
Children are started with `detached: true`, stdio redirected to `~/.athanor/logs/<slug>-<pid>.log`, and `unref()`ed so the CLI/TUI can exit without killing them. On next launch athanor reattaches via PID.
|
|
262
|
+
|
|
263
|
+
Readiness is detected by polling the runtime's health endpoint (`/health` for llama.cpp, `/v1/models` for mlx_lm.server), not by matching stdout strings.
|
|
264
|
+
|
|
265
|
+
### Observability
|
|
266
|
+
|
|
267
|
+
The TUI banner shows a second line with system CPU and RAM bars plus the 1-minute load average, refreshed once a second. Each running row in the model list gets a compact suffix `CPU% · RSS · tok/s` (e.g. `340% · 4.2G · 22.5 tok/s`). The CLI mirrors this: `athanor status` adds CPU, RSS, and tok/s columns for every running instance.
|
|
268
|
+
|
|
269
|
+
Caveats worth knowing:
|
|
270
|
+
|
|
271
|
+
- **CPU% is per-core, not per-machine**, matching `ps` and Activity Monitor. A runtime using 8 cores reads as ~800%. Divide by `os.cpus().length` yourself if you want a whole-machine number.
|
|
272
|
+
- **RSS is resident set size**, not reserved allocation. On Apple Silicon's unified memory this is the honest "how much of my RAM is this model currently pinning" number.
|
|
273
|
+
- **tok/s is post-request, not live.** Athanor does not sit in the request path — clients connect directly to each runtime's port. The number is parsed from the per-completion timing line the runtime already writes to its log (`eval time = … tokens per second` for llama.cpp, `Generation: … tokens, … tokens-per-sec` for mlx_lm / mlx_vlm), and updates once a generation finishes. While a request is streaming, the most recent completed request's rate is shown. If no completion has happened yet, the column is blank.
|
|
274
|
+
- Sampling is best-effort — if `ps` fails, the log format changes, or timing lines are not yet present, the affected column is hidden rather than showing a wrong number.
|
|
275
|
+
|
|
276
|
+
### Pi-agent sync
|
|
277
|
+
|
|
278
|
+
Athanor publishes into pi-agent's [custom providers](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/models.md) system. On every state change it rewrites `~/.pi/agent/models.json`:
|
|
279
|
+
|
|
280
|
+
- Each exposed athanor model becomes **its own pi provider** named `athanor-<runtime>-<slug>` (e.g. `athanor-mlx-qwen3-32b`, `athanor-llama-llama3-8b`), with `baseUrl` pointing at that model's stable port. One provider per model is required because a pi provider has exactly one `baseUrl` and each athanor model runs on its own port. The runtime segment keeps the backing engine visible in pi's `/model` picker. MLX VLM entries keep the `athanor-mlx-<slug>` provider id (so URLs don't churn if flavor is corrected) but render as `[mlx-vlm] <slug> (athanor)` in pi's model list.
|
|
281
|
+
- Providers whose name does **not** start with `athanor-` are preserved untouched — your OpenAI, Anthropic, Ollama, OpenRouter, etc. entries are safe.
|
|
282
|
+
- Each athanor provider uses `api: "openai-completions"` (both `mlx_lm.server` and `llama-server` are OpenAI-compatible), a placeholder `apiKey: "athanor"` (required but ignored by both runtimes), and `compat: { supportsDeveloperRole: false, supportsReasoningEffort: false }` — the same flags pi's docs recommend for Ollama/vLLM-style local servers.
|
|
283
|
+
- The provider's single model uses an `id` that matches exactly what the runtime was launched with, because `mlx_lm.server` compares the request's `model` field literally and falls back to a HuggingFace lookup on mismatch (see [ml-explore/mlx-lm#1133](https://github.com/ml-explore/mlx-lm/issues/1133)). Concretely:
|
|
284
|
+
- **MLX HF-sourced models** are launched with `--model <repo>` (e.g. `--model mlx-community/Qwen3-32B-4bit`) and the pi `id` is that same repo string. `mlx_lm.server` resolves the repo from the local HF cache with no network access.
|
|
285
|
+
- **MLX local models** are launched with `--model <path>` and the pi `id` is that same path.
|
|
286
|
+
- **llama.cpp models** are launched with `-m <path> --alias <piAlias|slug>` and the pi `id` is that alias. `llama-server` ignores the request's `model` field, so the alias is just what appears in `/v1/models`.
|
|
287
|
+
- `~/.pi/agent/settings.json` is only touched when an athanor model is started as the active default, at which point `defaultProvider` and `defaultModel` are set to point at it. All other settings keys (`theme`, `compaction`, etc.) are preserved.
|
|
288
|
+
|
|
289
|
+
Example exposed provider (MLX, HF-sourced):
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{
|
|
293
|
+
"providers": {
|
|
294
|
+
"athanor-mlx-qwen3-32b": {
|
|
295
|
+
"baseUrl": "http://127.0.0.1:8081/v1",
|
|
296
|
+
"api": "openai-completions",
|
|
297
|
+
"apiKey": "athanor",
|
|
298
|
+
"compat": {
|
|
299
|
+
"supportsDeveloperRole": false,
|
|
300
|
+
"supportsReasoningEffort": false
|
|
301
|
+
},
|
|
302
|
+
"models": [
|
|
303
|
+
{
|
|
304
|
+
"id": "mlx-community/Qwen3-32B-4bit",
|
|
305
|
+
"name": "[mlx] qwen3-32b (athanor)",
|
|
306
|
+
"input": ["text"],
|
|
307
|
+
"contextWindow": 16384
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Then in pi: `pi --provider athanor-mlx-qwen3-32b --model mlx-community/Qwen3-32B-4bit`, or just select it from `/model`.
|
|
316
|
+
|
|
317
|
+
Disable athanor's sync entirely with `"enablePiSync": false` in `~/.athanor/config.json`.
|
|
318
|
+
|
|
319
|
+
## CLI reference
|
|
320
|
+
|
|
321
|
+
```
|
|
322
|
+
athanor launch the TUI
|
|
323
|
+
athanor scan rescan model dirs and update registry
|
|
324
|
+
athanor ls list registry entries (with live status)
|
|
325
|
+
athanor status list running instances
|
|
326
|
+
athanor show <id|slug> inspect a model: runtime, effective config, launch command
|
|
327
|
+
athanor start <id|slug> start a model
|
|
328
|
+
athanor stop [<id|slug>|--all]stop one or all
|
|
329
|
+
athanor restart <id|slug> stop + start
|
|
330
|
+
athanor logs <id|slug> [-n N] tail last N lines of a running model's log
|
|
331
|
+
athanor pull <repo> [--file F] [--revision R]
|
|
332
|
+
download from HuggingFace and register
|
|
333
|
+
athanor search [q] [--mlx|--gguf|--any] [--author A] [--sort S] [--limit N]
|
|
334
|
+
search the HuggingFace Hub
|
|
335
|
+
athanor trending [--mlx|--gguf] [--limit N]
|
|
336
|
+
top trending MLX/GGUF models
|
|
337
|
+
athanor preset <slug> show|set k=v...|unset k...|clear|apply <recipe>
|
|
338
|
+
view or modify a model's preset
|
|
339
|
+
athanor recipes list built-in + user recipes and tunable keys
|
|
340
|
+
athanor flavor <slug> lm|vlm force MLX runtime flavor (lm = mlx_lm, vlm = mlx_vlm)
|
|
341
|
+
athanor expose <id|slug> include in pi-agent catalog
|
|
342
|
+
athanor hide <id|slug> remove from pi-agent catalog
|
|
343
|
+
athanor rm <id|slug> remove from registry (must be stopped)
|
|
344
|
+
athanor sync manually rewrite pi catalog
|
|
345
|
+
athanor config print resolved config and its path
|
|
346
|
+
athanor doctor check that required binaries are on PATH
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
`<id|slug>` accepts either the canonical id or the short slug.
|
|
350
|
+
|
|
351
|
+
## TUI key bindings
|
|
352
|
+
|
|
353
|
+
| key | action |
|
|
354
|
+
| ---------- | --------------------------------------------------- |
|
|
355
|
+
| `↑` / `↓` / wheel | move selection (one entry per wheel notch) |
|
|
356
|
+
| `⏎` | start (if idle) / stop (if running) the highlighted model |
|
|
357
|
+
| `r` | restart the highlighted model |
|
|
358
|
+
| `k` | kill the highlighted model |
|
|
359
|
+
| `P` | toggle pi-agent visibility (expose/hide) |
|
|
360
|
+
| `d` | remove the highlighted entry from the registry |
|
|
361
|
+
| `s` | rescan and ingest new models (automatic on start and when the HF cache changes) |
|
|
362
|
+
| `p` | open the pull modal (`esc` cancels in progress) |
|
|
363
|
+
| `e` | open the preset editor for the highlighted model |
|
|
364
|
+
| `/` | filter the list by substring of slug or id |
|
|
365
|
+
| `tab` | hide the model selector and expand the log pane; press again to restore |
|
|
366
|
+
| `q` | quit (does **not** stop running models) |
|
|
367
|
+
|
|
368
|
+
With the selector hidden (`tab`), the log pane grows to fill the space and the arrow keys switch roles:
|
|
369
|
+
|
|
370
|
+
| key | action |
|
|
371
|
+
| --------------------- | ---------------------------------------------------- |
|
|
372
|
+
| mouse wheel | scroll the log (3 lines per notch) |
|
|
373
|
+
| `↑` / `↓` | scroll the log one line at a time |
|
|
374
|
+
| `PgUp` / `PgDn` | scroll by half a page |
|
|
375
|
+
| `g` / `Home` | jump to the top of the buffer |
|
|
376
|
+
| `G` / `End` | jump back to the tail (resumes live follow) |
|
|
377
|
+
|
|
378
|
+
When scrolled up, the header shows `+N ↑ paused` and the log stops auto-updating until you return to the tail. All other keys (`r`, `k`, `⏎`, `tab`) still act on the model you had selected before hiding the list.
|
|
379
|
+
|
|
380
|
+
Mouse reporting is enabled only while the TUI is running (SGR mode, `\x1b[?1000h\x1b[?1006h`) and disabled on exit, including on uncaught exceptions and `SIGTERM`/`SIGHUP`. While it's active, click-and-drag text selection in some terminals (iTerm2, Terminal.app) requires holding `⌥`/`Alt`; copy-on-select typically still works. If the process is killed with `SIGKILL`, nothing can reset the terminal — run `reset` or relaunch the TUI to restore it.
|
|
381
|
+
|
|
382
|
+
The bottom pane continuously tails the log file of whichever model is highlighted. When any model enters the running set — whether you started it, restarted it, or the router auto-started it on an incoming request — the cursor jumps to it so its logs appear immediately; if an active filter hides the newcomer, the filter is cleared.
|
|
383
|
+
|
|
384
|
+
Press `tab` for a full-screen log view that shows model details (id, runtime, port, path), live instance telemetry (pid, uptime, CPU, RSS, tok/s), and a larger log tail. It honors the same cursor-follows-active behavior, so a router-driven model swap auto-switches the view to the new active model. `tab` again returns to the split list+log layout.
|
|
385
|
+
|
|
386
|
+
Models downloaded out-of-band (`hf download` in another terminal, or pulled while the TUI was closed) are picked up automatically: every TUI start runs a scan, and while the TUI is running an `fs.watch` on `modelDirs.mlx` / `modelDirs.llama` debounces cache changes into an incremental `ingestDiscovered` call. New entries toast in the footer as `+N new: <slug>…`. Pressing `s` still works as an explicit rescan.
|
|
387
|
+
|
|
388
|
+
## Configuration
|
|
389
|
+
|
|
390
|
+
`~/.athanor/config.json`. Missing fields fall back to these defaults:
|
|
391
|
+
|
|
392
|
+
```json
|
|
393
|
+
{
|
|
394
|
+
"portRange": { "min": 8081, "max": 8099 },
|
|
395
|
+
"enablePiSync": true,
|
|
396
|
+
"modelDirs": {
|
|
397
|
+
"mlx": "~/.cache/huggingface/hub",
|
|
398
|
+
"llama": "~/.models"
|
|
399
|
+
},
|
|
400
|
+
"mlx": {
|
|
401
|
+
"prefillStepSize": 512,
|
|
402
|
+
"promptCacheSize": 16384,
|
|
403
|
+
"decodeConcurrency": 1
|
|
404
|
+
},
|
|
405
|
+
"llama": {
|
|
406
|
+
"nGpuLayers": 999,
|
|
407
|
+
"threads": 8,
|
|
408
|
+
"ctxSize": 16384,
|
|
409
|
+
"batchSize": 512,
|
|
410
|
+
"ubatchSize": 256,
|
|
411
|
+
"parallel": 1
|
|
412
|
+
},
|
|
413
|
+
"supervisor": {
|
|
414
|
+
"policy": "single-active",
|
|
415
|
+
"maxConcurrent": 1,
|
|
416
|
+
"startupTimeoutMs": 120000,
|
|
417
|
+
"healthPollIntervalMs": 500
|
|
418
|
+
},
|
|
419
|
+
"controlApi": {
|
|
420
|
+
"enabled": false,
|
|
421
|
+
"port": 8079,
|
|
422
|
+
"host": "127.0.0.1"
|
|
423
|
+
},
|
|
424
|
+
"router": {
|
|
425
|
+
"enabled": false,
|
|
426
|
+
"port": 8080,
|
|
427
|
+
"host": "127.0.0.1",
|
|
428
|
+
"drainTimeoutMs": 30000
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Per-model presets
|
|
434
|
+
|
|
435
|
+
`mlx` and `llama` above are **global defaults**. Athanor now ships a practical 16K default context baseline; built-in recipes scale that up or down by use case. Any model in the registry can override the globals with its `preset` field, which is merged on top per-runtime. Manage presets via the CLI (preferred) or the TUI (press `e` on a highlighted model):
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
# inspect effective config, launch command, and running state
|
|
439
|
+
athanor show qwen-32b
|
|
440
|
+
|
|
441
|
+
# set / unset individual fields — kebab-case and camelCase both work
|
|
442
|
+
athanor preset qwen-32b set ctx-size=32768 nGpuLayers=48
|
|
443
|
+
athanor preset qwen-32b unset ctx-size
|
|
444
|
+
athanor preset qwen-32b clear
|
|
445
|
+
|
|
446
|
+
# apply a named recipe for the model's runtime
|
|
447
|
+
athanor preset qwen-32b apply coding
|
|
448
|
+
|
|
449
|
+
# list built-in + user recipes and every tunable key per runtime
|
|
450
|
+
athanor recipes
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Built-in recipes: `balanced`, `fast`, `quality`, `long-context`, `coding`.
|
|
454
|
+
|
|
455
|
+
- `balanced` — recommended default, 16K context
|
|
456
|
+
- `fast` — lower latency, 8K context
|
|
457
|
+
- `quality` — larger 32K context for more stable long reasoning
|
|
458
|
+
- `coding` — 32K context for multi-file and agent workflows
|
|
459
|
+
- `long-context` — 64K context, higher memory use
|
|
460
|
+
|
|
461
|
+
`balanced` is an explicit preset recipe; clearing a preset is a separate action (`athanor preset <slug> clear`). Drop your own into `~/.athanor/recipes.json` (a plain list or `{ "recipes": [...] }`); user recipes override built-ins of the same name.
|
|
462
|
+
|
|
463
|
+
Presets survive re-scans: `athanor scan` only refreshes `path`, `sizeBytes`, and — for MLX — `mlxCapabilities`. Everything else is left alone. `athanor ls` marks tuned models with `[tuned]`.
|
|
464
|
+
|
|
465
|
+
Under the hood, a preset looks like this in `~/.athanor/models.json` — you can edit it directly if you prefer:
|
|
466
|
+
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"id": "mlx-community/Qwen2.5-32B-Instruct-4bit",
|
|
470
|
+
"slug": "qwen-32b",
|
|
471
|
+
"preset": {
|
|
472
|
+
"runtime": "mlx",
|
|
473
|
+
"mlx": { "decodeConcurrency": 1, "prefillStepSize": 512, "promptCacheSize": 32768 }
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Restart the model for the preset to take effect.
|
|
479
|
+
|
|
480
|
+
pi-agent receives the model's effective served context window from athanor's merged runtime configuration (global defaults plus any per-model preset), so pi metadata matches the actual launch settings rather than only explicit override fields.
|
|
481
|
+
|
|
482
|
+
### Environment variables
|
|
483
|
+
|
|
484
|
+
- `ATHANOR_HOME` — overrides `~/.athanor`. Useful for running multiple profiles side by side or for tests.
|
|
485
|
+
- `PI_HOME` — overrides `~/.pi`.
|
|
486
|
+
|
|
487
|
+
## Finding new models
|
|
488
|
+
|
|
489
|
+
Browse the Hub without leaving the terminal. Both commands query `https://huggingface.co/api/models` with MLX/GGUF tag filters and print a grouped, readable list. No auth is required for public models.
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
# free-text search, both runtimes (default)
|
|
493
|
+
athanor search qwen
|
|
494
|
+
|
|
495
|
+
# restrict to one runtime
|
|
496
|
+
athanor search coder --mlx
|
|
497
|
+
athanor search llama --gguf
|
|
498
|
+
|
|
499
|
+
# by author and sort key
|
|
500
|
+
athanor search --author mlx-community --sort downloads --limit 30
|
|
501
|
+
athanor search --author bartowski --gguf --sort likes
|
|
502
|
+
|
|
503
|
+
# what's hot right now (sorts by HF's trendingScore)
|
|
504
|
+
athanor trending
|
|
505
|
+
athanor trending --mlx --limit 15
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Supported sorts: `downloads` (default), `likes`, `trending`, `modified`, `size`. Each row shows download count, likes, license, and a relative last-modified time. The footer hints at the follow-up:
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
→ athanor pull <repo> # MLX: downloads the whole repo
|
|
512
|
+
→ athanor pull <repo> --file F.gguf # GGUF: pick one file
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## HuggingFace pull
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
athanor pull mlx-community/Qwen2.5-7B-Instruct-4bit
|
|
519
|
+
athanor pull bartowski/Meta-Llama-3.1-8B-Instruct-GGUF \
|
|
520
|
+
--file Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
What happens:
|
|
524
|
+
|
|
525
|
+
1. `GET https://huggingface.co/api/models/<repo>` is used to list siblings and decide runtime.
|
|
526
|
+
- any `.gguf` sibling → `llama.cpp` (you must specify `--file` if more than one exists)
|
|
527
|
+
- `tags: ["mlx"]` or `mlx` in the repo id → `mlx`
|
|
528
|
+
- `.safetensors` only, nothing matching MLX → fallback to `mlx`
|
|
529
|
+
2. `hf download` is invoked, output streamed.
|
|
530
|
+
3. On success, a registry entry is created with `publish: true`, a fresh port from `portRange`, and `piAlias: slug`.
|
|
531
|
+
|
|
532
|
+
Cancellation is safe: press `Ctrl-C` during `athanor pull` (or `Esc` in the TUI pull modal) and athanor SIGTERMs the `hf` child — escalating to SIGKILL after 3s if it ignores the signal — and exits with code 130. No registry entry is written on abort, so you can re-run the same `pull` later without cleanup.
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
## Control API (optional)
|
|
536
|
+
|
|
537
|
+
When `controlApi.enabled` is `true`, athanor exposes a small local HTTP server (default `127.0.0.1:8079`) that other tools can drive:
|
|
538
|
+
|
|
539
|
+
```
|
|
540
|
+
GET /status running instances + registry summary
|
|
541
|
+
POST /activate { "id": "<id|slug>" } start a model (respects supervisor policy)
|
|
542
|
+
POST /deactivate { "id": "<id|slug>" } stop a model
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
This is off by default. Enable it only on trusted machines.
|
|
546
|
+
|
|
547
|
+
## Router (optional)
|
|
548
|
+
|
|
549
|
+
When `router.enabled` is `true`, athanor exposes an OpenAI-compatible proxy (default `127.0.0.1:8080`) that fronts every exposed model on a single port. Pi-agent then sees up to **two** providers — `athanor-mlx` and `athanor-llama` — both pointing at the router, each listing only models of its runtime. The split exists because pi's per-provider compat flags differ between engines (mlx_lm/vlm don't accept the `developer` role; llama-server does), and it also makes it obvious in pi's `/model` picker which backend is serving a given request. Switching models inside pi becomes a normal "different `model` field in the request body" swap, and athanor starts the target on demand (respecting supervisor policy) before proxying the request.
|
|
550
|
+
|
|
551
|
+
```
|
|
552
|
+
GET /health 200 OK
|
|
553
|
+
GET /v1/models synthesised list of exposed models
|
|
554
|
+
POST /v1/chat/completions { "model": ... } activate + proxy (SSE streamed through)
|
|
555
|
+
POST /v1/completions { "model": ... } same
|
|
556
|
+
POST /v1/embeddings { "model": ... } same
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
Enable it by adding to `~/.athanor/config.json`:
|
|
560
|
+
|
|
561
|
+
```json
|
|
562
|
+
{ "router": { "enabled": true, "port": 8080, "host": "127.0.0.1", "drainTimeoutMs": 30000 } }
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
With router mode on, pi sync emits only the aggregator providers (not per-model providers). If you've exposed only MLX models you'll see `athanor-mlx` alone; only GGUF, just `athanor-llama`. The `model` field in requests may be the runtime's model id (the HF repo for MLX, the launch alias for llama.cpp), the athanor slug, or the canonical id; all three are resolved. Unknown models return `404`.
|
|
566
|
+
|
|
567
|
+
For users who don't want to keep the TUI open, `athanor router` runs the server in the foreground and blocks on `Ctrl-C`:
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
athanor router # uses config.router.host / .port
|
|
571
|
+
athanor router --port 9000 # override
|
|
572
|
+
athanor router --host 0.0.0.0 --port 8080
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
The subcommand ignores `router.enabled` — invoking it is itself the opt-in — but it still respects `127.0.0.1` as the default host. It shares the same pi-sync shape, so you can leave `router.enabled: false` in config and only start the router when you want it.
|
|
576
|
+
|
|
577
|
+
Caveats:
|
|
578
|
+
|
|
579
|
+
- **Cold start.** First request on an idle model blocks until the runtime is healthy (often 10–60s for large MLX). No keepalive is injected into the stream — make sure your client's timeout is generous.
|
|
580
|
+
- **In-flight safety.** `athanor stop` on a currently-streaming model waits briefly (up to `router.drainTimeoutMs`, default 30s) for open proxied streams to finish before SIGTERM; past that, the runtime is terminated and in-flight responses are cut.
|
|
581
|
+
- **Listen posture.** Same as the control API: `127.0.0.1` only, no auth, off by default.
|
|
582
|
+
|
|
583
|
+
## Troubleshooting
|
|
584
|
+
|
|
585
|
+
- **`athanor start` hangs or times out.** Check `~/.athanor/logs/<slug>-<pid>.log`. Most startup failures are the runtime itself complaining (missing weights, wrong quant, out of memory). Raise `supervisor.startupTimeoutMs` for very large models.
|
|
586
|
+
- **`port already in use`.** Another process is on the model's stable port. Either stop it, or edit the entry's `port` in `~/.athanor/models.json` and restart.
|
|
587
|
+
- **Pi-agent can't see a new model.** Make sure it's exposed (CLI: `athanor expose <slug>`) and run `athanor sync`. Confirm `~/.pi/agent/models.json` contains a provider named `athanor-<runtime>-<slug>` with the expected `baseUrl`, then open `/model` in pi (the file reloads on open).
|
|
588
|
+
- **Models from other tools disappeared from pi.** They shouldn't — athanor only rewrites providers whose name starts with `athanor-`. If this happens, open an issue with the before/after of `~/.pi/agent/models.json`.
|
|
589
|
+
- **Stale PID in registry.** If a child crashed without athanor noticing, `athanor status` will show nothing running but the port might be held. Run `athanor stop <slug>` (a no-op when nothing is live) then `athanor start <slug>`.
|
|
590
|
+
- **`doctor` reports a missing binary.** Install `mlx_lm`, `mlx_vlm`, `llama.cpp`, or `huggingface_hub`, or adjust your shell's `PATH`. `mlx_vlm.server` is only needed if you plan to run VLM models; `athanor start` on a VLM entry will fail with a clear error if it's missing.
|
|
591
|
+
|
|
592
|
+
## Development
|
|
593
|
+
|
|
594
|
+
```bash
|
|
595
|
+
npm install
|
|
596
|
+
npx tsc --noEmit # typecheck
|
|
597
|
+
npm run test:run # vitest run (one shot)
|
|
598
|
+
npm test # vitest (watch)
|
|
599
|
+
npm run build # tsc -> dist/
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
Tests redirect `ATHANOR_HOME` and `PI_HOME` to per-run temporary directories via `test/setup.ts`, so running the suite never touches your real config.
|
|
603
|
+
|
|
604
|
+
### Layout
|
|
605
|
+
|
|
606
|
+
```
|
|
607
|
+
src/
|
|
608
|
+
adapters/ # mlx (lm + vlm) + llama.cpp command builders and health probes
|
|
609
|
+
cli/ # hand-rolled CLI dispatcher, doctor, output formatting
|
|
610
|
+
config/ # config file load + defaults
|
|
611
|
+
control/ # optional HTTP control API (off by default)
|
|
612
|
+
discovery/ # HF cache scanner + registry ingest (MLX capability detection lives here)
|
|
613
|
+
presets/ # preset merge, tunable-key metadata, recipes
|
|
614
|
+
pull/ # HuggingFace repo inspection and download
|
|
615
|
+
registry/ # models.json CRUD, slug + port allocation
|
|
616
|
+
search/ # HuggingFace Hub search + trending
|
|
617
|
+
supervisor/ # detached process lifecycle, policy, reattach
|
|
618
|
+
sync/ # namespaced pi-agent catalog merge
|
|
619
|
+
ui/ # Ink TUI (list, pull modal, preset editor)
|
|
620
|
+
types/ # shared types
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
## License
|
|
624
|
+
|
|
625
|
+
Copyright 2026 Myles Borins.
|
|
626
|
+
|
|
627
|
+
Licensed under the Apache License, Version 2.0. See [`LICENSE`](./LICENSE) for the full text, or <http://www.apache.org/licenses/LICENSE-2.0> for the canonical copy.
|
package/bin/athanor
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__fixtures.d.ts","sourceRoot":"","sources":["../../src/adapters/__fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,wBAAgB,QAAQ,CAAC,SAAS,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAaxE;AAED,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAa1E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function mlxEntry(overrides = {}) {
|
|
2
|
+
return {
|
|
3
|
+
id: "mlx-community/Test-4bit",
|
|
4
|
+
slug: "test-4bit",
|
|
5
|
+
path: "/models/test-mlx",
|
|
6
|
+
runtime: "mlx",
|
|
7
|
+
source: { type: "hf", repo: "mlx-community/Test-4bit" },
|
|
8
|
+
port: 8081,
|
|
9
|
+
publish: true,
|
|
10
|
+
piAlias: "test-4bit",
|
|
11
|
+
addedAt: 1,
|
|
12
|
+
...overrides
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function llamaEntry(overrides = {}) {
|
|
16
|
+
return {
|
|
17
|
+
id: "test.gguf",
|
|
18
|
+
slug: "test-gguf",
|
|
19
|
+
path: "/models/test.gguf",
|
|
20
|
+
runtime: "llama.cpp",
|
|
21
|
+
source: { type: "local" },
|
|
22
|
+
port: 8082,
|
|
23
|
+
publish: true,
|
|
24
|
+
piAlias: "test-gguf",
|
|
25
|
+
addedAt: 1,
|
|
26
|
+
...overrides
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=__fixtures.js.map
|