Model interface for runtimes and routes

What other programs can rely on from lnk model.

lnk model

The commands of lnk model other programs read, each with its output and who reads it.

lnk model runtime list --json

[{"name", "base_url", "models": ["..."], "added"?}], one entry per runtime found, at a default port or an address lnk model runtime add remembers: name then the one it was given, and added true. An address added at a runtime's default port keeps that runtime's name, added true too.

--start

With --start, it lists after starting an installed Ollama that isn't running. Read by lnk agent start (--start: offers the models here, Ollama's too when it was stopped).

lnk model serve --json

One line, {"url", "description"}, once it listens on a 127.0.0.1 port; it stops when its stdin closes. Exit status 2: no runtime here serves the model named.

lnk model share

lnk model share reads it, opening a tunnel to that port (lnk tunnel open <port>), and on status 2 offers lnk model install.

A memory engine's model

lnk agent memory serve reads it for a memory engine's model, and passes <url> to the engine as $LNK_MEMORY_MODEL, empty on status 3 or when no line comes within 10 s.

Link Memory with --embed <model>, run outside a sandbox, reads it and calls <url>/v1/embeddings while it serves; on status 3 it searches by words and says lnk model install <model>.

lnk model recommend --json

{"model", "size", "why"}, or null where Link recommends no local model. Read by lnk agent start, which offers to install it when no model runs here.

lnk model install <model> --yes

Exit status 0 once the model is pulled and Ollama lists it. Read by lnk agent start, which installs the local model picked.