Hand out the right opencode command: the API's public URL, and setup uses the install script
install-newt now asks for the API's public URL first (--api-url) and records it; it names the Pangolin resource and refuses an endpoint on the same host. expose-dashboard records only that the dashboard is public. One rule (opencode.client_targets) decides which opencode-install.sh commands are shown -- local only without a tunnel; internet and local with one; internet only once the dashboard is public -- and setup's closing message, `llmhost opencode-config` and the dashboard's Connect dialog all use it. Setup's offer to install opencode now goes through opencode-install.sh --install-only, a new mode that only installs opencode; this machine's own provider is still configured by llm-host, which keeps it in sync on every switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c8b70afdbf
commit
3e9ebeed42
10 changed files with 266 additions and 109 deletions
32
README.md
32
README.md
|
|
@ -93,14 +93,19 @@ a third user service, in userspace (no root). It's a pinned release, checked aga
|
|||
Create a Newt site in Pangolin (*Sites → Add Site → Newt*, which gives an endpoint, ID and secret), then:
|
||||
|
||||
```bash
|
||||
llmhost install-newt --endpoint https://pangolin.example.com --newt-id <site id>
|
||||
llmhost install-newt --api-url https://llm-api.example.com \
|
||||
--endpoint https://pangolin.example.com --newt-id <site id>
|
||||
```
|
||||
|
||||
`--api-url` is where clients will reach the API: a domain you'll add as a resource on Pangolin, not Pangolin's own
|
||||
address (`--endpoint`). It's asked for first, because llm-host uses it to describe the resource and to print the
|
||||
right `opencode-install.sh` command everywhere it gives one.
|
||||
|
||||
It asks for the site secret, or reads `$LLMHOST_NEWT_SECRET`; it's never taken as a flag, so it stays out of shell
|
||||
history. The secret is stored in `~/.config/llm-host/newt_secret` (mode 600) and handed to newt in its environment
|
||||
at start, never written into a service file or `config.json`. Running it again changes only what you give it.
|
||||
|
||||
Then add one HTTP resource in Pangolin, for the API: a host of your choice → `<this machine's LAN IP>:<API port>`,
|
||||
Then add one HTTP resource in Pangolin, for the API: the `--api-url` host → `<this machine's LAN IP>:<API port>`,
|
||||
with Pangolin's own authentication off, since llm-host checks the API key. Point it at the LAN IP, not
|
||||
`localhost`, which llm-host treats as local. Clients use `https://<API host>/v1` with the key; for opencode, see
|
||||
[`opencode-install.sh`](#connecting-opencode).
|
||||
|
|
@ -171,15 +176,27 @@ page. While OIDC is on, it's the only way in, and codes come back with `remove-o
|
|||
- **The key alone:** it explains the risk and asks before going on (`--force` skips the question).
|
||||
|
||||
Then it describes the Pangolin resource to add (the dashboard's host → `<LAN IP>:<dashboard port>`) and, once you
|
||||
press Enter, checks the public URL reaches this dashboard.
|
||||
press Enter, checks the public URL reaches this dashboard. It records only that the dashboard is public, not where.
|
||||
|
||||
### Which address clients are given
|
||||
|
||||
Setup's closing message, `llmhost opencode-config` and the dashboard's **Connect** dialog all print the
|
||||
`opencode-install.sh` command, for these addresses:
|
||||
|
||||
| state | commands shown |
|
||||
|---|---|
|
||||
| no tunnel | the local network (`http://<host>.local:<API port>`) |
|
||||
| `install-newt` done, dashboard local | the internet (`--api-url`), then the local network |
|
||||
| `expose-dashboard` done | the internet only, since the dashboard is then seen from outside |
|
||||
|
||||
`llmhost status` shows the tunnel and sign-in settings. `setup` and `update` keep them, and `update` moves newt to
|
||||
a newly pinned release. Each step has an undo: `remove-newt`, `remove-oidc`, `remove-otp`.
|
||||
|
||||
## Connecting opencode
|
||||
|
||||
**On the server itself**, setup handles it: if opencode isn't installed it offers to install it (official
|
||||
installer, into `~/.opencode/bin`), then adds an `llmhost` provider to `~/.config/opencode/opencode.json`
|
||||
**On the server itself**, setup handles it: if opencode isn't installed it offers to install it, through
|
||||
`opencode-install.sh --install-only` like any other machine (which runs opencode's official installer, into
|
||||
`~/.opencode/bin`), then adds an `llmhost` provider to `~/.config/opencode/opencode.json`
|
||||
pointing at `http://localhost:<api port>/v1` and reading the key straight from llm-host's key file. It shows up
|
||||
in opencode as **LLMHost (Local)**. Other providers and your default model are left alone; the first change backs
|
||||
the file up as `opencode.json.before-llmhost`.
|
||||
|
|
@ -187,8 +204,9 @@ the file up as `opencode.json.before-llmhost`.
|
|||
(`--yes` to install without asking); skip it during setup with `--no-opencode`, or install without asking with `--opencode`.
|
||||
A config with comments (`.jsonc`) is never rewritten, since that would drop them; setup prints the block to paste instead.
|
||||
|
||||
**On another machine**, run `llmhost opencode-config` on the server. It prints a provider block and a one-liner
|
||||
that copies the API key over. That block is named **LLMHost (<the server's hostname>)** — e.g. `LLMHost (mybox.local)`
|
||||
**On another machine**, use `opencode-install.sh` (below); setup ends by printing the exact command for this
|
||||
server. To do it by hand instead, run `llmhost opencode-config` on the server. It prints a provider block and a
|
||||
one-liner that copies the API key over. That block is named **LLMHost (<the server's hostname>)** — e.g. `LLMHost (mybox.local)`
|
||||
— under the provider id `llmhost-<shorthost>`.
|
||||
|
||||
**On any machine, in one step**, run `opencode-install.sh` from this repo. It needs only the API's address and
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue