Skip to content

fix: add a key-gated OpenAI API interface for other services; 11960:0 → 11960:1 - #44

Merged
MattDHill merged 1 commit into
Start9Labs:masterfrom
13Homer13:fix/bridge-api-key
Nov 2, 2026
Merged

MattDHill merged 1 commit into
Start9Labs:masterfrom
13Homer13:fix/bridge-api-key

Conversation

@13Homer13

Copy link
Copy Markdown
Contributor

Problem

On StartOS 0.4.1 the OS proxy enforces a binding's addSsl.auth on the plain bridge port too (0.4.1 release notes: "Enforce HTTP authentication on both plaintext and TLS service connections when an HTTP proxy authentication policy is configured"). llama.cpp has one binding, api-multi:8080, gated with Basic admin:<uiPassword> for the browser. Services that connect to llama.cpp over the bridge (DeepSeek Harness, Open WebUI) send Bearer no-key-required and now get:

401 Unauthorized
WWW-Authenticate: Basic realm="StartOS"

Reported on a GPU box (llama-cpp 11669:1, DSH 0.2.1-rc.3, StartOS 0.4.1): llama.cpp's own web UI works, DSH and Open WebUI chats fail with an auth error. Reproduced on a 0.4.1.1 dev box.

One binding takes exactly one ProxyAuth (basic or bearer), and browsers can only do Basic, so one host can't serve both.

Fix

  • A second host, api-key, on the same internal port 8080, gated with Bearer, exporting interface openai-api ("OpenAI-compatible API", type api). The browser interface keeps its id (api), host, addresses and Basic login; it's renamed "Web UI".
  • The key is generated in initializeService when missing (so on install and on update, no migration) and published on a new public volume at credentials.json → apiKey, the vLLM pattern. public is included in backups so siblings' configs survive a restore.
  • New API Key action: shows the key (masked, copyable), with a toggle to generate a new one. Rotation only changes the proxy gate; llama-server doesn't restart. Siblings that read the key with .const() restart onto it; ones that read .once() pick it up on their next start.
  • README, instructions, AGENTS.md and release notes (5 locales) updated.

Rejected alternatives: an unauthenticated bridge-only binding (gives every service on the box keyless llama.cpp, which is what 0.4.1 closed), and llama-server --api-key with the proxy gate dropped (browser users would have to paste the key into the web UI, reversing the move of auth to the proxy in 1.0.9994:1).

Verified (0.4.1.1 dev box, generic variant, sideload update over 11960:0)

  • Both hosts bind 8080 side by side; the UI password and api-multi's assigned ports are unchanged; the key exists after the update.
  • New host, LAN TLS and bridge plain: no key / wrong key / no-key-required / Basic admin → 401 (Bearer realm="StartOS"); the key → 200 on /v1/models and /v1/chat/completions.
  • Old host: Basic admin → 200, any Bearer → 401 (unchanged).
  • Rotation: old key 401, new key 200, llama-server process not restarted.
  • DSH and Open WebUI built against this branch: connect, list the model and chat. Their PRs follow and depend on this one reaching next.

Not verified: GPU variants (no GPU on the test box), arm.

🤖 Generated with Claude Code

… → 11960:1

StartOS 0.4.1 enforces a binding's proxy auth on the plain bridge port as
well as TLS. llama.cpp's only binding (api-multi) is gated with Basic auth
for the browser, so DSH and Open WebUI, which send `Bearer no-key-required`
over the bridge, now get `401 Basic realm="StartOS"`. One binding takes one
ProxyAuth, and browsers can't send Bearer, so one host can't serve both.

- New host `api-key` on the same internal port 8080, gated with Bearer, and
  interface `openai-api` ("OpenAI-compatible API"). The browser interface
  keeps its id, host, addresses and Basic login; it is renamed "Web UI".
- The key is generated in init when missing (install and update) and
  published on a new `public` volume at `credentials.json` (`apiKey`), the
  way vLLM publishes its key. The `public` volume is backed up.
- New API Key action shows the key and can rotate it. Rotation only changes
  the proxy gate; llama-server doesn't restart.

Verified on a 0.4.1.1 box (generic variant, update over 11960:0):
- both hosts bind 8080 side by side; the UI password and api-multi's ports
  are unchanged;
- new host, LAN TLS and bridge plain: no key, wrong key, the placeholder and
  Basic admin all 401; the key 200 on /v1/models and /v1/chat/completions;
- old host still takes Basic only;
- rotation: old key 401, new key 200, llama-server not restarted;
- DSH and Open WebUI built against this connect and chat (separate PRs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff and surrounding init, interface, action, and backup code at 3f19bb2. No blocking correctness findings. The existing browser host/interface IDs are preserved; the separate Bearer binding stays unbound without a key, and key rotation updates proxy auth without changing the daemon specification. The new credential volume is included in backups.

Merge-tree check is clean; SDK 3.1.1 matches the latest published version. Read-only review: no build or tests run. DiscoverMatrix, generic, NVIDIA, and Vulkan CI passed; ROCm was still running at review time.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@MattDHill
MattDHill merged commit 8f43dd2 into Start9Labs:master Nov 2, 2026
5 checks passed
MattDHill pushed a commit to 13Homer13/open-webui-startos that referenced this pull request Nov 3, 2026
StartOS 0.4.1 enforces a binding's proxy auth on the bridge port too, so
the llama.cpp connection (Basic-gated `api-multi`, placeholder key) fails
with `401 Basic realm="StartOS"`. llama.cpp 11960:1 adds a Bearer-gated
`api-key` host and publishes its key on `public/credentials.json`
(Start9Labs/llama-cpp-startos#44).

- llama-cpp backend: hostId `api-key`, keySource `public`, keyRequired
  false, versionRange `>=11960:1`. An existing connection is repointed to
  the new address and gets the key on the next start.
- syncBackendState: look a public-key backend up in the repointed URL list
  instead of `connectedIds`, which is computed before the repoint. A backend
  whose address moved on this start kept its old key until a second restart;
  this hit llama.cpp's move here and vLLM whenever its bridge port moves.
- Lockfile pins llama-cpp-startos to Start9Labs#44's head until it reaches `next`.

Verified on a 0.4.1.1 box with llama.cpp 11960:1: published 0.12.5:0
connected to llama.cpp (401, placeholder key), then a sideload update to
this build. In one start the URL moved to the new host, the key became the
published one, the model listed and a chat through /api/chat/completions
answered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MattDHill pushed a commit to Start9Labs/open-webui-startos that referenced this pull request Nov 3, 2026
* fix: connect to llama.cpp's key-gated API interface; 0.12.5:0 → 0.12.5:1

StartOS 0.4.1 enforces a binding's proxy auth on the bridge port too, so
the llama.cpp connection (Basic-gated `api-multi`, placeholder key) fails
with `401 Basic realm="StartOS"`. llama.cpp 11960:1 adds a Bearer-gated
`api-key` host and publishes its key on `public/credentials.json`
(Start9Labs/llama-cpp-startos#44).

- llama-cpp backend: hostId `api-key`, keySource `public`, keyRequired
  false, versionRange `>=11960:1`. An existing connection is repointed to
  the new address and gets the key on the next start.
- syncBackendState: look a public-key backend up in the repointed URL list
  instead of `connectedIds`, which is computed before the repoint. A backend
  whose address moved on this start kept its old key until a second restart;
  this hit llama.cpp's move here and vLLM whenever its bridge port moves.
- Lockfile pins llama-cpp-startos to #44's head until it reaches `next`.

Verified on a 0.4.1.1 box with llama.cpp 11960:1: published 0.12.5:0
connected to llama.cpp (401, placeholder key), then a sideload update to
this build. In one start the URL moved to the new host, the key became the
published one, the model listed and a chat through /api/chat/completions
answered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: require llama.cpp's published key; repin llama-cpp-startos to next

llama.cpp 11960:1 gates its API host with Bearer, so a placeholder key can
only get a 401. Mark the llama-cpp backend keyRequired, like vLLM, and fix
the Configure Backends description (5 locales), which still said llama.cpp
needs no key. Repin the lockfile from #44's head to llama-cpp-startos next
(6e6a294); #44 was squash-merged, so its head commit is on no branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MattDHill pushed a commit to Start9-Community/DeepseekHarnessStart9 that referenced this pull request Nov 3, 2026
….2.1-rc.3:1

StartOS 0.4.1 enforces a binding's proxy auth on the bridge port too, so
the llama.cpp route (Basic-gated `api-multi`, `Bearer no-key-required`)
fails with `401 Basic realm="StartOS"`. llama.cpp 11960:1 adds a
Bearer-gated `api-key` host and publishes its key on
`public/credentials.json` (Start9Labs/llama-cpp-startos#44).

- llama-cpp backend: hostId `api-key`, keySource `public`, versionRange
  `>=11960:1`. The key is read with `.const()`, so a rotation restarts
  dsh onto the new key.
- start-sdk 3.1.0 → 3.1.1.
- Lockfile pins llama-cpp-startos to #44's head until it reaches `next`
  (it was still on 5189939, an SDK 3.0.6 commit).
- README dependency row; AGENTS.md drops "the gate covers the TLS
  addresses only", which 0.4.1 made false.

Verified on a 0.4.1.1 box with llama.cpp 11960:1: Connect Model Servers
lists the model; the route points at the api-key bridge port; dsh's
STARTOS_LLAMA_CPP_API_KEY matches the proxy token and a chat completion
sent from the dsh container with it answers. After rotating llama.cpp's
key, dsh restarted by itself onto the new one. Not verified: a chat typed
in the dsh web UI, arm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants