Proxy in front of vLLM too; dashboard reset/clear; opencode effort variants

- Move the MLX proxy into backends/proxy.py and run it on both backends:
  public port 1134 is the proxy, the model server listens on 127.0.0.1:1135.
  On vLLM this brings the reasoning chooser, the "default" alias and the
  per-request table. Effort levels the model lacks map to the nearest it has
  (high -> xhigh on qwen3.8); vLLM's own key is sent upstream; streamed runs
  are counted from the usage chunk (MTP packs several tokens per chunk).
- Dashboard: restore METRIC_RE (vLLM page stuck on "loading"); Statistics
  header with Reset, Requests header with Clear; drop the TTFT chart; rename
  token columns; Peak KV shows "-" when no samples cover a run.
- opencode: config snippet's model points at <provider>/default, and
  reasoning models get variants built from the levels the template accepts.
- README: proxy on both platforms; NVIDIA checklist split into verified / open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-03 13:03:52 -08:00
parent 1121c3f908
commit 8879db44a0
12 changed files with 886 additions and 493 deletions

View file

@ -140,8 +140,8 @@ def cmd_setup(a):
# Our own services would hold the ports on a re-run; stop them so anything still
# listening belongs to another program. (--no-start leaves a running setup alone.)
# MLX needs two ports: the proxy, and mlx_lm.server on the next one.
api_span = 2 if p["backend"] == "mlx" else 1
# Two ports: the proxy, and the model server behind it on the next one.
api_span = 2
if not a.no_start:
with Spinner("Stopping llm-host's running services"):
for name in service.NAMES:
@ -474,7 +474,7 @@ def cmd_opencode(a):
snippet = {
"$schema": "https://opencode.ai/config.json",
"provider": {prov: opencode.provider_block(cfg, host, keyfile, host)},
"model": f"{prov}/{cfg['active']}",
"model": f"{prov}/{plan.SERVED_ALIAS}", # the block's only entry
}
if a.json:
say(json.dumps(snippet, indent=2))
@ -549,7 +549,7 @@ def cmd_uninstall(a):
# Stopping returns before the processes have exited (launchd especially). Wait, so a
# reinstall right after this finds the ports free instead of moving to other ones.
if cfg.get("api_port"):
span = 2 if cfg.get("backend") == "mlx" else 1
span = 2 # the proxy and the model server behind it
ours = list(range(cfg["api_port"], cfg["api_port"] + span)) + ([cfg["web_port"]] if cfg.get("web_port") else [])
with Spinner("Waiting for the services to exit"):
wait_ports_free(ours, timeout=30)
@ -621,7 +621,7 @@ def cmd_run_model(a):
say(f"llm-host {VERSION}: starting {entry['name']} ({choice['repo']}, {choice['format']}) on {cfg['backend']}")
if cfg["backend"] == "vllm":
from .backends import vllm
vllm.exec_server(cfg, plan.vllm_args(entry, choice, cfg["api_port"], cfg.get("tp", 1)))
vllm.run_server(cfg, entry, choice, plan.vllm_args(entry, choice, cfg["api_port"] + 1, cfg.get("tp", 1)))
else:
from .backends import mlx
mlx.run_server(cfg, entry, choice, plan.mlx_args(entry, choice, cfg["api_port"] + 1))