Commit graph

11 commits

Author SHA1 Message Date
neil
e6ff4ce909 Connect dialog: a complete opencode.json, and a one-line key command
The snippet was only the provider entry, which an empty or missing opencode.json can't take,
and without a "model" opencode starts on its own hosted default and asks for that service's
key. It is now a whole config (schema, provider, model), as `llmhost opencode-config` prints,
with instructions for merging into an existing file.

The key-saving command was two lines; pasted together, the first line's `read` swallowed the
second as the key and no file was written. It's one line now, and writes only a non-empty key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 15:10:49 -08:00
neil
04ff14c58f Dashboard: Connect dialog with the API key and opencode setup
The API key button is Connect again. Besides the key, it walks through adding this server to
opencode: type the API's address (remembered in the browser; prefilled on a LAN visit) and it
fills in a command that saves the key to a 0600 file without it touching shell history, and
the provider block from the same builder as `llmhost opencode-config`. GET /api/connect
replaces /api/key, behind the same sign-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 23:03:56 -08:00
neil
6fd82448c5 Dashboard: an API key button that shows the key with a copy button
Behind the same sign-in as the rest of the dashboard (GET /api/key, no-store), so whoever
can open the dashboard can hand the key to a client without a shell on the server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 22:51:21 -08:00
neil
e814a2359d install-newt: optional internet access via a Pangolin tunnel, with OIDC sign-in on the dashboard
A plain install is unchanged: LAN-only, dashboard behind the API key. `llmhost install-newt`
is the upgrade path. It installs a pinned, sha256-checked newt as a third user service and
switches the dashboard to an OIDC authorization-code + PKCE sign-in limited to allowed groups
or users. The API still takes the key. Secrets live in 0600 files, never in config.json, a
service file or argv. `llmhost remove-newt` undoes it; setup/update keep it; `logs --newt`
shows the tunnel (and `logs -f` now follows the service it was asked for).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:44:09 -08:00
Neil Bantoc
c8f04f49b7 Requests table: durations in h/m/s, and the seconds each phase took
Duration, TTFT and the two new columns use one formatter that grows units only
as the value reaches them: 142 ms, 7.52 s, 31.2 s, then 1m 20s, then
1h 02m 06s. Sub-minute values keep their old precision, which is where almost
every request lives; a long generation no longer reads as "80.4 s".

Prompt sec and Generated sec show the two phases the rates were already
computed over, so a row now says where its time went: an 8011-token prompt as
19.3 s of prefill at 415 tok/s, then 6.74 s generating 141 tokens at 20.9. The
seconds come from the same split as the rates beside them -- a test asserts
tok/s == tokens / seconds for both phases, so the two can't drift apart.

A request that didn't stream has no first-token mark and so no split: its
prompt seconds read "—" and its whole duration is charged to generation, which
the column subtitle now says rather than leaving to be inferred.

run_phases/run_row move out of the snapshot closure to module level, so the
suite exercises the real row-building instead of a copy of it that had to be
kept in step by hand.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-04 00:23:33 -08:00
neil
8879db44a0 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>
2026-11-03 13:03:52 -08:00
Neil Bantoc
623d093b81 Dashboard: a reasoning chooser, offering only what the model accepts
Reasoning effort isn't a backend flag -- vLLM's --reasoning-parser only parses
the output. It's a chat-template kwarg read per request, and the models differ:
Qwen3.8 27B's template takes enable_thinking plus reasoning_effort in
('low','medium','xhigh') and raises on anything else, while Ornith 1.5 9B takes
only enable_thinking. Note 'xhigh', not OpenAI's 'high'.

So the chooser is built from what the loaded model's own template actually reads
(hfcache.template_controls), with the level names from the catalog, which is the
part that can't be inferred -- a level the template doesn't know would make it
raise, so an undeclared or unreadable one is never offered or sent.

The proxy injects the setting into chat completions, with a key the client set
itself always winning, the same precedence mlx_lm gives its own
--chat-template-kwargs. Reading it from config per request (mtime-cached) means
the dashboard changes it with no restart, so the model stays loaded -- the
startup flag would have cost a full reload per change.

vLLM gets no control: llm-host runs it without a proxy, so there is nothing in
the path to inject the kwarg. The panel hides itself rather than pretend.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 02:15:12 -08:00
Neil Bantoc
944eda06cc Dashboard: KV cache on MLX, a completed-request table, honest GPU charts
Three gaps, all of them things the dashboard drew but never filled.

KV cache was never reported on MLX: /llmhost/metrics had no "kv" key at all,
so the tile and chart sat empty. mlx_lm has no endpoint for it, but it logs
"Prompt Cache: N sequences, X GB" (decimal GB, n_bytes/1e9) and that stream
already passes through _pump_output, so pick it out there and report a fraction
of --prompt-cache-bytes -- the same shape vLLM's kv already has, so the sampler
needs no backend special-casing. Peak is kept alongside the current value.

GPU temperature and power are root-only on macOS (powermetrics), so hw.live_stats
has always returned None for them on Apple. Two permanently blank charts is worse
than none: hide them and say why when the hardware doesn't report them.

Add a completed-request table above the server log: when each request finished,
its duration, time to first token, prompt and generated tokens, the rate for each
phase, and peak KV during the run. Rates are split at the first token -- prompt
tokens over TTFT, generated tokens over what's left -- since a single rate over
the whole duration blurs prefill into generation. The proxy keeps the last 50 runs;
peak KV is joined in by the sampler, which is the only side that samples KV on a
timer.

Also: close the upstream connection explicitly when a client hangs up mid-answer
rather than leaving it to GC, log that in one line, and collapse mlx_lm's
resulting BrokenPipeError traceback in the log view. Any other traceback is left
verbatim.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 01:28:09 -08:00
neil
994659b5e2 Dashboard: time to first token tile and chart
vLLM: from the vllm:time_to_first_token_seconds histogram. MLX: the proxy
times streamed requests from arrival to the first generated token. Each
chart sample is the average over requests that got their first token in
that 2 s window; idle samples are gaps, and isolated samples now draw as
dots in every chart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
2026-11-02 08:12:07 -08:00
neil
c4b54b4abd Dashboard: add a prompt processing tok/s chart
Sits between generation tok/s and KV cache in a three-chart row
(stacks on narrow screens), with the same hover readout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
2026-11-02 05:03:07 -08:00
neil
5b9586ac80 Initial llm-host: hardware-aware local LLM server with dashboard
Detects the GPU (NVIDIA on Linux, Apple Silicon on macOS), picks the
catalog models and builds that fit, installs vLLM or MLX without sudo,
and runs the model server plus a web dashboard as user services.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
2026-11-02 03:51:06 -08:00