omp packages

pi-omlx-discovery0.1.0

Pi extension: your local oMLX server's models in /model, discovered live, with your models.json tuning kept and the oMLX key never stored.

jpbraga Published 9 days ago MIT ~329 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-omlx-discovery

npm test license

A Pi extension that fills Pi's omlx provider with the models your local oMLX server actually serves.

  • Live list. Load a model into oMLX and it shows up in /model; remove it and it disappears.
  • Only chat models. DFlash draft helpers, hidden models, and audio or embedding models stay out of the list.
  • Real limits. Context window, output limit, image input for vision models, and Pi's thinking levels mapped onto the reasoning levels each model accepts, all as oMLX reports them.
  • Your tuning wins. A model you already describe in models.json keeps your settings.
  • No stored key. The oMLX key is read when it is needed and never written anywhere.
  • Zero setup on the Mac that runs oMLX. The port and key come from oMLX's own settings.

Tested with Pi 1.6.0 and oMLX 0.8.3.

Install

pi install npm:pi-omlx-discovery

Or straight from GitHub:

pi install git:github.com/jpbraga/pi-omlx-discovery

Then open /model: your oMLX models are listed under omlx.

How it finds oMLX

Setting Taken from, first found wins
Base URL providers.omlx.baseUrl in models.json → OMLX_BASE_URL → the port in ~/.omlx/settings.json (on 127.0.0.1) → http://127.0.0.1:8000/v1
API key providers.omlx.apiKey in models.json (literal, $VAR or !command) → OMLX_API_KEY → auth.api_key in ~/.omlx/settings.json → none (keyless server)

OMLX_SETTINGS_PATH points at another oMLX settings file. A key read from oMLX's settings stays in Pi's memory only; after changing it in oMLX, run /reload in Pi.

oMLX on another machine

On the Mac that runs oMLX nothing needs configuring. From another computer on the network, tell the extension where oMLX is and which key to use. oMLX sub-keys work, so each computer can have its own key that you can revoke on its own.

With environment variables (macOS or Linux):

export OMLX_BASE_URL=http://192.168.1.50:8000
export OMLX_API_KEY=your-omlx-sub-key

On Windows (PowerShell):

[Environment]::SetEnvironmentVariable("OMLX_BASE_URL", "http://192.168.1.50:8000", "User")
[Environment]::SetEnvironmentVariable("OMLX_API_KEY", "your-omlx-sub-key", "User")

Or in that computer's models.json (~/.pi/agent/models.json, on Windows %USERPROFILE%\.pi\agent\models.json):

{
  "providers": {
    "omlx": {
      "baseUrl": "http://192.168.1.50:8000/v1",
      "apiKey": "$OMLX_API_KEY"
    }
  }
}

Prefer a reference to the key over the key itself: "$OMLX_API_KEY" reads an environment variable, and a !command reads it from a secret store when Pi needs it, such as the macOS Keychain with "!security find-generic-password -s omlx -w".

oMLX must listen on the network for this, with its server host set to 0.0.0.0 rather than 127.0.0.1. On such a server oMLX asks for a key on every request, from the same Mac too.

When the list is refreshed

  • Pi starts with the last list oMLX gave, so startup never waits on the network.
  • Each session then asks oMLX once, in the background.
  • Opening /model asks again.
  • /omlx-models asks right away and shows what oMLX serves.

If oMLX is down, refuses the key or has not finished starting, the current list stays as it is.

What each model gets

From oMLX's GET /v1/models/status:

Pi field From oMLX
contextWindow max_context_window
maxTokens max_tokens
input ["text", "image"] for vision models (model_type: vlm), else ["text"]
reasoning true when the model lists reasoning levels or thinks by default
thinkingLevelMap Pi's minimal … max sent as the same reasoning_effort when the model accepts it, off as none; levels it does not accept are unavailable

Every model uses the openai-completions API with oMLX's compatibility settings: no developer role and max_tokens as the output limit field.

Keep your own settings

Describe a model under providers.omlx.models in ~/.pi/agent/models.json and your entry replaces the discovered values for that model, field by field. Fields you leave out still come from oMLX:

{
  "providers": {
    "omlx": {
      "models": [
        {
          "id": "Qwen3.8-27B-8bit",
          "name": "Qwen 27B (8-bit)",
          "maxTokens": 32768,
          "samplingParamsByThinkingLevel": {
            "off": { "temperature": 0.7, "top_p": 0.8 }
          }
        }
      ]
    }
  }
}

An entry for a model that oMLX no longer serves is not listed. providers.omlx.modelOverrides works too, as for any Pi provider, and applies on top of everything.

Privacy

The extension talks only to the oMLX base URL above. It sends no telemetry and writes no files. Pi keeps the last model list (ids and limits, no key) in its own model store.

Development

npm test

The tests use Node's built-in test runner on the TypeScript source and need Node 22.18 or later. They do not need a running oMLX or Pi.

License

MIT