← Catalog

@rolemodel/pi-omlx

Registers omlx hosts from models.json as native pi providers with dynamic model discovery and safe key storage

Extension

Install

Install with PiG

pig install npm:@rolemodel/pi-omlx

Install with Pi

pi install npm:@rolemodel/pi-omlx
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.

@rolemodel/pi-omlx — oMLX for pi

Turn any number of oMLX (OpenAI-compatible) servers into first-class pi providers. Each machine you connect — your laptop, a Mac Studio on the LAN, a NAS box — becomes its own named provider in /model and /login, with dynamic model discovery, safe key storage in auth.json, live status (/omlx-status), and per-host model visibility control.

The commands

CommandWhat it's for
/login omlxConnect. The oMLX entry point: add a new server, connect this machine, or update any host (URL, name, key).
/login <host-id>Re-authenticate one host directly (e.g. /login omlx-mac-studio).
/omlxManage. List every host with its endpoint, key source, and model count; add, update, or remove a host.
/omlx-statusInspect. Live view of every host: fleet totals, loaded models, active requests, free memory, pressure, measured speed.
omlx_status (tool)The same status for the agent — ranks hosts by capacity so it can load-balance across your machines.
omlx_usage (tool)Fleet utilization: token-usage history per host and per model, cache efficiency, and a day×hour activity heatmap (today/7d/30d/…).
omlx_logs (tool)Diagnose: tail a host's server log (with optional filter) — no SSH needed.
omlx_admin (tool)Operate: load/unload models, clear SSD/hot KV caches, change runtime settings, abort a request, restart a server.
omlx_bench (tool)Measure: run the oMLX throughput benchmark on one host — or every host at once — and get a side-by-side tok/s comparison.
/omlx-modelsHide models from a host's catalog (persistent, per host).
/omlx-usage [range] [host]Visual usage. The omlx_usage data as a TUI overlay: per-host/per-model totals and a colored day×hour heatmap.
/omlx-logs [host] [filter]Visual logs. The omlx_logs tail as a TUI overlay with ERROR/WARN highlighted.
/omlx-adminOperator UI. Pick-driven load/unload/abort/clear-cache/settings/restart for one host.
/omlx-bench [model] [host]Visual bench. The omlx_bench run as a live overlay — per-host progress, then a side-by-side comparison.

Which to use more: connect and update servers through /login — that's the surface built for it, and it's where keys are entered safely. Use /omlx when you want an overview of your hosts or need to remove one. Both share the same setup code, so either works for add/update.

How it works

Each oMLX host is a native pi provider, registered through pi's provider extension API:

  • Discovery — pi refreshes each host's catalog on startup, when you open /model, after login, and on /reload. Catalogs persist to ~/.pi/agent/models-store.json and restore offline.
  • Streaming — delegated to pi's built-in OpenAI-compatible implementation; nothing about your session flow is custom.
  • Auth — every host shows up in /login. Keys are stored in ~/.pi/agent/auth.json, never in models.json.
  • Naming — every host has a display name, so /model and /login make it obvious which machine's model you are using.

Quick start

pi install npm:@rolemodel/pi-omlx

Then in pi, run /login and pick oMLX (or type /login omlx):

oMLX — what do you want to do?
→ Add an oMLX server (enter its URL)
  Connect this machine (http://localhost:8000/v1)
  Cancel
  • Add an oMLX server — for a different machine: enter its URL (the bare host:port is fine — /v1 is appended automatically), a display name, and its API key.
  • Connect this machine — for the local oMLX server: a display name (Enter uses your hostname) and an API key (Enter if oMLX's "Skip API key verification" is on).

The host is written to ~/.pi/agent/models.json, the key to auth.json, its models are fetched, and you can open /model and start using them. Add more machines the same way — one per machine.

Multiple hosts

Any number of hosts, e.g. your laptop plus a more powerful Mac Studio:

{
  "providers": {
    "omlx": {
      "name": "MacBook Pro",
      "baseUrl": "http://localhost:8000/v1"
    },
    "omlx-mac-studio": {
      "name": "Mac Studio",
      "baseUrl": "http://192.168.1.10:8000"
    }
  }
}

Each host becomes a separate provider in /model (MacBook Pro, Mac Studio) with its own models and its own /login entry. Non-omlx* entries (e.g. ollama) are untouched. Host ids are omlx (local) or omlx-<slug>; the display name is independent and shown everywhere in the UI.

The omlx id is always available in /login as the entry point — even when only omlx-<slug> hosts are configured — so adding a second or third machine is always /login omlx → Add an oMLX server.

The /login flow

/login omlx — the oMLX entry point. A menu with:

  • Add an oMLX server (enter its URL) — the remote wizard: URL (normalized), display name, key.
  • Connect this machine (http://localhost:8000/v1) — shown while the local omlx host is not configured yet; sets it up.
  • Update <host> (url) — for each configured host: server URL, display name, API key. Enter on any prompt keeps the current value. Changing the URL or name applies immediately (no /reload).
  • Cancel

/login omlx-<slug> — re-configures that specific host with the same three prompts, no menu.

"Keep the current key" resolves the stored key, then the host's env var, then the models.json apiKey (literal or $ENV_VAR). If none is readable (e.g. a !command value), you are asked to type the key rather than accidentally clearing it.

/omlx — manage hosts

oMLX hosts — choose one:
→ oMLX — http://localhost:8000/v1 (key: stored credential; 17 models)
  Mac Studio — http://192.168.1.10:8000/v1 (key: env var; 3 models)
  Add an oMLX server
  Cancel

Picking a host offers Update this host (URL, name, key) and Remove this host (with confirmation; a stored key stays in auth.json — run /logout <id> to drop it).

/omlx-status — live host capacity

Built on oMLX's admin API (/admin/api/activity, /admin/api/models, /admin/api/device-info, /admin/api/stats). The dialog is live two ways: it re-fetches from the server every 4 seconds, and it ticks every second in between so the idle timer (counts up) and the ev eviction countdown (counts down) move smoothly instead of jumping in 4s steps (a failed fetch keeps the last known data; the footer shows the last fetch time).

╭──────────────────────────────────────────────────────────────────────────────╮
│ oMLX Status                                                                  │
│ fleet  2/3 online · 3 active, 1 queued · 174M tok served · cache 98%        │
│ MacBook Pro — http://localhost:8000/v1                                       │
│   M5 Max · 128 GB · 40 GPU                                                   │
│   mem 31.9 GB/94.5 GB (62.6 GB free) · ok · 0 active, 0 queued               │
│   speed  up 2d 4h · 37.7 t/s gen · 329 t/s prefill · cache 98% · 91M tok     │
│   cache  SSD 77.6 GB/74.0 GB · hot 8.0 GB/8.0 GB                             │
│   ● Qwen3.8-27B-oQ4e-mtp           16.5 GB  1 generating, 2 active · pin     │
│   ○ Kokoro-82M-4bit                270 MB   idle 1.5h · ev 29m 33s           │
│   not loaded (3): LFM3-Omni-2B-MLX-4bit, Qwen3-TTS-12Hz-1.7B-Base-4bit,...   │
│                                                                              │
│ Mac Studio — http://192.168.1.10:8000/v1                                     │
│   M3 Ultra · 512 GB · 80 GPU                                                 │
│   mem 45.2 GB/508 GB (462.8 GB free) · ok · 3 active, 1 queued               │
│   speed  up 12d · 118 t/s gen · 1204 t/s prefill · cache 95% · 83M tok       │
│   ● LFM2.5-8B-A1B-oQ4e             4.1 GB   3 generating, 3 active           │
│   not loaded (2): gemma-4-26B-A4B-it-oQ4e-mtp, my-model                      │
│                                                                              │
│ NAS — http://192.168.1.20:8000/v1                                            │
│   OFFLINE — unreachable (connect ECONNREFUSED 192.168.1.20:8000)             │
│                                                                              │
│ Best target: Mac Studio (462.8 GB free, 118.0 tok/s) vs MacBook Pro (62.6.. │
│                                                                              │
│ live 4:40:51 PM · 1–19/24 · ● busy ○ idle ◌ loading · ↑↓ scroll · enter/esc  │
╰──────────────────────────────────────────────────────────────────────────────╯

(Shown at 80 columns — long lines truncate there; widen the terminal for more.)

  • The fleet line aggregates the whole rack: hosts online, requests in flight, tokens served this session, and aggregate cache efficiency.
  • The speed line is measured, not estimated: decode/prefill tokens per second oMLX has actually sustained, plus uptime and session totals.
  • The cache line shows the KV-cache footprint: SSD (disk) and hot (memory) tiers, used/max.
  • ● = serving requests now, ○ = loaded but idle, ◌ = loading. A busy model shows its live counts (1 generating, 2 active, plus prefilling when warm); an idle one shows idle <time> (time since its last request, so it climbs) and ev <time> (countdown until oMLX evicts it under memory pressure). pin = pinned (never evicted).
  • The not loaded list hides models you've ignored in /omlx-models for that host — they never enter the PI catalog, so listing them adds no signal. A model that is loaded is still shown even if ignored (it's resident and using memory, which is the point of this view).
  • Scrolling: ↑↓/jk, PgUp/PgDn, Home/End, and the mouse wheel (when the pointer is over the dialog). The footer shows the current window (1–19/24).
  • Best target names the host ranked first (most free model memory, then highest measured decode speed, then least in-flight load) against the runner-up; with a single host online it reads only host online: …, and when none are reachable it says so.
  • Width is shed from expendable parts only: model names truncate first, then the not-loaded list — machine facts, request counts, state and eviction always fit.
  • A host whose admin API rejects the key is reported with the reason (the admin API only accepts the host's main API key — sub keys get 401).

The omlx_status tool (agent load-balancing)

The same data as a tool the agent can call:

  • No argument — ranks every host by free model memory, then in-flight load, lists loaded/not-loaded models, and names the best target with a one-line recommendation.
  • model: "<id>" — where a specific model should run: already loaded and idle first, then loaded-but-busy, then hosts with room to load it, then hosts that can't fit it.

The intended loop: ask omlx_status, then switch the session to a model of the best host (its provider id appears in every line), e.g. with the model picker or /model.

Fleet operations (agent tools)

Four tools turn the agent into a fleet operator. Every one resolves hosts and keys the same way (/login credentials, env vars, models.json), and every one works against any number of machines at once.

omlx_usage — which machines earned their keep

Reads oMLX's local usage history (/admin/api/usage). Per host and per model: requests, tokens, cached tokens, cache efficiency, generation/prefill tok/s, average request time — for today, yesterday, 7d, 30d, 90d, or month — plus a day×hour activity heatmap.

Fleet (7d): 2 host(s) · 174M tokens · 1,719 req · busiest Mac Studio (83M) · idle: NAS
Local — usage, 7d (2026-11-19 → 2026-11-26)
  totals   832 req · 97.6M tok · cache 98.6% · 34.1 tok/s gen · 298 tok/s prefill · 27.7s avg req
  by model
    Qwen3.8-27B-oQ4e-mtp               776 req · 96.9M tok · 34.1 t/s · cache 98.8%
    Qwen3.6-35B-A3B-oQ4e-mtp            30 req · 488K tok · 89.8 t/s · cache 94.2%
  activity (tokens per hour)
  Nov 19  ▆                         9.5M
  Nov 25          ▄▇    ▄▇█▄  ▄▇▄   88.1M

Answers "has the NAS been doing anything this month?", "which model is slow on ALX?", "how good is our cache reuse?".

omlx_logs — diagnose without SSH

Tails a host's server log (/admin/api/logs) with an optional case-insensitive filter and a list of rotated files. host: "alx", filter: "error" is the whole debugging session for a flaky box.

omlx_admin — load, unload, clean, restart

Actions against one host:

ActionWhat it does
load / unloadPut a model on a machine (or free it). The core of rebalancing: see it fit in omlx_status, load it there, switch the session.
clear-cacheClear the SSD and/or hot KV cache (ssd / hot / both) to reclaim memory or disk.
set-settingRuntime setting change, e.g. {"max_concurrent_requests": 16} — reports which fields applied without a restart.
abortStop one stuck request by id (from the activity view) without unloading the model.
restartRestart the server (only when oMLX runs under a supervisor — the macOS app or brew services).
stats-clearReset session or all-time counters.

omlx_bench — measured speed, one call per fleet

Runs oMLX's bounded throughput benchmark for a model. With a host it benchmarks one machine; without one it launches it on every online machine in parallel and returns a side-by-side table ranked fastest-first:

Fastest for Qwen3.8-27B-oQ4e-mtp: Mac Studio (118.4 tok/s decode)
  host             decode         prefill      TTFT      peak
  Mac Studio       118.4 tok/s    1204 tok/s   0.41s     18.2 GB
  MacBook Pro      37.7 tok/s     329 tok/s    1.41s     18.2 GB

This is the definitive answer to "which box should serve this model" — free-memory ranking can only guess; the benchmark measures. Prompt length (whitelist 1024…200000, default 4096), generation length (default 256), and batch sizes (2/4/8) are tunable; runs take a few minutes and are polled to completion (the bench id is returned if the timeout hits, so a later call can pick it up).

Cost to know: a benchmark run resets that host's KV cache — cached session tokens are lost and the next prompt re-prefills. The same applies to clear-cache, and a server restart is the heaviest of all (drops loaded models, cache, and in-flight requests). Treat these as deliberate operations, not casual ones.

The human commands (same logic, TUI instead of text)

Each operation above is also a slash command that runs the exact same runner the tool calls (./fleet.ts) — the only difference is the renderer: a bordered TUI overlay instead of plain text in the transcript. So what the agent sees and what you see can't drift.

  • /omlx-usage [range] [host] — range defaults to 7d; pick a host or the whole fleet. Totals and per-model rows are colored by health (cache efficiency, tok/s), and the activity heatmap is a real colored heat scale (dim → accent → bold) rather than plain ASCII.
  • /omlx-logs [host] [filter] — pick a host, filter, and line count; the overlay tints ERROR lines red and WARN lines yellow over a dim base.
  • /omlx-admin — pick a host, then an action. Models are picked from the host's live catalog (loaded ones marked ●); the abort action lists actual in-flight request ids; destructive actions (clear-cache, restart) confirm first.
  • /omlx-bench [model] [host] — pick a model (union of every host's catalog), a scope (one host or the fleet), and lengths. The overlay updates live as each host's benchmark progresses, then prints the fastest-first comparison. Closing the overlay early stops pi's polling but the server-side bench keeps running.

Restart is human-only. The omlx_admin tool deliberately has no restart action — an agent should not be able to wipe a machine's loaded models, cache, and in-flight sessions on its own judgment. /omlx-admin (the human command) keeps it, behind a confirm that states the consequences. If you'd rather remove it everywhere, it's a one-line change in admin.ts + the tool's action list.

Authentication

Credentials resolve in this order (first match wins):

  1. Stored credential — from /login. Written to ~/.pi/agent/auth.json (mode 0600), never to models.json. The recommended setup for network-exposed hosts.
  2. Environment variable — OMLX_<SLUG>_API_KEY: OMLX_API_KEY for omlx, OMLX_MAC_STUDIO_API_KEY for omlx-mac-studio, …
  3. models.json apiKey — a literal, $ENV_VAR interpolation, or !command, same syntax as other pi providers. (A keyless stored credential does not shadow this entry.)
  4. noAuth — for hosts with API key verification disabled; a placeholder key is used. Fine for local use; don't expose noAuth hosts to the network.

A host with no resolvable credential is simply unavailable in /model until you log in or set a key.

Migrating an existing key off models.json

  1. Run /login <host> (or /omlx → Update) and leave the key prompt empty — the current key is re-stored into auth.json.
  2. Delete the apiKey field from that host's models.json entry.

/omlx-models

Toggles model visibility per host — hide models you don't need while keeping them selectable by ID. With multiple hosts, pick one first; the picker and the overlay show the host's name and endpoint so it is always clear which server you are editing.

  • ↑↓ navigate, Enter toggles (✓ visible / ✗ hidden) or saves, Esc cancels.
  • Exclusions are stored per host as exact-match excludePatterns and survive restarts; hand-edited globs are additive.

If the host cannot be reached, or its key is rejected, you get a warning with the reason and a pointer to /login <id> instead of an empty list.

/omlx-models vs /scoped-models

They solve different problems:

  • /omlx-models removes models from the oMLX host's catalog — they disappear from /model, pi --list-models, subagents, and anything else that reads the catalog. Persistent, per host, checkbox-driven. Use it to keep a big local model list clean.
  • /scoped-models (pi built-in) scopes which models are usable in the session — the models stay in the catalog, and patterns can pin thinking levels (e.g. omlx-mac-studio/*:high). Use it to narrow a session to one machine or a few models.

Host configuration

Every field is optional; defaults shown. baseUrl is normalized at load time — a trailing slash is dropped and /v1 appended when the path is empty, so http://192.168.1.10:8000, http://192.168.1.10:8000/, and http://192.168.1.10:8000/v1 are equivalent. Other path prefixes (e.g. a proxy or /v2) are kept as-is.

OptionDefaultDescription
namederived from the id (oMLX (mac-studio))Display name shown in /model, /login, and the oMLX commands.
baseUrlhttp://localhost:8000/v1Host endpoint (see normalization above).
apiKey—Literal, $ENV_VAR interpolation, or !command (standard pi syntax). Resolves after the stored credential and env var.
noAuthfalsetrue when the host has API key verification disabled.
api"openai-completions"API mode for the host's models.
autoDiscovertrueSet false to skip live discovery for this host.
excludePatterns[]Glob patterns (or ^id$ exact matches) for models to hide. Managed by /omlx-models.
defaultContextWindow256000Context window for discovered models without an override.
defaultMaxTokens56000Max output tokens for discovered models without an override.
defaultThinkingLevelMap{ "minimal": null, "low": "low", "medium": "medium", "high": "high", "xhigh": null }Maps pi thinking levels to provider values. Set null to disable reasoning for the host's models.

Per-model overrides

Per-model settings use pi's standard models.json modelOverrides — applied by pi itself, so all built-in override fields work (name, reasoning, input, contextWindow, maxTokens, cost, thinkingLevelMap, promptCache, samplingParams, headers, compat, …):

{
  "providers": {
    "omlx": {
      "baseUrl": "http://localhost:8000/v1",
      "modelOverrides": {
        "my-vision-model": {
          "name": "My Vision Model",
          "input": ["text", "image"],
          "contextWindow": 128000
        }
      }
    }
  }
}

Exclusion patterns

Globs support * and ?. To exclude a specific model by exact ID, wrap it with ^ and $:

  • ^tiny-model$ — only the model with the exact ID tiny-model
  • gpt-4-32k* — all models starting with gpt-4-32k
  • *-instruct-* — all models containing instruct

/omlx-models is the easiest way to manage these; manual globs are additive.

Notes

  • A host whose server is unreachable keeps its last known catalog and surfaces a warning instead of disappearing from /model.
  • /omlx-status and the omlx_status tool use the oMLX admin API, which sits at the server root (not under /v1) and accepts only the main API key.
  • pi auth login <host> --api-key from a shell stores a plain API key (pi's built-in flow); use /login inside pi for the full URL/name/key flow.
  • The extension reads models.json at load time; after adding, editing, or removing hosts by hand, run /reload. Changes made through /login, /omlx, and /omlx-models apply immediately.