# Opod docs: Core CLI --- title: "CLI overview" description: "Every opod command at a glance, and the conventions all of them share — help, JSON output, prompts, pickers, keys and colour." url: "https://opod.io/docs/core-cli/" markdown_url: "https://opod.io/docs/core-cli.md" section: "Core CLI" last_updated: "2026-10-30" --- # CLI overview > Every opod command at a glance, and the conventions all of them share — help, JSON output, prompts, pickers, keys and colour. ## In short `opod` is one binary. `opod up` starts a leader and `opod join` adds a worker; every other command manages them. Every command prints its own help with `--help`. ```bash opod node ls --help opod version ``` ```text opod 0.21.0 (linux/amd64, go1.26.4) ``` `opod` is the only binary. Every capability is a command, and most commands call an `/admin/v1` route you can also script. ```bash opod [options] opod --help ``` ## Commands | Command | Does | | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | [`opod up`](https://opod.io/docs/core-cli/up/) | Start a leader, a front door (`--role gateway`) or a cell door (`--role door`). | | [`opod down`](https://opod.io/docs/core-cli/up/#opod-down) | Stop the local leader and unload its engine's models. | | [`opod status`](https://opod.io/docs/core-cli/up/#opod-status) | Show the local leader, engine and installed models. | | [`opod join`](https://opod.io/docs/core-cli/join/) | Join a cluster as a worker. | | [`opod node`](https://opod.io/docs/core-cli/node/) | `ls`, `show`, `drain`, `undrain`, `remove`. | | [`opod model`](https://opod.io/docs/core-cli/model/) | `add`, `ls`, `ps`, `search`, `info`, `load`, `unload`, `move`, `remove`. | | [`opod shard`](https://opod.io/docs/core-cli/shard/) | `create`, `ls`, `remove` gangs. | | [`opod token`](https://opod.io/docs/core-cli/token/) | `create`, `ls`, `expire`, `renew`, `revoke` API keys. | | [`opod catalog`](https://opod.io/docs/core-cli/catalog/) | `ls` and `export` the embedded catalog. | | [`opod fetch`](https://opod.io/docs/core-cli/fetch/) | Download one GGUF or a safetensors snapshot into a models directory. | | [`opod cache`](https://opod.io/docs/core-cli/cache/) | `ls`, `prune` the weight cache; `kv-prune` a disk KV tier. | | [`opod image`](https://opod.io/docs/core-cli/image/) | `ls`, `show`, `recommend` the published container images. | | [`opod batch`](https://opod.io/docs/core-cli/batch/) | `run` an OpenAI batch file against any OpenAI-compatible URL. | | [`opod connect`](https://opod.io/docs/core-cli/connect/) | Print client settings for a tool; `disconnect` prints how to undo them. | | [`opod config`](https://opod.io/docs/core-cli/utilities/#opod-config) | `show`, `path`, `edit`. | | [`opod doctor`](https://opod.io/docs/core-cli/utilities/#opod-doctor) | Diagnose the local setup. | | [`opod update`](https://opod.io/docs/core-cli/utilities/#opod-update) | Install the latest or a pinned release. `upgrade` is an alias. | | [`opod completion`](https://opod.io/docs/core-cli/utilities/#opod-completion) | Print a bash, zsh or fish completion script. | | [`opod version`](https://opod.io/docs/core-cli/utilities/#opod-version) | Print the version, or the leader's feature keys. | | `opod help` | Print the command list. Also `--help` and `-h`. | ## Shared conventions **Help.** `--help` or `-h` anywhere in the arguments prints the command's usage, flags and examples, and exits `0`. The word `help` counts only as the first argument, so `opod model search help` searches for "help". A wrong flag prints the help to stderr and exits `2`. From core v0.4.6, a usage error is three lines on stderr instead — `opod: `, the command's usage line, and `opod --help for every flag` — and `opod help ` is `opod --help`. The commands that parse their flags by hand (`model`, `shard`, `node`, `token`, `join`) list them in a **Flags** section of their help. **Typos.** An unknown command or sub-command prints a "Did you mean …?" suggestion when one is close. **Aliases.** `ls` = `list` in `node`, `model`, `shard`, `token` and `image` (not in `catalog` or `cache`). `remove` = `rm` in `node`, `model` and `shard`. `image show` = `image info`, `image recommend` = `image for`. `model add --node` = `--nodes`. `upgrade` = `update`. `version` = `--version` = `-v`. **Flags.** Flags may come before or after positional arguments. Both `--flag value` and `--flag=value` work. **JSON.** `--json` prints machine-readable output on `status`, `model ls|ps|search|info`, `config show`, `cache ls|prune|kv-prune` and `image ls|show|recommend`. `node ls` has no `--json`; `node show` prints JSON always. **Prompts.** `model remove`, `node remove` and `shard remove` ask for confirmation. `--yes` or `-y` skips the prompt for scripts. Without a terminal they printed `opod: aborted`; from core v0.4.6 they say `no terminal to confirm opod node remove n_one on — run opod node remove n_one --yes` and exit `2`. **Pickers.** `model add`, `info`, `remove`, `load`, `unload` and `connect` open an interactive picker (type to filter, arrow keys, Enter) when the id is missing or unknown and the terminal is interactive. Without a terminal they printed `opod: no model selected`; from core v0.4.6 they name the fix — `no catalog entry "X" (try: opod model search X)`, `"X" is not installed on this host (see opod model ls)`, `model add needs a catalog id …` — and `model load` checks its flags before it would ask. **Colour.** Output is coloured on a terminal. `NO_COLOR=1` or `OPOD_NO_COLOR=1` turns colour off. Before, the `▶ ✔ ⚠` markers kept their colour codes in a pipe or a file; from core v0.4.6 each stream is coloured only when it is a terminal. **Warnings.** From core v0.4.6, every warning (`⚠ …`) goes to stderr, so `opod status > s.txt` or `opod doctor | grep` carries only the answer; before, `status`, `doctor`, `up`, `join`, `model add` and others printed them on stdout. **Secrets on a pipe.** A command that prints a key (`opod up` on first run, `opod token create`) warns on stderr when stdout is not a terminal, because the key may land in a log. The key still goes to stdout, so `key=$(opod token create …)` works. ## Where commands act Most commands run on the **leader host** and use its local state: | Reads or writes | Commands | | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | the local store (`storage.dsn`) and the local engine directly | `token *`, `model add` (without `--node`), `model ls`, `model remove`, `node ls`, `node show`, `status` | | the running leader's admin API, with `~/.opod/admin.key` | `model add --node`, `model load`, `model move`, `model ps`, `shard *` | | the leader first, then the store or engine if no leader answers | `node drain`, `node undrain`, `node remove`, `model unload` (from core v0.4.6: only when this host's own leader does not answer — a leader that answers with any error, even a 500 with no body, is final, and an `OPOD_BASE_URL` leader never falls back to this host's store) | | nothing but the local machine | `fetch`, `cache`, `catalog`, `image`, `doctor`, `completion`, `version` | The admin calls go to `http://localhost` with the key in `~/.opod/admin.key`. From 0.3.0 they go to the leader's own address — its `listen` host (an empty or `0.0.0.0` host is `localhost`), over `https` when it serves TLS, trusting its own certificate file; on 0.2.1 a `listen` with a host, or a TLS leader, breaks them. They fail with `no admin key on disk … is opod up running on this host?` elsewhere. From core v0.4.6, an admin call goes to `OPOD_BASE_URL` when it is set, with the key in `OPOD_TOKEN` when it is set — so these verbs reach a leader on another host — else to this host's leader with `~/.opod/admin.key`. Each failure says what to do: | What happened | What it prints | | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | the leader refused the key (401, 403) | `the leader at refused the admin key from () — run this on the leader's host, or set OPOD_TOKEN to an admin key` | | no key here | `no admin key: none at ~/.opod/admin.key and OPOD_TOKEN is not set — …`; from core v0.4.6, `… and neither OPOD_TOKEN nor OPOD_ADMIN_TOKEN is set — …` | | a certificate that is not the leader's own (from core v0.4.6) | `the leader at answered, but it presented a certificate that is not the one in — check tls_cert and OPOD_TLS_CERT on this host` | | nothing answered | `no leader answering at (): — start it with opod up, or set OPOD_BASE_URL to the leader's URL` | | the leader answered an error | ` : the leader answered HTTP : []`; a body that is not the leader's JSON (a proxy page) or an empty one says so | | the client budget ran out | `gave up after 45m0s waiting for at — the leader may still be working on it; check with opod status` | ```bash OPOD_BASE_URL=https://leader.example.com:8080 OPOD_TOKEN=sk-orc- opod shard ls ``` From core v0.4.6, three more rules hold. They matter most for a leader that a manager runs (`OPOD_MANAGED=1`, for example in a Kubernetes pod), which has no key file: - **The key.** After `OPOD_TOKEN`, an admin call uses the admin token the leader was started with (`OPOD_ADMIN_TOKEN`, or `auth.admin_token` in the config), and only then `~/.opod/admin.key`. - **The certificate.** Over TLS, the CLI accepts exactly the certificate in the leader's own `tls_cert` file, byte for byte, whatever names it carries. A certificate issued for the leader's service name, and not for `localhost`, now works. Any other certificate is an answer from a leader, never "no leader answering", so no command falls back to the store because of it. - **The store.** On a managed host with no `OPOD_STORAGE_DSN`, the leader's store lives only inside the running `opod up`. `opod node ls` and `opod node show` ask the running leader. Every command that would read or write the store itself (`model ls`, `token ls`, `token create`, …) refuses instead of opening an empty store: ```text opod: this host's leader is managed (OPOD_MANAGED=1): its store lives only inside the running `opod up`, so there is nothing on this host to read or change — `opod node ls`, `opod node show`, `opod shard ls` and `opod model ps` ask the running leader; make any other change through the leader's manager ``` Up to core v0.4.5, on such a host `node ls` printed `(no nodes registered yet …)` beside a serving worker, and `shard ls` printed `no admin key`. Calls that move weights (`shard create`, `model add`, `model load`) wait up to 45 minutes; other admin calls wait up to 5 minutes. ## Configuration file Every command reads `~/.opod/config.yaml` when it exists, then environment variables. `opod up --config PATH` reads another file. See [Configuration](https://opod.io/docs/core-reference/configuration/). ## Exit codes | Code | Meaning | | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `0` | Success, or `--help`. | | `1` | The command failed; the message is on stderr, prefixed `opod:`. | | `2` | Usage error: missing argument, bad flag, unknown command or subcommand. From core v0.4.6 every one of them exits `2` with an `opod:` line; before, some exited `1` (`join` with no URL, `node show` with no id, `connect a b`, `connect --retries 9`, an unknown subcommand, a non-numeric `--tp`), `completion` with no shell printed its help and exited `0`, and `cache`, `fetch`, `catalog` and `batch` said `error:`. | | `75` | `opod batch run` stopped and can be resumed. | --- title: "opod up, down, status" description: "Start a leader, a front door or a cell door; stop the local leader; and check what is running." url: "https://opod.io/docs/core-cli/up/" markdown_url: "https://opod.io/docs/core-cli/up.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod up, down, status > Start a leader, a front door or a cell door; stop the local leader; and check what is running. ## In short `opod up` starts a leader on this machine: the OpenAI-compatible gateway on `:8080`, the router, the keys and the admin API. With `--role gateway` it starts a front door for a leader, and with `--role door` a cell door for many leaders. `opod down` stops it and `opod status` shows it. ```bash opod up opod status opod down ``` ## opod up Start the local node. On first run it becomes the cluster leader. ```text opod up [--config PATH] [--auto-pull=false] [--no-wizard] [--exclusive] [--unload-on-exit] [--role gateway --leader URL] [--role door --routes FILE] ``` | Flag | Default | Effect | | ------------------ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--config PATH` | `~/.opod/config.yaml` | The config file to read. | | `--auto-pull` | `true` | Allow the first run to pull the default model (`opod up --help` on 0.2.1 wrongly says it is off by default). Applies only when `router.pull_default_model` (`OPOD_PULL_DEFAULT_MODEL=1`) is on. | | `--no-wizard` | `false` | Skip the interactive first-run prompt. With `--auto-pull=false`, the start is fully quiet. | | `--exclusive` | `false` | One resident model per machine: a load evicts every other non-pinned model first. Same as `placement.exclusive` or `OPOD_EXCLUSIVE=1`. | | `--unload-on-exit` | `OPOD_UNLOAD_ON_EXIT=1` | On Ctrl-C, ask the engine to drop loaded models from memory. | | `--role ROLE` | `leader` | `leader`, `gateway` or `door`. `OPOD_ROLE` also sets it. A flag wins over the variable. | | `--leader URL` | — | The leader a `gateway` mirrors and pushes to, e.g. `http://leader:8080`. `OPOD_LEADER_URL` also sets it. | | `--routes FILE` | — | The routes file a `door` watches. `OPOD_DOOR_ROUTES` also sets it. | ```bash opod up OPOD_PULL_DEFAULT_MODEL=1 OPOD_DEFAULT_MODEL=llama-3.2-1b opod up # this machine serves a model too OPOD_ENGINE=llamacpp OPOD_PULL_DEFAULT_MODEL=1 opod up # launches llama-server if none runs opod up --config ~/.opod/staging.yaml opod up --role gateway --leader http://leader:8080 opod up --role door --routes /etc/opod-door/routes.json ``` ### What a leader does at start 1. Loads the config: defaults, then the YAML file, then environment variables. 2. Detects the hardware and prints it. 3. Opens the store (`storage.dsn`, default `~/.opod/state.db`; in memory when `OPOD_MANAGED=1` and `OPOD_STORAGE_DSN` is unset). 4. On the first standalone run, mints an admin key, prints it once and saves it to `~/.opod/admin.key`. Seeds `auth.join_token` and `auth.admin_token` as keys when they are set. 5. Loads the catalog. With no `router.default_model`, picks one that fits the hardware. 6. Probes the engine for 3 seconds. With `engine.preferred: llamacpp`, `pull_default_model` on and nothing on the llama.cpp endpoint, it launches `llama-server -hf ` for the default model. 7. Registers itself as node `local`. 8. With `pull_default_model` on and a reachable engine, runs the first-run prompt or pulls the default model. 9. Writes its PID to `/opod.pid`, prints the ready block and starts serving. From core v0.4.6, the PID file and the ready block (with the admin key shown once) come only after the port is bound, so a failed start prints no "ready" and no key. 10. Restores the models that were loaded or pinned before the last shutdown, in the background. The ready block lists the API URL, the health URL, the mode (`standalone` or `managed`) and every outbound call this node is configured to make. There is no check for an already-running leader: a second `opod up` on the same port fails with `address already in use`. From core v0.4.6, `opod up` checks before it starts anything: | Case | What it prints | Exit | | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ---- | | a leader already runs from this data directory (its PID is alive and `/healthz` answers) | `already running (pid N, http://localhost:8080) — stop it with opod down, or see it with opod status` | `1` | | the port is taken by another program | `port :8080 is in use — another program listens there; stop it, or set listen: in ~/.opod/config.yaml or OPOD_LISTEN` | `1` | | `--role gateway` with no `--leader` / `OPOD_LEADER_URL` | `--role gateway needs --leader (or OPOD_LEADER_URL) …`, the usage line | `2` | | `--role door` with no `--routes` / `OPOD_DOOR_ROUTES` | `--role door needs --routes …`, the usage line | `2` | | `--role door` whose routes file is not there yet | a warning — every model answers 404 until the file appears; the door re-reads it every 10 s | runs | A container that restarts in place may find a PID file that names itself; that is not a second leader, and `opod up` goes on. ### Roles - **`leader`**: the full process described above. - **`gateway`**: a front door for one leader's endpoint. It serves `/v1` and the probes only; no `/admin/v1`, no join surface, no engine. It mirrors the leader's worker list (and, from core v0.4.0, keeps every worker it knows while a restarted leader is still rebuilding that list), pushes its usage rows to the leader and polls the leader every 10 seconds for the door count. It needs `--leader` and an admin key in `OPOD_ADMIN_TOKEN`. It fails at start when it cannot reach its leader. - **`door`**: one URL for many endpoints. It opens no store, starts no engine and holds no key. It reads each request's `model`, finds the endpoint in the routes file (re-read every 10 seconds) and forwards the request unchanged. See [Front doors](https://opod.io/docs/core-reference/front-doors/). ### Signals `SIGINT` or `SIGTERM` stops the leader. It finishes in-flight HTTP requests (up to 30 seconds), flushes traces and logs, and stops engines it launched. It does not unload models from a separate engine unless `--unload-on-exit` is set. ## opod down Stop the local leader and release engine memory. ```text opod down [--no-unload] ``` | Flag | Effect | | ------------- | ------------------------------------ | | `--no-unload` | Leave models resident in the engine. | `opod down` reads `/opod.pid`, sends `SIGTERM` and waits up to 10 seconds for the process to exit. Then it asks the configured engine to unload every resident model. Engines with no unload call (vLLM, MLX-LM) are skipped with a note. A stale PID file is removed and reported. `opod down` stops a process started with `opod up`. Stop a worker (`opod join`) with Ctrl-C or `SIGTERM`. From core v0.4.6, `opod down` signals the PID only when it is opod (or answers as this host's leader), and says what it did: | Case | What it prints | Exit | | -------------------------- | -------------------------------------------------------------------------------------------------- | ---- | | no PID file | `opod is not running on this host (no PID file at …) — nothing to stop` | `0` | | the PID is not running | `pid N is not running — removed the stale PID file …; nothing to stop` | `0` | | the PID is another program | `pid N in … is not opod (it is "sleep") — removed the stale PID file; nothing stopped` (on stderr) | `0` | | stopped | `stopping opod (pid N)…`, then `opod (pid N) stopped` | `0` | | still running after 10 s | `pid N is still running after 10s — check opod status; force it with kill -9 N` (on stderr) | `1` | Before, it sent `SIGTERM` to whatever the PID file named and failed with exit `1` when nothing ran. ## opod status Show the local leader, its engine and the installed models. ```text opod status [--json] ``` It calls `GET /healthz` on `http://localhost` (3-second timeout), probes the engine and lists the models in the store. It exits `1` when the leader does not answer. ```json { "control_plane": { "url": "http://localhost:8080/healthz", "reachable": true, "status": "200 OK" }, "engine": { "name": "ollama", "endpoint": "http://127.0.0.1:11434", "reachable": true }, "models": [ { "id": "llama-3.2-1b", "status": "ready", "source": "ollama:llama3.2:1b" } ] } ``` In this output `control_plane` means the local leader. From core v0.4.6, `opod status` reports a leader as healthy only on a `2xx` (a `401` or `503` used to print ✔ and exit `0`), checks the engine whether or not the leader answers, and reads the models and nodes from the leader's admin API instead of this host's store (so it no longer creates `state.db`). Without an admin key here it says so on stderr. Warnings go to stderr, and it exits `1` unless the leader is healthy. The JSON names the leader `leader`: ```json { "leader": { "url": "http://localhost:8080/healthz", "reachable": true, "healthy": true, "status": "200 OK" }, "engine": { "name": "ollama", "endpoint": "http://127.0.0.1:11434", "reachable": true }, "models": [ { "id": "llama-3.2-1b", "status": "ready", "source": "ollama:llama3.2:1b" } ], "nodes": [ { "id": "local", "state": "ready" } ] } ``` `list_error` appears instead of the lists when the leader could not be asked (no admin key, or a refusal). --- title: "opod join" description: "Join a machine to a cluster as a worker, with a token or a certificate, pinned to one GPU and a memory budget if needed; what it does and how it fails." url: "https://opod.io/docs/core-cli/join/" markdown_url: "https://opod.io/docs/core-cli/join.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod join > Join a machine to a cluster as a worker, with a token or a certificate, pinned to one GPU and a memory budget if needed; what it does and how it fails. ## In short `opod join` makes this machine a worker of a leader. It registers, heartbeats every 5 seconds, runs the leader's calls against the local engine, and stays in the foreground until you stop it. A node token in the URL (or in `OPOD_JOIN_TOKEN`) or a client certificate identifies it. ```bash opod join "http://leader:8080?token=sk-orc-" ``` ```text ✔ joining cluster at http://leader:8080 as n_abc123 ``` ## Usage ```text opod join "LEADER_URL[?token=TOKEN]" [--gpu INDEX] [--vram-budget GB] ``` `opod join` makes this machine a **worker**: it registers with a leader, serves the leader's calls on its own API, drives the local engine, and heartbeats until it is stopped. It runs in the foreground. Stop it with Ctrl-C or `SIGTERM`. ```bash opod join "http://leader.local:8080?token=sk-orc-" opod join "https://opod.example.com?token=sk-orc-" opod join "http://leader:8080?token=sk-orc-" --gpu 1 --vram-budget 20 OPOD_JOIN_TOKEN=sk-orc- opod join https://opod.example.com ``` Quote the URL: `?` is a glob character in zsh. A URL without a scheme gets `http://`. A trailing `/` is removed. ## Arguments and flags | Argument | Default | Effect | | ------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `LEADER_URL` | — (required) | The leader's base URL. The query `?token=` is the join token; the whole query is dropped from the URL the worker stores and dials. | | `--gpu INDEX` | `$OPOD_GPU_INDEX` | Pin the worker's engine to one device. The engine processes see `CUDA_VISIBLE_DEVICES=INDEX`, `HIP_VISIBLE_DEVICES=INDEX` and `ONEAPI_DEVICE_SELECTOR=level_zero:INDEX`, each unless you already set it, and `OPOD_GPU_INDEX=INDEX`. | | `--vram-budget GB` | `$OPOD_VRAM_BUDGET_GB` | Cap the engine's GPU memory, a whole number of GB, so several workers can share one card. The engines see `OPOD_VRAM_BUDGET_GB`. For vLLM it becomes `--gpu-memory-utilization` (below). | A flag wins over its environment variable. The flags must come **after** the URL. Any other argument is refused (from core v0.4.6 the flags may also come before the URL and take `--gpu=1`, and each of these is a usage error, exit `2`): | Error | Cause | | --------------------------------------------------------------------------------------------- | --------------------------------- | | ``opod: usage: opod join "?token=" (run `opod join --help` for details)`` | No URL. | | `opod: --gpu needs a device index` | `--gpu` is the last word. | | `opod: --vram-budget needs a size in GB` | `--vram-budget` is the last word. | | `opod: --vram-budget must be an integer number of GB, got "20.5"` | Not a whole number. | | ``opod: unknown join argument "--foo" (see `opod join --help`)`` | Anything else. | These variables only reach the **engine processes the worker starts** (vLLM, SGLang, llama.cpp, rpc-server). An engine you started yourself, such as an Ollama service, does not see them; pin that engine yourself. ### How a budget becomes an engine setting For vLLM, the worker computes `--gpu-memory-utilization` at launch: ```text utilization = (budget_GB × 1024 − overhead_MiB) / card_MiB clamped to 0.05 … 0.95, two decimals ``` - `card_MiB` is `OPOD_CARD_MIB` when the manager set it, else what `nvidia-smi` reports for the first card. With neither (AMD and Intel hosts have no `nvidia-smi`), **the budget is not applied** and vLLM uses `0.85`. - `overhead_MiB` is `OPOD_ENGINE_OVERHEAD_MIB` when set, else core's measured figure for the engine (its largest one for a vendor not measured). - With no budget, vLLM gets `0.85`. SGLang gets `--mem-fraction-static` by the same formula only when a budget is set, with a 768 MiB overhead; with no budget the flag is left out and SGLang sizes its own pool. ## Credentials The worker presents, in this order: 1. the URL's `?token=`; 2. else `OPOD_JOIN_TOKEN`, or `auth.join_token` in this machine's `config.yaml`; 3. else its client certificate, `OPOD_NODE_CERT` and `OPOD_NODE_KEY`. With none of them, it exits: ```text opod: no join token (?token= in the URL, or OPOD_JOIN_TOKEN) and no worker certificate (OPOD_NODE_CERT/OPOD_NODE_KEY): one or the other identifies this worker ``` Mint a token on the leader with `opod token create --node`. A token in the URL is visible to anyone who can list processes. A container image or a service unit should pass it in `OPOD_JOIN_TOKEN` and leave the URL bare. Joining a leader that is not `localhost`, `127.0.0.1` or `::1` over `http` with a token prints, on stderr: ```text ⚠ joining leader.local over cleartext http — the join token will be sent unencrypted; prefer https for non-local leaders ``` The token has a second job: the worker hands it to the leader at register, and the leader signs every call back into the worker with it (HMAC, see [Worker API](https://opod.io/docs/core-reference/worker-api/#authentication)). A worker that joins with a **certificate only** mints its own random secret for that job (`sk-orc-cb-…`, 32 random bytes) and sends it over the mTLS-protected register. No operator handles it. For a TLS leader, set `OPOD_LEADER_CA` to the PEM certificate the worker must trust. The worker then trusts exactly that certificate. With `OPOD_NODE_CERT` and `OPOD_NODE_KEY`, it also presents its own client certificate; its SPIFFE SAN `spiffe:///opod/node/` is the worker's identity to a leader that runs node mTLS. The leader's policy (`off`, `allow`, `require`) comes from its [auth snapshot](https://opod.io/docs/core-reference/auth-snapshot/). **Binding.** The first `node` key that registers a node id owns it. Another `node` key that presents the same id is refused, so one leaked node token cannot impersonate every worker. A worker that registered with a certificate is bound to that certificate. ## Identity and address - **Node id:** `OPOD_NODE_ID`, else the `node_id` in `~/.opod/node.yaml` from an earlier run, else `n_`, else a new random `n_` plus 8 characters. Keep it stable: a new id per restart leaves a `lost` row behind on the leader each time. - **Address:** the IP of the interface that routes to the internet (found with a UDP dial that sends nothing), port `8081`. When that fails, the first non-loopback interface. `OPOD_ADVERTISE_ADDR=host:port` overrides it, for containers, overlay networks and hosts with several interfaces. When detection fails entirely, it warns and uses `0.0.0.0:8081`. - **`~/.opod/node.yaml`** (mode `0600`) records `node_id`, `leader_url`, `token`, `address` and `joined_at`. Only `node_id` is read back, by the next `opod join`. The file holds the token: protect it. From core v0.4.6 it no longer records the token. > **The address is also the bind address** > > The worker's API **listens** on the same `host:port` it advertises, and its gang processes (llama.cpp `rpc-server`, the `llama-server` coordinator) bind the same host. So `OPOD_ADVERTISE_ADDR` must be an address this machine owns, unless you also set `OPOD_BIND_ADDR`. An address that only exists on the far side of a NAT or a load balancer makes the worker fail to start its API, with `worker server exited` in the log. ### Behind NAT or a port forward From core v0.4.0, `OPOD_BIND_ADDR` names the address this machine owns. The worker listens there, and the leader binds the worker's llama.cpp gang processes (`rpc-server`, the coordinator) there, while it keeps dialling the advertised address. ```bash # The leader dials 203.0.113.7:18081, which the router forwards to 10.0.0.5:8081. OPOD_ADVERTISE_ADDR=203.0.113.7:18081 OPOD_BIND_ADDR=10.0.0.5:8081 \ opod join "http://leader:8080?token=sk-orc-" ``` - `OPOD_BIND_ADDR=host` with no port takes the advertised port. - Unset = the advertised address, as before. - `0.0.0.0` is taken only when you set it, and the worker warns: llama.cpp's `rpc-server` has no authentication, so a wildcard opens it on every interface. Firewall its ports. - Forward the gang ports too: `rpc-server` and the coordinator listen on ports the leader picks for each gang. - **Check it worked:** the join log reads `listening on OPOD_BIND_ADDR; the leader dials the advertised address`, and `opod node show ` carries `"BindHost"` in its `HardwareJSON`. SGLang's rendezvous and Ray's `--node-ip-address` still take the advertised host. ## Engine The worker drives the engine named by `engine.preferred` / `OPOD_ENGINE` (default `ollama`), at the endpoint from its own config or `OPOD__ENDPOINT`: ```bash OPOD_ENGINE=vllm OPOD_VLLM_ENDPOINT=http://127.0.0.1:8000 opod join "http://leader:8080?token=sk-orc-" ``` For vLLM, SGLang, llama.cpp and TensorRT-LLM the worker **starts the engine itself** when the leader asks it to load a model (`POST /v1/model/load`), and stops it at shutdown. For Ollama and MLX-LM, the engine must already run. See [Engines](https://opod.io/docs/core-reference/engines/). `OPOD_LOAD_MODEL=` makes the worker load that model by itself once its engine answers, with no call from the leader. `OPOD_LOAD_REPO` and `OPOD_LOAD_FILE` override the catalog's repo and file for that load. The model's pinned revision and digest come from `OPOD_MODEL_REVISION` and `OPOD_MODEL_SHA256`; gated repos need `HF_TOKEN`, and `HF_ENDPOINT` points at a mirror. Other worker-only variables — `OPOD_ENGINE_FLAGS`, `OPOD_ADAPTERS`, `OPOD_REJECT_BEARER`, `OPOD_DRAIN_SECONDS`, `OPOD_WORKER_ROLE`, `OPOD_KV_TIER`, `OPOD_KV_EVENTS`, `OPOD_SLEEP_MODE`, `OPOD_PLAN_REVISION`, `OPOD_ACCELERATOR`, `OPOD_CARD_MIB`, `OPOD_ENGINE_OVERHEAD_MIB` — are described in [Environment variables](https://opod.io/docs/core-reference/environment/#process-contract-worker). Three of them are checked at start and refuse a value the worker would not understand: | Error | Fix | | ---------------------------------------------------------------------- | --------------------------------- | | `opod: OPOD_WORKER_ROLE "x": use prefill or decode, or leave it unset` | Unset it for a whole worker. | | `opod: OPOD_KV_TIER "x": use cpu or peer, or leave it unset` | Unset it for VRAM only. | | `opod: OPOD_DRAIN_SECONDS="x": want whole seconds from 0 to 3600` | A whole number, at most one hour. | Valid values look like this: ```bash OPOD_WORKER_ROLE=decode OPOD_KV_TIER=peer OPOD_DRAIN_SECONDS=120 \ opod join "http://leader:8080?token=sk-orc-" ``` `OPOD_PLAN_REVISION` that is not a positive number only warns: `OPOD_PLAN_REVISION "x" is not a positive number — this worker joins the unversioned group`. When the catalog cannot be read, the worker still starts, with `catalog unreadable (…) — vLLM and SGLang start with no tool-call parser`. ## What happens 1. Reads `config.yaml` and the environment, then checks the flags and the variables above. 2. Detects the hardware: OS, architecture, CPU cores, RAM, GPUs and their memory. 3. Picks the node id and the address, and writes `~/.opod/node.yaml`. 4. Starts its API on the address (see [Worker API](https://opod.io/docs/core-reference/worker-api/)) and calls `POST /admin/v1/nodes/register` on the leader with its hardware, engine, role, KV tier, plan revision and a new boot id. 5. Heartbeats every 5 seconds with the models its engine has loaded, the engine's load and process state. 6. With `OPOD_LOAD_MODEL`, loads that model once the engine answers. Output: ```text ✔ joining cluster at http://leader:8080 as n_abc123 ▶ address: 192.0.2.51:8081 ▶ hardware: linux/amd64 · 64 GB RAM ``` After that it logs JSON lines, for example `registered with leader`. ## When the leader answers badly | Leader answer to a heartbeat | What the worker does | | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `404` (the leader forgot the node, for example after `opod node remove`) | Registers again at once. | | `401` or `403` | Registers again with the token it started with. A leader that is restarting answers `401` for a moment, so one refusal changes nothing. When **6 re-registers in a row** are refused (about 30 seconds), the worker exits with `join token refused 6 times in a row: the token this worker started with is dead (rotated, or minted by an endpoint that is gone) — exiting so a restart reads the current one`. | | Network error or `5xx` | Retries with backoff: 10 s, then 20 s between attempts, until the leader is back. | A failed first register only logs `register failed`; the heartbeat loop then registers again on its `404`. From core v0.4.6 the worker also says, in one line per kind on stderr, what the leader answered: `registered with leader … as n_… — it is placeable after its first heartbeat (≤5 s)` on stdout once it is in; `the leader at … refused the join token — mint one on the leader: opod token create --node`; `cannot reach the leader at … (…) — check the URL and the firewall`. The JSON log lines stay as they are. A stop the worker chose — 6 refused re-registers, or its port in use (`port … is in use — another opod join on this host? stop it, or give this worker another port with OPOD_ADVERTISE_ADDR (and OPOD_BIND_ADDR)`) — ends with `opod: worker stopped: ` and exit `1`; before, it printed `✔ worker shutdown complete` and exited `0`. In the release after core v0.4.8 the worker binds its port before it registers, so a taken port stops the join before the leader hears of it: the line is `opod: port … is in use — …` (no `worker stopped:`) with exit `1`, and no `registered with leader` line comes first. ## Stopping On `SIGINT` or `SIGTERM`: 1. The worker sends a **goodbye** heartbeat at once (nothing loaded, engine `stopped`, `worker shutting down`), with a 3-second deadline, so the leader takes it out of rotation now instead of after the heartbeat bound. 2. It lets the requests already running on it finish, for up to `OPOD_DRAIN_SECONDS` (default `10`, `0` = stop at once, at most `3600`). A gang part also waits while a peer still holds a connection to one of its ports. 3. It stops every engine process it started. ```text ✔ worker shutdown complete ``` Give a container a grace period longer than `OPOD_DRAIN_SECONDS`. --- title: "opod node" description: "List and inspect the cluster's nodes, drain and undrain them, and remove a node from the leader." url: "https://opod.io/docs/core-cli/node/" markdown_url: "https://opod.io/docs/core-cli/node.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod node > List and inspect the cluster's nodes, drain and undrain them, and remove a node from the leader. ## In short `opod node` lists the machines the leader knows and takes them in and out of rotation. A drain stops new requests to a node and lets running ones finish; a remove makes the leader forget it. Run it on the leader host. ```bash opod node drain n_abc123 ``` ```text ✔ n_abc123 is draining (through the running leader): it gets no new requests and no new shard parts; requests already on it finish. A sharded model with a part on it stops serving. ▶ it stays drained across heartbeats and a worker restart — undo with `opod node undrain n_abc123` ``` ## Usage ```text opod node ls opod node show ID opod node drain ID opod node undrain ID opod node remove ID [--yes] ``` A node is one machine the leader knows: the leader itself (id `local`) and every worker that joined with `opod join`. Run these commands on the leader host, as the user that runs `opod up`: they read `~/.opod/config.yaml`, the store at `storage.dsn` (`~/.opod/state.db` by default) and the admin key in `~/.opod/admin.key`. | Sub-command | Aliases | How it reaches the leader's state | Works with no leader running | | ------------ | ------- | --------------------------------- | ---------------------------- | | `ls` | `list` | reads the store | yes | | `show ID` | — | reads the store | yes | | `drain ID` | — | admin API, else the store | yes | | `undrain ID` | — | admin API, else the store | yes | | `remove ID` | `rm` | admin API, else the store | yes | Node ids come from `opod node ls`. A worker's id is `OPOD_NODE_ID` if its manager set one, else the id saved in the worker's `~/.opod/node.yaml`, else `n_`, else a random `n_` plus 8 characters. See [`opod join`](https://opod.io/docs/core-cli/join/#identity-and-address). ## opod node ls ```bash opod node ls ``` ```text ID HOSTNAME OS/ARCH ADDRESS STATE LAST HB local leader-1 linux/amd64 127.0.0.1:8080 ready 2026-10-30T10:12:44Z n_abc123 node-a linux/amd64 192.0.2.51:8081 ready 2026-10-30T10:12:42Z n_def456 node-b linux/amd64 192.0.2.52:8081 draining 2026-10-30T10:12:41Z n_ghi789 node-c linux/amd64 192.0.2.53:8081 lost 2026-10-30T10:02:10Z ``` | Column | Meaning | | ---------- | ----------------------------------------------------------------------------------------------------------------------- | | `ID` | The node id. The leader's own row is always `local`; `opod up` writes it at start with the address `127.0.0.1`. | | `HOSTNAME` | What the worker reported at register. | | `OS/ARCH` | `GOOS/GOARCH` of the worker binary. | | `ADDRESS` | Where the leader dials the worker: its LAN address on port `8081`, or `OPOD_ADVERTISE_ADDR`. | | `STATE` | The state the leader acts on (below). | | `LAST HB` | The last heartbeat, RFC 3339. Workers heartbeat every 5 seconds. | With no nodes yet, it prints ``(no nodes registered yet — issue a join token: `opod token create --node`)``. There is no `--json`. For machine output, call `GET /admin/v1/nodes` (see [Admin API](https://opod.io/docs/core-reference/admin-api/)). From core v0.4.6, `opod node ls --json` prints the same rows as a list (`id`, `hostname`, `platform`, `address`, `state` — the live one — and `last_heartbeat`), and an extra argument is a usage error. ### States `STATE` is computed when the row is read, by the same rule the router uses to pick a worker. So a node reads `lost` here at the moment the leader stops sending it requests. | State | Stored or derived | Meaning | | --------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `joining` | stored | A pre-ready state the store and router understand. Core's own register writes `ready` directly, so you do not normally see it; a heartbeat moves a `joining` row to `ready`. | | `ready` | stored | In rotation. | | `draining` | stored | You drained it. It gets no new requests and no new gang parts. It stays `draining` even when its heartbeats stop. | | `lost` | derived, never stored | A `ready` or `joining` node whose last heartbeat is older than the heartbeat bound: `router.heartbeat_max_age_seconds`, default `30`; `0` means a 60-second bound. | | `engine-silent` | derived, never stored | The worker heartbeats, but its engine has not answered it for longer than the same bound (a 60-second bound when the setting is `0`). The worker is alive and nothing says what it serves, so it gets no new work. A drained node still reads `draining`. | A drain also survives a worker restart: a worker that registers again under a drained id stays `draining`. When a `lost` worker heartbeats again, it is back in rotation at once. You do nothing. ## opod node show ```bash opod node show n_abc123 ``` Prints the node's stored record as indented JSON, plus `loadedModels`: the models placed on it, from the heartbeat-reconciled placement rows. ```json { "ID": "n_abc123", "Hostname": "node-a", "OS": "linux", "Arch": "amd64", "RAMGB": 64, "Address": "192.0.2.51:8081", "WorkerToken": "sk-orc-", "BoundKeyID": "k_…", "HardwareJSON": "{\"Hostname\":\"node-a\",\"OS\":\"linux\",\"Arch\":\"amd64\",\"CPUCores\":16,\"RAMGB\":64,\"GPUs\":[{\"Name\":\"…\",\"VRAMGB\":48}],\"Engine\":\"vllm\"}", "LastHeartbeat": "2026-10-30T10:12:42.118Z", "State": "ready", "BootID": "…", "EngineSilentSince": "0001-01-01T00:00:00Z", "loadedModels": ["llama-3.2-3b"] } ``` The store record has no JSON tags, so its keys are the Go field names. `State` here is the **stored** value, not the derived one: a lost node still shows `ready`. `HardwareJSON` is what the worker registered, as a JSON string: `Hostname`, `OS`, `Arch`, `CPUCores`, `RAMGB`, `GPUs` (each `Name`, `VRAMGB`), and when set `Engine`, `Role`, `KVTier` and `PlanRevision` (and, from core v0.4.7, `KVEvents: true` for a worker started with `OPOD_KV_EVENTS=1`). `BootID` names the worker process; it changes on every worker restart. A zero `EngineSilentSince` means the engine answers. > **The output holds a secret, up to 0.3.0** > > `WorkerToken` is the secret the leader signs its calls to that worker with. Up to and including 0.2.1 it is printed whole: treat that output as a secret and do not paste it into a ticket. In 0.3.0 it is redacted to its prefix and last four characters (`sk-orc…6789`). `GET /admin/v1/nodes` still carries it whole in both, because front doors read it there to call the workers. `opod node show` with no id prints `opod: usage: opod node show `. An unknown id prints `opod: no such node: `. From core v0.4.6, `opod node show ` prints a short human summary (the live state, the last heartbeat, platform, RAM, address and what is loaded) and `--json` prints the record above; an unknown id says `no node (see opod node ls)`. ## opod node drain ```bash opod node drain n_abc123 ``` ```text ✔ n_abc123 is draining (through the running leader): it gets no new requests and no new shard parts; requests already on it finish. A sharded model with a part on it stops serving. ▶ it stays drained across heartbeats and a worker restart — undo with `opod node undrain n_abc123` ``` What happens: 1. The CLI calls `POST /admin/v1/nodes/{id}/drain` on the leader, so the change is on the leader's event stream. 2. The leader sets the node's state to `draining`. The router stops choosing it from the next request. 3. Requests already on the node finish. The worker keeps running and keeps heartbeating. 4. A gang with a part on that node stops serving, because a gang needs every part. A drain does not unload models and does not stop the worker. To move a model off the node with no failed request, use [`opod model move`](https://opod.io/docs/core-cli/model/#opod-model-move) before or instead. The leader's own node cannot be drained: ```text opod: the leader's own node cannot be drained — unload its models (`opod model unload `) or stop the leader (`opod down`) ``` From core v0.4.6, draining a node that is already draining says `… is already draining — nothing changed` and exits `0`; undraining one that is not drained says `… is not drained — nothing changed`. The check reads this host's store, so it applies on the leader's host. ## opod node undrain ```bash opod node undrain n_abc123 ``` ```text ✔ n_abc123 is back in rotation (through the running leader): the router may choose it from the next request on ``` It sets the stored state back to `ready`. A node that is still not heartbeating then reads `lost`. ## opod node remove ```bash opod node remove n_abc123 # asks: Remove node "n_abc123" from the cluster? … (y/N) opod node remove n_abc123 --yes # no prompt; -y is the same ``` The prompt accepts `y` or `yes`. Anything else, or a stdin that is not a terminal, answers no and the command exits with `opod: aborted`. Scripts pass `--yes`. Through a running leader (`DELETE /admin/v1/nodes/{id}`), the leader deletes the node row and its placements, and its router drops the node's cached connection, its cooldown and its sticky-session pins: ```text ✔ removed n_abc123 (through the running leader): its placements are gone and the router dropped its cached connection, cooldown and sticky pins ``` The worker process keeps running. Its next heartbeat gets `404`, and a worker that gets `404` registers again. So a node you remove while it runs comes back within about 5 seconds. Stop the worker first (Ctrl-C or `SIGTERM` on `opod join`) if you want it gone. ## Leader or store `drain`, `undrain` and `remove` call the running leader first. They fall back to writing the store directly only when **no leader answered** — not when the leader refused. The output names which path ran: | Output says | Meaning | | ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `through the running leader` | The leader took the change. It is on the event stream, and for `remove` the router's in-memory state is cleared too. | | `written to the store — no leader answered` | No leader was reached. The row was changed in `state.db`; a leader started later reads it. On 0.2.1 a host with no `admin.key` also lands here while a leader runs; from 0.3.0 that case is refused, naming the leader that answered and the missing key. | A leader that answers with an error is final. The CLI prints its status and body, for example `opod: drain n_x: POST /admin/v1/nodes/n_x/drain: 404 Not Found: …`, and changes nothing. > **No admin key means no leader** > > The CLI reaches the leader with the key in `~/.opod/admin.key`, at `http://localhost`. When that file is missing (a managed leader writes none), the call never leaves the CLI, so it counts as "no leader answered" and the CLI writes the store, even when a leader is running. A running leader then does not see the change on its event stream, and after a store-only `remove` its router still holds the old connection. On such a host, use the admin API with an admin key instead. > > From core v0.4.6 this changes. The CLI also uses the admin token the leader was started with (`OPOD_ADMIN_TOKEN`), so on a managed leader the call goes through the leader. `node ls` and `node show` ask the running leader first too. On a managed host (`OPOD_MANAGED=1`) a command never writes or reads a store of its own: with no leader answering it refuses and says so. See [Core CLI](https://opod.io/docs/core-cli/#where-commands-act). With no leader and an unknown id, the store path prints `opod: drain n_x: no such node` (or `remove n_x: no such node`). ## Add a node ```bash opod token create --node # on the leader; the key is printed once opod join "http://leader:8080?token=sk-orc-" # on the new machine ``` Quote the URL: `?` is a glob character in zsh. See [`opod join`](https://opod.io/docs/core-cli/join/) and [Clusters](https://opod.io/docs/core/clusters/). --- title: "opod model" description: "Search the catalog, install models on the leader or on named workers, manage what is in engine memory, move a model between workers, and remove it." url: "https://opod.io/docs/core-cli/model/" markdown_url: "https://opod.io/docs/core-cli/model.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod model > Search the catalog, install models on the leader or on named workers, manage what is in engine memory, move a model between workers, and remove it. ## In short `opod model` finds, installs and removes models, and controls what the leader's engine holds in memory. `add --node` installs a model on named workers; `move` hands a model from one worker to another without a failed request. Run it on the leader host. ```bash opod model add llama-3.2-3b --node n_abc123 ``` ```text ▶ placing llama-3.2-3b on n_abc123 (workers pull + load; this may take a few minutes)… ✔ placed llama-3.2-3b on n_abc123 ``` ## Usage ```text opod model add ID [--force] [--dry-run] [--node a,b,c] [--from FILE.yaml] opod model ls [--json] opod model ps [--json] opod model search [QUERY] [--sort=released] [--since YYYY-MM-DD] [--json] opod model info ID [--json] opod model load ID [--swap] [--pin] [--priority N] opod model unload ID opod model move ID --from NODE --to NODE opod model remove ID [--yes] ``` Run these on the leader host. Each sub-command reaches the leader's state in one of three ways, and that decides whether it needs `opod up` running: | Sub-command | Alias | Path | Needs a running leader | | ----------- | ------ | ------------------------------------------------------------- | ---------------------- | | `add` | — | the local engine and the store; with `--node`, the admin API | only with `--node` | | `ls` | `list` | the store | no | | `ps` | — | `GET /admin/v1/memory` | yes | | `search` | — | the catalog and the store | no | | `info` | — | the catalog and the store | no | | `load` | — | `POST /admin/v1/models/{id}/load` | yes | | `unload` | — | `POST /admin/v1/models/{id}/unload`, else the engine directly | no | | `move` | — | `POST /admin/v1/models/{id}/move` | yes | | `remove` | `rm` | the local engine and the store | no | The catalog these commands read is the merged one: the embedded entries plus your override directories. See [Catalog format](https://opod.io/docs/core-reference/catalog/). ## opod model add Install a model. | Flag | Effect | | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--force` | Skip the hardware floor check (`hardware.min_ram_gb`, `min_vram_gb`). With `--node`, also replace the model a one-model engine is serving on that worker. | | `--dry-run` | Print the plan. Pull nothing and save nothing. `--dryrun` is the same. Not with `--node`. | | `--node a,b,c` | Pull and load on these workers, through the leader. `--nodes` is the same; the flag may repeat. | | `--from FILE.yaml` | Install from your own catalog entry (below). | Flags may come in any order. `ID` is a catalog id, or one of these scheme prefixes, which skip the catalog and the hardware check: | Prefix | Example | Source | | --------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------- | | `hf:` | `hf:bartowski/Phi-3-mini-GGUF`, `hf:bartowski/Phi-3-mini-GGUF:Phi-3-mini-Q4_K_M.gguf` | A Hugging Face repo, optionally `:FILE` for one file. | | `ollama:` | `ollama:phi3:mini` | An Ollama library tag. Needs the Ollama engine. | | `file:` | `file:/models/my.gguf` | A GGUF already on disk. | ```bash opod model add llama-3.2-3b opod model add gpt-oss-120b --force opod model add qwen3.6-27b --dry-run opod model add hf:bartowski/Phi-3-mini-GGUF opod model add --file ./my-model.yaml # --from up to core v0.4.5 opod model add llama-3.2-3b --node n_abc123,n_def456 ``` With no id, or an id that is not in the catalog, an interactive terminal opens a picker. With no terminal, it exits `opod: no model selected`. ### On the leader's own engine (no `--node`) This path does not go through a running leader: the CLI talks to the configured engine and writes the store itself. 1. **Hardware floor.** It compares the entry's `min_ram_gb` with this machine's total RAM, and `min_vram_gb` with its largest GPU. On a machine with no discrete GPU (or Apple unified memory) only RAM is compared. A gap refuses: ```text opod: model gpt-oss-120b needs at least 80 GB RAM; this machine has 24 GB (override with `opod model add gpt-oss-120b --force` if you know what you're doing) ``` An entry with no floor (every scheme id) only warns: `no hardware floor known for … — proceeding without check`. 2. **Source check.** It sends a `HEAD` to the upstream (the Ollama registry or Hugging Face), with a 5-second limit. A `404` refuses: `opod: source for … does not exist: …`. Any other failure only warns: `could not verify source for … (…) — proceeding anyway`. `OPOD_SKIP_SOURCE_CHECK=1` skips the check (air-gapped mirrors). 3. **Sharded?** An entry with `sharding.required: true` hands off to [`opod shard create`](https://opod.io/docs/core-cli/shard/) with no count, which picks one and needs the running leader. 4. **Engine match.** The entry's source type must suit the engine: `opod: source type "ollama" in … is not compatible with engine vllm — switch engines or use a different scheme prefix`. 5. **Pull** through the engine, with a progress bar, then a row in the store: `✔ installed: llama-3.2-3b`. When the pull worked but the store write failed, it says `the weights for … are installed, but recording the … failed` and asks you to run `add` again once the store is healthy. ### On workers (`--node`) ```bash opod model add llama-3.2-3b --node n_abc123 ``` ```text ▶ placing llama-3.2-3b on n_abc123 (workers pull + load; this may take a few minutes)… ✔ placed llama-3.2-3b on n_abc123 ``` The CLI calls `POST /admin/v1/models` with `{"id", "nodes", "force"}`. The leader resolves the entry and calls each worker's `/v1/model/load`; the worker's engine pulls and loads it. Nothing is pulled on the leader. The model is routable once the worker's next heartbeat reports it loaded. The CLI waits up to 45 minutes. A worker whose engine serves one model per process (vLLM, SGLang, llama.cpp, TensorRT-LLM) would stop what it serves. The leader refuses that and names both models; the CLI adds `(replace it on purpose with opod model add … --node … --force)`. ### Dry run ```bash opod model add qwen3.6-27b --dry-run ``` ```text Dry-run plan for qwen3.6-27b Name … Download size 17.0 GB Min RAM 24 GB License apache-2.0 Released 2026-03-22 Engine ollama (would pull "…") Engine status reachable Hardware OK Source check upstream exists ETA ~5 min at 50 MB/s No weights pulled. Run `opod model add qwen3.6-27b` to proceed. ``` `Hardware` reads `OK`, the gap with `— would refuse without --force`, or `no floor known`. `Source check` reads `upstream exists`, `NOT FOUND — install would refuse`, or `could not verify`. The ETA assumes 50 MB/s. A sharded entry shows the next step (`opod shard create …`) instead of an engine. ### From your own entry (`--from`) ```bash opod model add --file ./my-model.yaml [--dry-run] [--force] # --from up to core v0.4.5 ``` 1. Reads and parses the file. It needs `id:` and `source.type:` (`ollama`, `huggingface` or `file`), else it stops: ``…: missing `source.type:` field — set to ollama, huggingface, or file``. 2. Applies the signature policy (below) to the file as given. 3. With `--dry-run`, prints the plan and stops. Nothing is saved. 4. Copies the file to `~/.opod/catalog/.yaml` (or to `catalog_dir` when `config.yaml` sets one), with its `.minisig` when there is one. An existing file of that name is not overwritten: it warns `… already exists — remove or rename it first` and installs once without saving. 5. Runs the install above. From then on the entry is like any catalog entry. From core v0.4.6, `model add` names a catalog YAML with `--file` (in `model move`, `--from` is the source node), and `add --node` says `placing … — Ctrl-C stops waiting, not the pull`, prints `… still placing … (Ns)` every 10 s on stderr while the workers pull, and ends with `next: opod node show `. ## opod model ls ```bash opod model ls ``` ```text ID STATUS SOURCE INSTALLED llama-3.2-1b ready ollama:llama3.2:1b 2026-10-30T10:01:12Z qwen-coder-7b ready ollama:qwen2.5-coder:7b 2026-10-30T10:20:40Z ``` The installed models in the store. `SOURCE` is `:`. With none: ``(no models installed — try `opod model add llama-3.2-3b`)``. `--json` prints the rows with Go field names: `ID`, `CatalogID`, `Source`, `Status`, `SizeBytes`, `InstalledAt`. A model placed on workers with `--node` is listed too, with `SOURCE` `node:,` (the workers named at placement time). What each worker actually holds is `opod node show ID` (`loadedModels`); what the cluster serves is `GET /v1/models`. ## opod model ps What is resident in the **leader's own engine** memory right now. Calls `GET /admin/v1/memory`. ```text MODEL RAM VRAM PINNED PRIO LAST USED qwen-coder-14b 9.0 GB 9.0 GB pinned 2 2026-10-30 10:20 llama-3.2-1b 1.3 GB 1.3 GB — 0 never Memory: 10.3 GB resident of 19.2 GB budget (24.0 GB total RAM) · 8.9 GB free Tip: `opod model load --swap` evicts least-recently-used models to make room. `--pin` protects a model. ``` The budget is total RAM minus `placement.reserve_percent`. With `placement.exclusive: true` (or `opod up --exclusive`) the summary adds `exclusive mode`. Only Ollama reports residency; for any other engine it prints `(engine cannot report residency — memory view requires Ollama)`. `--json` prints the leader's answer as is: `supported`, `exclusive`, `total_ram_bytes`, `budget_bytes`, `resident_bytes`, `free_bytes`, and `resident[]` with `catalog_id`, `size_bytes`, `vram_bytes`, `pinned`, `priority`, `last_used`. ## opod model search ```bash opod model search # the whole catalog opod model search coder # text match opod model search vision # capability match: vision, embedding, tools, … opod model search --sort=released opod model search --since 2026-01-01 opod model search gguf --json ``` | Argument / flag | Effect | | -------------------- | ----------------------------------------------------------------------------------------------------------------- | | `QUERY` | Case-insensitive substring of the id, the display name, a capability or a tag. One word; a second is ignored. | | `--sort=released` | Newest first. `--sort released` and `--sort-released` are the same. Entries with no date go last, smallest first. | | `--since YYYY-MM-DD` | Only entries released on or after that day. Entries with no date are left out. | | `--json` | The full entries, each with `installed`. | Without `--sort`, entries come smallest first. Any other flag is `opod: unknown flag: … (run opod model --help)`. ```text ID NAME SIZE RAM CAPABILITIES RELEASED INSTALLED qwen-coder-7b Qwen2.5 Coder 7B 4.7 GB 8G chat,code,fim 2024-11-12 ✓ … Tip: `opod model info ` for full details on one model. `opod model add ` to install. ``` From core v0.4.6, a search with no match says `no catalog model matches "X"` instead of printing an empty table; `--since` must be `YYYY-MM-DD` and `--sort` takes only `released`, each a usage error (exit `2`) otherwise. ## opod model info ```bash opod model info qwen-coder-14b opod model info qwen-coder-14b --json # the catalog entry as JSON ``` Prints the entry: status (installed or not, and when), source and its URL, size, quantization, context window, RAM and VRAM floor, capabilities, recommended engines, tags, sharding, licence and its URL, release date, and the fallback chains (`Fallback`, `Fallback (context-length)`, `Fallback (content-policy)`). Then an install line and copy-paste use snippets: an embeddings `curl` for an embedding model, else a chat `curl`, an image example for a vision model, and the environment lines for an OpenAI-shape tool. The snippets use `http://localhost:8080` and `sk-orc-...`; `opod connect` prints them with your real URL and key. From core v0.4.6 the snippets in `model info` use this host's real base URL (`OPOD_BASE_URL`, `external_url` or the listen address, as `opod connect` does) instead of a fixed `http://localhost:8080`, and a sharded model's install line is `opod shard create ` (it picks the part count). ## opod model load Bring an installed model into the leader engine's memory now, under memory admission. Calls `POST /admin/v1/models/{id}/load` and waits up to 45 minutes. | Flag | Default | Effect | | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- | | `--swap` | off | Evict least-recently-used, non-pinned models to make room. Each is drained first and recorded. | | `--pin` | off | Exempt the model from eviction and from the engine's idle unload. | | `--priority N` | `0` | Restore order on the next `opod up`, higher first. `--swap` evicts lower priorities first. A value that is not a number is read as `0`. | ```text ▶ evicted llama-3.2-1b (freed 1.3 GB) ✔ loaded qwen-coder-14b (pinned — exempt from eviction and idle TTL) ``` A model that is already resident only has its desired placement updated: `✔ … is already resident — desired placement updated (pin=true)`. Loaded and pinned models are restored, by priority, on the next `opod up`. Refusals: | `error.type` | What the CLI prints | | ------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `needs_swap` | The reason, each model `--swap` would evict with its size, then `rerun with opod model load … --swap to accept the eviction(s)`. | | `blocked_by_pinned` | The reason, and a pointer to `opod model ps` and to unpinning. | | `impossible` | The reason: the model does not fit even with everything else evicted. | Any other flag is `opod: unknown flag: …`. ## opod model unload ```bash opod model unload llama-3.2-3b ``` Through the running leader, it drains the model's in-flight requests, then drops it from engine memory: `✔ unloaded llama-3.2-3b (drained, weights still on disk; stays unloaded across restarts)`. The weights stay on disk, and the model is not restored on the next `opod up`. When the engine has no unload call, the leader answers "noop" and the CLI warns `… — restart the engine to free RAM`. With no leader answering, the CLI asks the engine directly (10-second limit), with no drain: `✔ unloaded … from ollama (weights still on disk)`. An engine with no online unload (vLLM, MLX-LM) gets the warning `… does not support online unload — restart the engine to free RAM`. From core v0.4.6, `model load` and `model unload` also accept a model id the leader lists (a model placed only on workers), `model ps --json` refuses an answer that is not JSON instead of passing it through, and `model remove` says when the engine kept the weights (`removed X from the store, but ollama did not delete its weights … — delete them with ollama rm …`) instead of printing `removed`. ## opod model move ```bash opod model move llama-3.2-3b --from n_abc123 --to n_def456 ``` Another worker takes over a whole model by overlap, so no request fails. All three arguments are required, and one model at a time. It needs the running leader and waits up to 45 minutes. ```text ▶ moving llama-3.2-3b from n_abc123 to n_def456: the target loads it while n_abc123 keeps serving (a cold target downloads the weights first — this can take a while)… 10:20:01 started admitted; loading on the target, the source keeps serving 10:21:37 loaded the target serves the model — both workers take requests 10:21:37 flipped the source is out of rotation: new requests go to the target 10:21:39 drained nothing is in flight on the source 10:21:40 finished the source unloaded the model ✔ llama-3.2-3b is now served by n_def456; n_abc123 let it go ▶ no KV cache moved: a conversation n_abc123 was serving recomputes its prompt on n_def456 at its next turn ``` | Step | Meaning | | ---------- | --------------------------------------------------------------------------------------------------------------------- | | `started` | Admitted. The target loads the model; the source keeps serving. When the target already serves it, nothing is loaded. | | `loaded` | The target serves the model. Both workers take requests. | | `flipped` | The source is out of rotation for this model. | | `drained` | Nothing is in flight on the source, or the drain timed out with N requests left. | | `finished` | The source unloaded the model. | | `aborted` | The move stopped, with the reason and the state it left. A target that never serves leaves the source serving. | The leader refuses a move up front when it cannot work: the target cannot hold the model beside what it has, runs a one-model engine that serves something else, or takes no new work; the source does not hold the model, or serves adapters of it; the model is sharded. The steps are also events (`model.move_*`). See [Clusters](https://opod.io/docs/core/clusters/#move-a-model-to-another-worker). | Error | Cause | | ------------------------------------------------------------------------ | ----------------------- | | `opod: a model id, --from and --to are all required` | A missing argument. | | `opod: one model at a time: got "a" and "b"` | Two ids. | | `opod: --from needs a node id` | `--from` with no value. | | `… a move needs the running leader — start it with opod up on this host` | No leader answered. | ## opod model remove ```bash opod model remove llama-3.2-3b # asks: Remove installed model "llama-3.2-3b"? Weights will be deleted from disk. (y/N) opod model remove llama-3.2-3b --yes # -y is the same ``` It asks the local engine to delete the model (a failure only warns and goes on), deletes the store row and forgets the leader's desired placement for it, so the next `opod up` does not try to restore it: `✔ removed: llama-3.2-3b`. This path writes the store directly; it does not go through a running leader. With no terminal on stdin and no `--yes`, it exits `opod: aborted`. An id that is not installed opens the picker on a terminal. ## Interactive picker `add`, `info`, `remove`, `load` and `unload` with no id, or an id that is not in the catalog (`add`, `info`) or not installed (`remove`, `load`, `unload`), open a picker on an interactive terminal. With no terminal they exit `opod: no model selected`. ## Catalog signatures With `OPOD_CATALOG_PUBKEY` set (a minisign public key, or a file that holds one), a catalog file that has `FILE.minisig` beside it must verify — for `--from` and for every catalog directory — and one that does not is refused. `OPOD_CATALOG_REQUIRE_SIGNED=1` refuses unsigned files too. The embedded catalog is never checked. A verified `--from` file prints `✔ signature verified against key …`. --- title: "opod shard" description: "Create, list and remove gangs (one model split across several workers), run several gangs of one model, and read the errors a create returns." url: "https://opod.io/docs/core-cli/shard/" markdown_url: "https://opod.io/docs/core-cli/shard.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod shard > Create, list and remove gangs (one model split across several workers), run several gangs of one model, and read the errors a create returns. ## In short `opod shard` splits a model that is too big for one worker into a **gang** across several, and removes it again. With no count it picks the number of parts from the workers' free memory. It calls the running leader. ```bash opod shard create llama-3.3-70b-sharded --nodes n_a,n_b ``` ```text ▶ creating sharded model llama-3.3-70b-sharded on [n_a n_b] (this may take a few minutes)… ✔ sharded model ready: llama-3.3-70b-sharded ``` ## Usage ```text opod shard create MODEL [N] [--nodes a,b,c] [--tp N] [--pp N] [--gang ID] opod shard ls opod shard remove MODEL [--gang ID] [--yes] ``` A **gang** is one copy of a model split into parts across workers: a coordinator that serves requests and the parts it drives. A model may have several gangs; each serves whole requests, and the router picks the least loaded ready one. In core v0.4.6 that choice is load alone: a conversation's pin, the prefix pin and the route token are not read for a gang. From core v0.4.7 gangs are ranked like workers: a later turn of a conversation, or a prompt whose lead a gang served, stays on that gang while it has a free slot. See [Sharding and gangs](https://opod.io/docs/core/sharding/) for the backends and their rules. All three commands call the running leader's admin API, with the key in `~/.opod/admin.key`, at `http://localhost`. With no leader they fail with `opod: admin call: … (is opod up running?)`; from core v0.4.6 the message names the address, where it came from and the fix (`no leader answering at … — start it with opod up, or set OPOD_BASE_URL`), and `OPOD_BASE_URL` / `OPOD_TOKEN` reach a leader on another host ([Where commands act](https://opod.io/docs/core-cli/#where-commands-act)). | Sub-command | Alias | Admin route | | ----------- | ------ | ------------------------------------------------------- | | `create` | — | `POST /admin/v1/shards/create` | | `ls` | `list` | `GET /admin/v1/shards` | | `remove` | `rm` | `DELETE /admin/v1/shards/{model}` or `…/{model}/{gang}` | ## opod shard create | Argument / flag | Default | Effect | | --------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | `MODEL` | — (required) | A catalog id. The entry's `sharding.engine` picks the backend: `llamacpp` (RPC parts), `vllm` (Ray, or expert parallel), `sglang` (its own launcher). | | `N` | picked (below) | The number of parts, `1` or more. `1` runs the whole model on one worker with no split. | | `--nodes a,b,c` | picked | Put the parts on these workers, in this order. Node ids from `opod node ls`. | | `--tp N` | `0` (not set) | Tensor-parallel size. vLLM and SGLang only. | | `--pp N` | `0` (not set) | Pipeline-parallel size. vLLM and SGLang only; pipeline is vLLM's default. | | `--gang ID` | none | Build this gang only; the model's other gangs keep serving. Without it, the create **replaces every gang** of the model. | Each flag also takes the `--flag=value` form. ```bash opod shard create llama-3.3-70b-sharded # the CLI picks the count opod shard create llama-3.3-70b-sharded 2 # 2 parts on picked workers opod shard create llama-3.3-70b-sharded --nodes n_a,n_b opod shard create llama-3.3-70b-sharded --nodes n_a # N=1: whole model on n_a opod shard create mimo-7b-ray --nodes n_a,n_b --tp 2 # vLLM tensor parallel across 2 machines opod shard create mimo-7b-ray --nodes n_a,n_b --pp 2 # vLLM pipeline parallel opod shard create llama-3.3-70b-sharded --gang g1 --nodes n_c,n_d # a second gang beside g0 ``` Output: ```text ▶ picked 2 part(s): the model needs 42.1 GB; the freest worker has 24.0 GB, so it does not fit in fewer parts; 2 parts of 21.1 GB fit on n_a (24.0 GB free), n_b (24.0 GB free) ▶ creating sharded model llama-3.3-70b-sharded on [n_a n_b] (this may take a few minutes)… ✔ sharded model ready: llama-3.3-70b-sharded ``` With `--tp` above 1 it also prints `tensor-parallel across machines (tp=N): all-reduce twice per layer over the network — expect it to be latency-bound`. A tensor group that crosses machines works, but every token pays for the network. From core v0.4.6 the last line names what was built — `✔ llama-3.3-70b-sharded ready: gang g1 on n_a, n_b (head n_a) — see opod shard ls` — read from the leader's own rows. A `--nodes` id the leader does not know is refused before anything starts; `--node` is the same flag as `--nodes`; a `--nodes`, `--gang`, `--tp` or `--pp` with no value, an unknown flag and a bad count are usage errors (exit `2`). Ctrl-C (or `SIGTERM`) during the wait prints `interrupted — the leader may hold a partial gang of …; clean it up with: opod shard remove … --gang …` and exits `130`; a failed create names the same cleanup. A line every 10 s on stderr says it is still creating. > **Numbers must be numbers** > > `--tp`, `--pp` and `N` must be whole numbers. `N` that is not (or is below 1) is refused: `opod: invalid shard count "x" (must be ≥1; 1 = whole model on one host)`. On 0.2.1 a `--tp` or `--pp` value that is not a number is read as `0` with no error, which means "not set". From 0.3.0 it is refused: `opod: --tp "two" is not a whole number`. ### When the CLI picks the shape With no `N`, no `--nodes`, no `--tp` and no `--pp`, the CLI picks the shape before it calls the leader: 1. It reads the model's size from the catalog. A model with no recorded size keeps the catalog's `default_shards` and says so. 2. It reads, from the leader's store, the workers that heartbeat within the bound, what they registered and what is placed on them, minus `placement.reserve_percent`. 3. It picks the **smallest number of equal parts** that fits the free memory: `1` when the model fits one worker; never more parts than live workers or than the model's layers. 4. It sends the picked workers as an explicit `--nodes` list, so the leader builds exactly what was printed. When nothing fits, it refuses and prints the numbers, for example: ```text opod: cannot pick a shard count for llama-3.3-70b-sharded: the model needs 42.1 GB and no split fits: 2 live worker(s) have 30.0 GB free in total (n_a 18.0 GB, n_b 12.0 GB); even 2 part(s) need 21.1 GB each and worker n_b has 12.0 GB — free memory, join more workers, or name the count yourself ``` With no live worker: `no live workers — join one (opod join) or name the count`. Any shape you name is sent unchanged, and the admin API itself never picks: a request body with no count means the catalog's `default_shards`. A leader with an in-memory store (managed mode) shows the picker no workers; give a count. ### Placement without `--nodes` The leader puts the parts on the strongest workers: a worker with a GPU before one without, then the biggest card, then the biggest host. Name `--nodes` to place them yourself. ### Coordinator The coordinator (llama.cpp's `llama-server --rpc …`) runs on the gang's worker with the most card memory. A worker with no card is chosen only when no candidate has one (then by host RAM), and the leader itself only when there are no workers. On the leader, `OPOD_COORDINATOR_NODE=` pins it; `local` forces the leader. It is ignored for one part. ### Prerequisites (llama.cpp) - `rpc-server` on `PATH` on every part's worker, and `llama-server` on the coordinator's machine. `opod doctor` reports whether both are present. - The catalog entry has `sharding.required: true`, and either a readable `source.path` or a Hugging Face `source.file`, which the leader downloads and distributes to the parts (SHA-256 checked). - Parts listen from port `50052` up and the coordinator on `9001`, unless the entry's `sharding.rpc_port_base` or `sharding.coordinator_port` says otherwise. `--tp` with the llama.cpp backend is refused, because RPC splits by layer only: ```text tp=2: llama.cpp RPC sharding is layer-wise only and has no tensor split (tensor-parallel needs a backend that has one — set sharding.engine=vllm or sharding.engine=sglang in the catalog) ``` ### Timeouts The CLI waits up to **45 minutes**, because a cold create can download and distribute tens of gigabytes. Interrupting the CLI cancels the request, and with it the create on the leader. An interrupted create can leave part rows behind with no coordinator. Check with `opod shard ls`, and if the gang has no `coordinator` row, run `opod shard remove MODEL --gang ID --yes` and create it again. ### Errors A failed create prints the leader's status and body: `opod: POST /admin/v1/shards/create: : {"error":{…}}`. Branch on `error.code` where it is set: | Status | `error.code` | Meaning | | ------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `404` | — | `no catalog entry for `. | | `409` | — or a reason name | The workers cannot hold the shape, or the engine cannot run it. Nothing was changed. A named refusal carries its reason, for example `sglang_pp_tied_llama` (SGLang cannot run a pipeline of a Llama-family model with tied embeddings; use tensor parallelism or vLLM). | | `502` | `gang_part_lost` | A part's worker went away while the gang formed. Its parts were stopped; create again. | | `502` | `gang_part_failed` | A part's process failed to start. Its parts were stopped; read `opod shard ls` and the worker's logs. | | `502` | `gang_create_in_flight` | Another create of the same gang is running and decides the outcome. Wait, then read `opod shard ls`. | | `503` | — | The leader has no orchestrator (a gateway or a door). | ## opod shard ls ```bash opod shard ls ``` ```text MODEL GANG ROLE NODE ADDRESS STATUS llama-3.3-70b-sharded g0 coordinator n_a 192.0.2.51:9001 ready llama-3.3-70b-sharded g0 rpc n_a 192.0.2.51:50052 ready llama-3.3-70b-sharded g0 rpc n_b 192.0.2.52:50052 ready mimo-7b-ray g0 rank n_c 192.0.2.53:6379 ready mimo-7b-ray g0 rank n_d 192.0.2.54 ready mimo-7b-ray g0 coordinator n_c 192.0.2.53:9100 ready ``` | Column | Meaning | | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `GANG` | The gang id. A row with none shows `g0`, the default gang. | | `ROLE` | `coordinator` (the process the router sends requests to), `rpc` (a llama.cpp RPC part), or `rank` (one node of a vLLM or SGLang gang; for vLLM on Ray, rank 0 is the Ray head and the coordinator row points at its vLLM server on port `9100`). | | `NODE` | The worker that runs the process. | | `ADDRESS` | Where the coordinator is dialled, or where a part listens. | | `STATUS` | `starting`, `ready`, `failed` or `stopped`. A vLLM or SGLang coordinator reads `starting` until its API answers (from core v0.4.2; see [When a vLLM or SGLang gang is ready](https://opod.io/docs/core/sharding/#when-a-vllm-or-sglang-gang-is-ready)). | With no gangs, it prints ``(no shards — create one with `opod shard create `)``. For machine output, call `GET /admin/v1/shards`; `GET /admin/v1/shards/processes` lists the supervised processes behind the rows. From core v0.4.6, `opod shard ls --json` prints the leader's list as it is, a field the leader leaves out reads `-`, and an answer that is not a shard list is an error instead of `(no shards …)`. `opod shard remove` of a model (or gang) with no rows says `no gang of … to remove — nothing changed` and exits `0`. ## opod shard remove ```bash opod shard remove llama-3.3-70b-sharded # every gang; prompts opod shard remove llama-3.3-70b-sharded --yes # no prompt; -y is the same opod shard remove llama-3.3-70b-sharded --gang g1 # one gang; the others keep serving ``` The prompt reads `Tear down sharded model "…"? The coordinator + every rpc-server will be stopped. (y/N)`, or, with `--gang`, `Tear down gang "g1" of "…"? Its coordinator + rpc-servers stop; the model's other gangs keep serving. (y/N)`. Only `y` or `yes` goes on. With no terminal on stdin, the answer is no and the command exits `opod: aborted`; scripts pass `--yes`. It stops the coordinator and every part, and deletes the rows: ```text ▶ removing llama-3.3-70b-sharded gang g1… ✔ removed llama-3.3-70b-sharded gang g1 ``` The model keeps its placement while any gang is left. > **Managed endpoints heal their gangs** > > On a leader that runs with a mounted [plan file](https://opod.io/docs/core-reference/plan-file/), a gang the plan declares is formed again by the leader once every part of it is gone and free workers have registered. To remove such a gang for good, change the plan, not the leader. --- title: "opod token" description: "Create, list, expire, renew and revoke API keys and node join tokens on the leader, with the key format and the errors a caller sees." url: "https://opod.io/docs/core-cli/token/" markdown_url: "https://opod.io/docs/core-cli/token.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod token > Create, list, expire, renew and revoke API keys and node join tokens on the leader, with the key format and the errors a caller sees. ## In short `opod token` mints, lists, expires and revokes API keys. A key has one scope (`user`, `admin` or `node`) and an optional expiry, and it is printed once. The commands write the store directly, so they work with no leader running. ```bash opod token create alice --ttl 30d ``` ```text ✔ created alice (id=k_Xb3…, scope=user) expires: 2026-11-29T10:00:00Z (in 720h0m0s) Key (shown once — store it now): sk-orc- ``` ## Usage ```text opod token create [NAME] [--admin | --node] [--ttl DURATION | --expires-at DATE] opod token ls opod token expire ID [--in DURATION] opod token renew ID --ttl DURATION | --expires-at DATE opod token revoke ID ``` A token is an API key: an identity with a scope and an optional expiry. These commands write the leader's store (`storage.dsn`, `~/.opod/state.db` by default) **directly**. They need no running leader, and a running leader sees the change on the next request, because it looks the key up in the store on every request. Run them on the leader host. | Sub-command | Alias | Effect | | ----------- | ------ | --------------------------------------------- | | `create` | — | Mint a key and print it once. | | `ls` | `list` | List keys. Never shows the key itself. | | `expire ID` | — | Set the expiry to now, or to now plus `--in`. | | `renew ID` | — | Set a new expiry. | | `revoke ID` | — | Revoke for good. | ## Scopes | Scope | Flag | Can call | | ------- | --------- | ------------------------------------------------------------------------------------------------------------------ | | `user` | (none) | `/v1/*` — the OpenAI and Anthropic gateway. | | `admin` | `--admin` | `/v1/*` and `/admin/v1/*`. | | `node` | `--node` | The worker join path: `POST /admin/v1/nodes/register` and `…/heartbeat`. This is the join token a worker presents. | A key is an identity only: who calls, with which scope, until when. It carries no rate limit, no quota and no model allowlist. Put those in a gateway in front of the endpoint. ## opod token create | Argument / flag | Default | Effect | | ------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | `NAME` | `default`, or `node-join` with `--node` | The key's name. For `user` and `admin` keys the name is also the key's user id, which usage rows carry. A `node` key has no user id. | | `--admin` | — | Make an `admin` key. | | `--node` | — | Make a `node` key. | | `--ttl DURATION` | no expiry | Expire this long from now. | | `--expires-at DATE` | no expiry | Expire at this time: `YYYY-MM-DD` (midnight UTC at the start of that day) or RFC 3339. | Each flag also takes the `--flag=value` form. When both `--admin` and `--node` are given, the last one wins. When both `--ttl` and `--expires-at` are given, the last one wins. ```bash opod token create alice # user key, never expires opod token create alice-admin --admin opod token create alice --ttl 7d opod token create alice --expires-at 2027-01-01 opod token create --node # a worker join token named node-join opod token create rack-2 --node --ttl 24h # a named join token that expires ``` > **Put the name first** > > The first word that is not a flag is the name; later words are ignored. On 0.2.1, with `--node`, write the name **before** the flag (`opod token create rack-2 --node`): in `opod token create --node rack-2` the flag sets the name to `node-join` first, so `rack-2` is ignored. From 0.3.0 the name is kept in either order, and a node key with no name is `node-join`. The key is printed once: ```text ✔ created alice (id=k_Xb3…, scope=user) expires: 2026-11-06T10:00:00Z (in 168h0m0s) Key (shown once — store it now): sk-orc- ``` - The key is `sk-orc-` followed by 32 URL-safe base64 characters (24 random bytes). - The id is `k_` followed by 11 URL-safe base64 characters (8 random bytes). Commands that take an `ID` take this. - The store keeps only the SHA-256 of the key. A lost key cannot be shown again; mint a new one. When stdout is not a terminal (a pipe, a file, CI), the key is still printed to stdout, and a warning goes to stderr: `secret written to a non-terminal (pipe/redirect/CI) — it may be captured in logs or shell history; rotate it if that wasn't intended.` So `KEY=$(opod token create ci-bot | tail -1)` works, with that warning. > **Node tokens** > > A `node` key is the shared secret between the leader and its workers. Issue it only on a network you trust, and give it an expiry when you can. The first worker that registers a node id with a `node` key binds that id to the key: another `node` key cannot register or heartbeat under the same id. From core v0.4.6: - The key is the only line on **stdout**, so `key=$(opod token create ci)` holds just the key; `created …`, the expiry and the "shown once" note go to stderr, and a `--node` key adds `on the worker: opod join "?token="`. - An argument that starts with `-` and is not a flag is refused, with a did-you-mean: `unknown token create flag --admn — did you mean --admin?` (before, it became the key's name). A second name is refused too. - An expiry in the past is refused (`--ttl=-1h`, `--expires-at 2020-01-01`). - With `OPOD_MANAGED=1` and no `OPOD_STORAGE_DSN`, `create` refuses: the CLI's store would be in memory, and the key would be thrown away. ## Durations and dates `--ttl` and `--in` take Go durations (`30s`, `5m`, `2h`, `1h30m`) plus a whole number of days with `d` (`7d`; not `1.5d`, not `0d`). `--expires-at` takes `YYYY-MM-DD` or an RFC 3339 timestamp such as `2027-01-01T09:00:00-08:00`; both are stored in UTC. | Error | Cause | | --------------------------------------------------------------------- | ------------------------------------ | | `opod: --ttl requires a duration (e.g. 30m, 2h, 7d)` | `--ttl` is the last word. | | `opod: invalid --ttl: invalid days: "1.5d"` | Days must be a whole number above 0. | | `opod: invalid --ttl: time: invalid duration "…"` | Not a Go duration. | | `opod: invalid --expires-at: expected YYYY-MM-DD or RFC3339, got "…"` | Wrong date shape. | ## opod token ls ```bash opod token ls ``` ```text ID NAME SCOPE REVOKED EXPIRES CREATED k_Xb3… alice user no never 2026-10-30T10:00:00Z k_9Lq… node-join node no 2026-10-31T10:00:00Z 2026-10-30T10:00:00Z k_seed_1a2b3c… node-join (seeded) node no never 2026-10-30T09:58:01Z k_cp_team-a team-a user no never 2026-10-30T09:58:02Z ``` No hash and no key are shown. `EXPIRES` is RFC 3339 or `never`. An expired key still shows `REVOKED no`; compare `EXPIRES` with the clock. With no keys, it prints ``(no API keys — create one with `opod token create`)``. From core v0.4.6 the `REVOKED` column is `STATE` — `active`, `expired` or `revoked` — `EXPIRES` is wide enough for its value, and `--json` prints the same rows as a list. Ids tell you where a key came from: | Id prefix | Origin | | ------------ | ---------------------------------------------------------------------------------------------------------------- | | `k_` | `opod token create`, the first `opod up` (`initial-admin`), or `POST /admin/v1/tokens`. | | `k_seed_` | `auth.join_token` / `OPOD_JOIN_TOKEN`, seeded by `opod up` as `node-join (seeded)`. | | `k_seedadm_` | `auth.admin_token`, seeded by `opod up` as `manager-admin (seeded)`. | | `k_cp_` | A key from the mounted [auth snapshot](https://opod.io/docs/core-reference/auth-snapshot/). Its manager owns it. | ## opod token expire ```bash opod token expire k_abc # ✔ k_abc: expired immediately opod token expire k_abc --in 1h # ✔ k_abc: will expire at 2026-10-30T11:00:00Z (in 1h0m0s) ``` With no `--in`, the expiry is now. The next request with the key gets `401 key_expired`. Any other flag is `opod: unknown flag: …`. ## opod token renew ```bash opod token renew k_abc --ttl 30d # 30 days from NOW, not from the old expiry opod token renew k_abc --expires-at 2027-06-01 ``` ```text ✔ k_abc: renewed — expires 2026-11-29T10:00:00Z (in 720h0m0s) ``` `--ttl` counts from now, so a late renewal is predictable. A renew also brings an expired key back. It does not bring a revoked key back. With neither flag: `opod: renew needs --ttl or --expires-at`. There is no way to clear an expiry back to `never`; mint a new key instead. ## opod token revoke ```bash opod token revoke k_abc # ✔ revoked k_abc ``` Revocation is final. The next request with that key gets `401 invalid_api_key`. There is no un-revoke. An unknown id, for `expire`, `renew` or `revoke`, prints `opod: … api_key k_x not found` and exits `1`. From core v0.4.6 it prints `no key k_x (see opod token ls)`; `revoke` names the key (`revoked k_… (alice, scope user) — requests carrying it are refused now`) and says `already revoked — nothing changed` on a repeat (exit `0`); `renew` of a revoked key refuses, because a new expiry does not restore it; a new expiry in the past is refused and points at `opod token expire`. `revoke` asks no confirmation: it ends one key, and a new key replaces it. ## What a caller sees | Status | `error.type` | When | | ------ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `401` | `missing_api_key` | No key in the request. The key is read from `Authorization` (`Bearer `, or the bare key), else `X-Api-Key`, else the `?key=` query parameter. Message: `Authorization header required`. | | `401` | `invalid_api_key` | The key is unknown or revoked. Message: `Invalid or revoked API key`. | | `401` | `key_expired` | Past its expiry. Message: `API key expired at `. | | `403` | `forbidden` | The key's scope does not allow the route, for example a `user` key on `/admin/v1/*`. Message: `Insufficient scope`. | With `auth.require_keys: false` (and no auth snapshot that sets `requireKeys`), `/v1` demands no key and treats every caller as `admin`; a valid key is still recorded on usage rows. `/admin/v1/*` always demands a key, whatever `require_keys` says. See [Security](https://opod.io/docs/core/security/). ## Over the API The same operations are `GET|POST /admin/v1/tokens`, `PATCH /admin/v1/tokens/{id}` (expiry only) and `DELETE /admin/v1/tokens/{id}`. See [Admin API](https://opod.io/docs/core-reference/admin-api/#tokens). --- title: "opod catalog" description: "List the model catalog embedded in the binary and export it as files you can read, copy or override." url: "https://opod.io/docs/core-cli/catalog/" markdown_url: "https://opod.io/docs/core-cli/catalog.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod catalog > List the model catalog embedded in the binary and export it as files you can read, copy or override. ## In short The model catalog ships inside the `opod` binary. `opod catalog ls` prints its ids; `opod catalog export DIR` writes every entry out as a YAML file you can copy and edit. Both read the embedded set only and need no leader. ```bash opod catalog ls | head -3 ``` ```text bge-reranker-v2-m3-gguf deepseek-r1-8b deepseek-v4-flash-sharded ``` ## Usage ```text opod catalog ls opod catalog export DIR ``` The model catalog is a set of YAML entries, one per model. It ships inside the `opod` binary: it comes from core's own `pkg/catalog` package and is compiled in at build time, so it is always present and is never looked up on disk. These two commands read the **embedded set only**. They do not read `~/.opod/catalog/`, `$OPOD_CATALOG_DIR` or any other override directory, and they open no config file and no store. To see the catalog a leader actually uses, merged with your own entries, run [`opod model search`](https://opod.io/docs/core-cli/model/#opod-model-search). | Sub-command | Reads | Writes | Needs a leader | | ------------ | -------------------- | --------------------------- | -------------- | | `ls` | the embedded catalog | stdout | no | | `export DIR` | the embedded catalog | one file per entry in `DIR` | no | ## opod catalog ls Prints one catalog id per line, sorted by file name (each file is named after its id). ```bash opod catalog ls ``` ```text bge-reranker-v2-m3-gguf deepseek-r1-8b deepseek-v4-flash-sharded gemma4-12b … qwen3.6-27b step-3.7-flash-sharded ``` The list is plain text with no header, so it pipes well: ```bash opod catalog ls | wc -l # how many entries this binary carries opod catalog ls | grep -- -sharded # the entries that must be split across workers opod catalog ls | grep gguf # GGUF-only entries ``` Core v0.4.0 carries 48 entries. The number changes from release to release; `opod catalog ls | wc -l` is the answer for the binary you have. Use `opod model info ID` for one entry's details and `opod model search` to filter by name, capability or tag. ## opod catalog export Writes every embedded entry to `DIR`, one file per entry, named `.yaml`. The bytes are exactly the embedded file, comments included. ```bash opod catalog export ./catalog ls ./catalog | head -3 ``` ```text bge-reranker-v2-m3-gguf.yaml deepseek-r1-8b.yaml deepseek-v4-flash-sharded.yaml ``` It prints nothing on success. From core v0.4.6 it prints `✔ wrote 48 catalog entries to ./catalog — overrides go beside them (OPOD_CATALOG_DIR=./catalog)`; with no `DIR` it says `catalog export needs a directory` (exit `2`), and `opod catalog ls --json` prints the ids as a JSON list. What it does, step by step: 1. Creates `DIR` (and its parents) with mode `0755` if it does not exist. 2. Writes each entry with mode `0644`. A file of the same name is **overwritten** without a prompt. 3. Leaves every other file in `DIR` alone. It never deletes. It prints nothing on success and exits `0`. ### Why export - **Read the entries.** The YAML carries comments that explain each model's source, engine and limits. - **Start your own entry.** Copy one as a template, change `id`, `source` and `hardware`, then install it with `opod model add --file FILE.yaml` (`--from` up to core v0.4.5) or drop it into an override directory. - **Give a container a file copy.** A worker image exports the catalog to `/usr/share/opod/catalog`, one of the directories the merge reads. ### Override an entry Put a file with the same `id` in a directory that is read after the embedded set. The later source replaces the earlier entry whole, keyed by `id`: 1. the embedded catalog (least authoritative); 2. `/usr/local/share/opod/catalog`; 3. `/usr/share/opod/catalog`; 4. `$OPOD_CATALOG_DIR`; 5. `~/.opod/catalog/` (most authoritative). Only `*.yaml` and `*.yml` files directly inside a directory are read, never a subdirectory. When `catalog_dir` is set in `config.yaml`, that directory is read **alone**: no embedded catalog and no merge. See [Catalog format](https://opod.io/docs/core-reference/catalog/) for the schema. ```bash opod catalog export /tmp/cat cp /tmp/cat/llama-3.2-3b.yaml ~/.opod/catalog/llama-3.2-3b.yaml $EDITOR ~/.opod/catalog/llama-3.2-3b.yaml # change context_window, say opod model info llama-3.2-3b # now shows your entry ``` ### Signatures and exported files With `OPOD_CATALOG_PUBKEY` set, a file in an override directory that has `FILE.minisig` beside it must verify, and with `OPOD_CATALOG_REQUIRE_SIGNED=1` an unsigned file is refused too. A file that is byte for byte an embedded entry, under the same file name, counts as the embedded catalog: it needs no signature, even with `OPOD_CATALOG_REQUIRE_SIGNED=1`. Once you edit it, or rename it, the signature policy applies to it like any other file. ## Errors and exit codes | Situation | Output | Exit | | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---- | | No sub-command | The help text, on stderr. | `2` | | `export` with no `DIR` | The help text, on stderr. | `2` | | Unknown sub-command | `opod: unknown subcommand: catalog `, a "Did you mean" hint when one is close, and `Run opod catalog --help for usage.` | `1` | | `DIR` cannot be created or written | `error: ` | `1` | | An embedded entry fails to parse or has no `id` (a broken build) | `error: bundled catalog : …` | `1` | --- title: "opod fetch" description: "Download one GGUF file or a safetensors snapshot from Hugging Face into a models directory, exclusively, atomically and resumably, with no leader." url: "https://opod.io/docs/core-cli/fetch/" markdown_url: "https://opod.io/docs/core-cli/fetch.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod fetch > Download one GGUF file or a safetensors snapshot from Hugging Face into a models directory, exclusively, atomically and resumably, with no leader. ## In short `opod fetch` downloads model weights into a models directory, exclusively and atomically: a per-file lock, a temporary file, and a rename only once the file is complete and verified. It needs no leader, so a manager runs it as a prefetch job before a worker starts on the node. ```bash opod fetch bartowski/Llama-3.2-3B-Instruct-GGUF Llama-3.2-3B-Instruct-Q4_K_M.gguf --dir /data/models opod fetch --snapshot Qwen/Qwen2.5-7B-Instruct@a09a354 --dir /data/models ``` ## Usage ```text opod fetch HF_REPO FILE [--dir DIR] [--revision REV] [--sha256 DIGEST] opod fetch --snapshot HF_REPO[@REV] [--dir DIR] [--revision REV] ``` `opod fetch` makes model weights present in a models directory. It needs no leader, no config file and no store. It is the same pull a worker runs before it starts an engine, so a manager can run it as a **prefetch** job on a node before any worker pod starts there, and the worker then finds the weights warm. | Form | Fetches | For | | ------------------------------------- | ---------------------------------------------------- | ------------ | | `opod fetch HF_REPO FILE` | One file, normally a `.gguf`. | llama.cpp | | `opod fetch --snapshot HF_REPO[@REV]` | The file set a safetensors engine loads from a repo. | vLLM, SGLang | ## Flags | Flag | Default | Effect | | -------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | `--dir DIR` | `$OPOD_MODELS_DIR` | The models directory. Required one way or the other. | | `--revision REV` | `$OPOD_MODEL_REVISION` | A commit sha, tag or branch. Empty means `main`, which moves when the repo owner pushes. A revision with a `/` or `..` is refused. | | `--sha256 DIGEST` | `$OPOD_MODEL_SHA256` | The SHA-256 the file must have, hex. A mismatch removes the file and fails. One file only. | | `--snapshot HF_REPO[@REV]` | — | Fetch a snapshot instead of one file. | Flags may come before or after the positional arguments. `FILE` must be a bare file name: no `/` and no `..`. ```bash opod fetch bartowski/Llama-3.2-3B-Instruct-GGUF Llama-3.2-3B-Instruct-Q4_K_M.gguf --dir /data/models opod fetch bartowski/Llama-3.2-3B-Instruct-GGUF Llama-3.2-3B-Instruct-Q4_K_M.gguf \ --dir /data/models --revision 5ab33fa --sha256 6c1a2b… opod fetch --snapshot Qwen/Qwen2.5-7B-Instruct@a09a354 --dir /data/models ``` On success it prints the path of the weights on stdout, one line, and exits `0`. Logs go to stderr as text lines. From core v0.4.6 they are one human line per event (`▶ fetching file (url=…, to=…)`, `▶ already cached (path=…)`), a long download adds `▶ still fetching (done=12.3 of 40.1 GiB (30%))` every 30 seconds, and `--log-format json` gives structured lines for a log collector instead. ```text /data/models/Llama-3.2-3B-Instruct-Q4_K_M.gguf /data/models/Qwen-Qwen2.5-7B-Instruct@a09a354 ``` ### Revisions with `--snapshot` - A revision after `@` is the explicit one. It wins over `$OPOD_MODEL_REVISION`. - A revision after `@` that disagrees with a typed `--revision` is refused: `error: --snapshot names revision "a" and --revision names "b": say it once`. - `--snapshot repo@` (an empty revision) is refused: `error: --snapshot wants [@revision], got "repo@"`. - A snapshot takes no `--sha256`: one digest cannot describe a set of files. Pin the revision to a commit sha instead; each weight file is checked against the SHA-256 the Hub records for it. A typed `--sha256` is refused; a `$OPOD_MODEL_SHA256` in the environment is ignored for a snapshot. ## Where the weights go | What | Path | | ---------------- | ------------------------------------------------------------------ | | An unpinned file | `DIR/FILE` | | A pinned file | `DIR/@/FILE` | | A snapshot | `DIR/@/` (an unpinned snapshot is under `…@main/`) | The slug is the repo name with every character other than a letter, a digit, `-`, `.` or `_` replaced by `-`, and leading and trailing `-` removed: `Qwen/Qwen2.5-7B-Instruct` → `Qwen-Qwen2.5-7B-Instruct`. So two revisions of one model can be cached side by side. Beside each file opod writes a few small files of its own: | File | Purpose | | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `FILE.opod` | The **marker**: JSON with the repo, file, size, digest, fetch time and last-use time. [`opod cache prune`](https://opod.io/docs/core-cli/cache/) deletes only files that have one. | | `FILE.lock` | The per-file lock, present while a pull runs. | | `FILE.partial-…` | The download in progress. | | `.opod-snapshot.json` | In a snapshot directory: the manifest, written last. The directory counts as a complete snapshot only when it exists and every file it names is present at its size. | ## What happens For one file: 1. **Size.** A `HEAD` to the Hub (30-second limit) gives the file's size. With no answer (offline, a mirror without `HEAD`), the size is unknown. 2. **Already there?** A file that is present, not empty, and of the right size — or of any size when the size is unknown — counts as complete. With `--sha256`, its digest is checked (once; the marker remembers a match). opod records the use for least-recently-used pruning and prints the path. No download. 3. **Lock.** It creates `FILE.lock` exclusively. When another process holds it, it waits until that process finishes the file (then returns its result) or the lock goes away. A lock whose holder died is taken over at once. An old-style lock with no live holder is replaced after 6 hours. 4. **Download.** It writes to a `FILE.partial-…` sibling. When a partial is there from an earlier attempt, it resumes with an HTTP `Range` request; a server that ignores `Range` starts over. 5. **Check and rename.** Only when the byte count matches the server's, and the digest matches when one was given, is the partial renamed to `FILE`. A reader never sees a half file under the final name. 6. **Marker.** It writes `FILE.opod`. A marker that cannot be written only warns: `cache marker not written: this file will never be pruned`. For a snapshot: 1. It lists the repo at the revision through the Hub API and resolves the revision to a commit. 2. It chooses the files an engine loads, from the **top level** of the repo only: - one weight format: `.safetensors` when there is any, else PyTorch (`.bin`, `.pt`, `.pth`), never both; - `consolidated*.safetensors` is dropped when `model*.safetensors` exists (the same tensors twice); - training files are dropped: `training_args.bin`, `optimizer.bin`, `optimizer.pt`, `scheduler.pt`, `scaler.pt`, `rng_state.pth`; - side files by extension: `.json`, `.txt`, `.model`, `.tiktoken`, `.jinja`, `.py`; - nothing else: no subdirectories (`original/`, `onnx/`, `gguf/` hold the model in other formats), no READMEs, no images, no empty files, no `.gguf`. 3. It fetches each chosen file as above, with the same lock and the same atomic rename, and checks each weight file against the Hub's SHA-256. 4. It writes `.opod-snapshot.json` last. A vLLM or SGLang worker that finds a complete snapshot of its model at this path serves from it and does not pull at launch. ## Guarantees - **Exclusive.** One pull per file, whatever the number of callers. The others wait and share its result. - **Atomic.** No partial file under the final name, ever. - **Idempotent.** Run it twice and the second run downloads nothing. - **Resumable.** `SIGINT` or `SIGTERM` (what Kubernetes sends a deleted pod) cancels the pull cleanly: the lock is released and the partial is kept, so the next attempt resumes at once. - **Owned.** Only files opod fetched carry a marker, and only those can ever be pruned. ## Hub errors A refusal by the Hub fails by name, so a manager can say what to fix: | Error | Meaning | Fix | | ------------------- | ----------------------------------------------------------- | -------------------------------------------------------- | | `hub-token-missing` | No `HF_TOKEN`, and the repo is gated or private. | Set `HF_TOKEN`. | | `hub-token-refused` | The token is not accepted. | Mint a new token. | | `hub-access-denied` | The token is valid, but its account may not read this repo. | Accept the model's licence on the Hub with that account. | `HF_TOKEN` is the Hugging Face token, sent as `Authorization: Bearer`. `HF_ENDPOINT` points at a mirror (default `https://huggingface.co`). A digest mismatch reads `fetch: … the cached FILE hashes to sha256:…, not the sha256:… this version records` for a cached file, and removes a freshly downloaded one. ## Result file With `OPOD_FETCH_RESULT=PATH`, a successful fetch also writes one JSON line to `PATH` (mode `0644`), only once the weights are in place: ```json {"path":"/data/models/Qwen-Qwen2.5-7B-Instruct@a09a354","signature":{…}} ``` `signature` says whether the repository publishes a model-transparency signature (`model.sig`): `unsigned`, `unverified` or `unknown`. It is looked for, never verified, so it never reads as a pass. In Kubernetes, point `OPOD_FETCH_RESULT` at `/dev/termination-log` to read the result from the pod status. A failure to write the file only warns (`fetch result not written`); the fetch still succeeds. From core v0.4.6 the warning names the file, the error and where the weights are. The typed shape is `FetchResult` in core's [`pkg/adminapi`](https://github.com/opod-io/opod-core/tree/main/pkg/adminapi). ## Exit codes | Code | Meaning | | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `0` | The weights are in place. | | `1` | The fetch failed: `error: fetch: …` on stderr (`opod: fetch: …` from core v0.4.6). A Hub that does not answer says `cannot reach the Hub at (HF_ENDPOINT, or the default) … — check the address and the network, or unset HF_ENDPOINT`. | | `2` | Usage error (the usage text on stderr), a bad `--snapshot` argument, or no `--dir` and no `OPOD_MODELS_DIR` (`error: --dir or OPOD_MODELS_DIR required`). | --- title: "opod cache" description: "List a node's weight cache, prune what no plan references without touching files opod did not fetch, and keep a disk KV-cache tier under a size bound." url: "https://opod.io/docs/core-cli/cache/" markdown_url: "https://opod.io/docs/core-cli/cache.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod cache > List a node's weight cache, prune what no plan references without touching files opod did not fetch, and keep a disk KV-cache tier under a size bound. ## In short `opod cache` lists and reclaims the space model weights take on a node. It only ever deletes files opod itself fetched (they carry a marker), and it is a dry run unless you pass `--apply`. `kv-prune` keeps a disk KV-cache tier under a size cap. It runs on the node with no leader. ```bash opod cache prune --dir /data/models # what would go opod cache prune --dir /data/models --apply # remove it ``` ```text would remove Llama-3.2-3B-Instruct-Q4_K_M.gguf 1.9 GB (last used 31h0m0s ago) would remove 1 item(s), 1.9 GB; kept 2 referenced or recent; left 1 file(s) this cache did not write (my-own-model.gguf) ``` ## Usage ```text opod cache ls [--dir DIR] [--json] opod cache prune [--dir DIR] [--keep a,b] [--min-age 24h] [--target-free GB] [--sweep 24h] [--apply] [--json] opod cache kv-prune --dir DIR --max-gb N [--keep a,b] [--every 10s] [--apply] [--json] ``` Models are pulled once per node into the models directory and shared by every worker on it. Nothing deletes from that directory on its own, so a node fills up. `opod cache` reclaims the space safely. It runs on the node, without a leader, a config file or a store. A manager runs `prune` as a job and passes the files its plans still reference. Two facts make a delete safe: - **A marker.** [`opod fetch`](https://opod.io/docs/core-cli/fetch/) and every worker pull write `FILE.opod` beside each file they fetch. A prune only ever considers files with a marker. Everything else on the volume is the owner's and is never touched, whatever it looks like. - **The download lock.** A prune takes the same per-file lock a download takes, so a prune and a pull never race. Whoever gets the lock goes first. ## opod cache ls What is cached, which entries opod fetched, their size and when each was last used. | Flag | Default | Effect | | ----------- | ------------------ | ------------------------ | | `--dir DIR` | `$OPOD_MODELS_DIR` | The models directory. | | `--json` | off | A JSON array of entries. | ```bash opod cache ls --dir /data/models ``` ```text Llama-3.2-3B-Instruct-Q4_K_M.gguf 1.9 GB opod last used 3h12m0s ago Qwen-Qwen2.5-7B-Instruct@a09a354/ (snapshot, 14 files) 14.2 GB opod last used 26h4m0s ago my-own-model.gguf 4.1 GB not ours last used never recorded ``` One line per entry: the name, the size in GiB, `opod` or `not ours`, and the last use. A file pinned to a revision is named `@/FILE` and listed by itself. A safetensors snapshot is **one** entry with the directory's total size, because an engine loads the whole directory. opod's own bookkeeping files (`*.opod`, `*.lock`, `*.partial-*`, `*.trash-*`) are not listed. A directory that is not a `@` revision directory is not looked into. ### JSON fields | Field | Meaning | | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `path` | Absolute path. | | `file` | Name relative to `--dir`: `a.gguf`, `@/a.gguf`, or `@` for a snapshot. | | `repo` | The Hugging Face repo, from the marker. | | `size` | Bytes; for a snapshot, the sum of its files. | | `ours` | `true` when opod fetched it. Only these can be pruned. A snapshot is ours only when its manifest reads and **every** file in it has a marker. | | `fetchedAt`, `lastUsedAt` | From the marker. A worker or a fetch that finds the file records a use. | | `revision` | Set for anything under a revision directory. | | `snapshot`, `files` | A snapshot directory, and how many files it holds. | ## opod cache prune Remove cached entries that are opod's, that no one references, and that have not been used for a while. **A dry run unless you pass `--apply`.** | Flag | Default | Effect | | ------------------ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--dir DIR` | `$OPOD_MODELS_DIR` | The models directory. | | `--keep a,b` | — | Entries that must survive, comma-separated (below). | | `--min-age D` | `24h` | Leave entries used more recently than this, so a rollback finds its weights warm. | | `--target-free GB` | `0` | Stop once the volume has this many GB free. `0` removes every prunable entry. | | `--sweep D` | `24h` | With `--apply`, also clear the leftovers of crashed pulls (temp files and locks nothing writes any more) older than this. `0` turns it off. Without `--apply` there is no sweep. | | `--apply` | off | Actually delete. | | `--json` | off | One JSON result object. | ### What `--keep` matches - A **bare file name** (`a.gguf`) keeps that file wherever it is cached: at the top and under every revision. - A **path under `--dir`** (`org-model@rev/a.gguf`) keeps exactly that entry. - A **snapshot** is kept by its directory name (`Qwen-Qwen2.5-7B-Instruct@a09a354`, bare or as a path) or by the path of any file inside it. Never by a bare file name, since every snapshot holds a `config.json`. The manager computes this list: every file a plan, a job, an in-flight prefetch or a staged model version on this node references. `prune` trusts it. ### Rules 1. Only entries with opod's marker are considered. A file opod did not fetch is never deleted, whatever the disk pressure; the summary names it. 2. Entries used within `--min-age` and entries on the keep list are kept. 3. The least recently used entries go first. 4. With `--target-free`, the prune stops as soon as the volume has that much free. 5. Each removal takes the file's download lock. A file a pull holds is left for the next run. A lock whose holder died is taken over. 6. A safetensors snapshot goes **whole**, under every one of its files' locks, or stays whole. The manifest is removed first, so an engine that starts mid-prune pulls for itself instead of loading a directory that is losing files. One file in it that opod did not write leaves the whole directory alone. 7. A removal renames the file to `.trash-…` and then unlinks it, so a reader that opened it a moment earlier keeps reading. ```bash opod cache prune --dir /data/models # what would go opod cache prune --dir /data/models --keep Qwen-Qwen2.5-7B-Instruct@a09a354 --apply opod cache prune --dir /data/models --target-free 100 --min-age 72h --apply ``` ```text would remove Llama-3.2-3B-Instruct-Q4_K_M.gguf 1.9 GB (last used 31h0m0s ago) would remove 1 item(s), 1.9 GB; kept 2 referenced or recent; left 1 file(s) this cache did not write (my-own-model.gguf) dry run: pass --apply to delete ``` With `--apply`, `would remove` reads `removed`, the last line is gone, and a sweep that cleared anything says `swept N leftover(s) of crashed pulls` on stderr. ### JSON result | Field | Meaning | | ------------------------- | ----------------------------------------------------------- | | `removed` | The entries removed, or that would be (same shape as `ls`). | | `freedBytes` | Bytes freed, or that would be. | | `kept` | Entries kept because referenced or recent. | | `skipped` | Files that are not opod's, by name. | | `dryRun` | `true` without `--apply`. | | `totalBytes`, `freeBytes` | The volume holding the cache, measured where the prune ran. | | `volumeErr` | Why the volume could not be measured, when it could not. | | `swept` | Leftovers cleared by `--sweep`. | > **A full node** > > On a node whose disk is full, the kubelet admits only pods of priority `system-cluster-critical` and above, so a prune job of normal priority cannot start on the node that needs it most. Give the prune job a priority class that is admitted under disk pressure. ## opod cache kv-prune Bound a disk KV-cache tier: the directory an engine writes KV blocks to (the `kv_tier_fs` engine flag). The engine never deletes from it, so something must. A manager runs this beside the engine, for as long as the engine writes the directory. | Flag | Default | Effect | | ------------ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | `--dir DIR` | — | The tier directory. Required. | | `--max-gb N` | — | Cap on the tier's files, in GiB; decimals are allowed. Required. `0` removes everything but the `--keep` entries. | | `--keep a,b` | — | Top-level entries of `--dir` that are never touched. | | `--every D` | `0` (once) | Repeat at this idle interval until stopped (`SIGINT` or `SIGTERM`). While the tier grows or is being trimmed, the next pass follows within 1 second. | | `--apply` | off | Actually delete. | | `--json` | off | One JSON object per pass. | ```bash opod cache kv-prune --dir /data/kvtier/ep --max-gb 100 # one dry pass opod cache kv-prune --dir /data/kvtier/ep --max-gb 100 --every 10s --apply # keep it bounded ``` ```text /data/kvtier/ep: 103.40 GiB in the tier; removed 812 file(s), 13.42 GiB (walk 41 ms, remove 220 ms) ``` How a pass works: 1. It walks `--dir` and counts only the tier's own files: `*.bin` (blocks), `*.tmp` (blocks being written) and `config.json`. 2. When the total is above `--max-gb`, it removes the oldest files first until the total is at **90 %** of `--max-gb`, so the next burst does not trip the cap at once. - From core v0.4.7, with `--every`, a pass also counts the growth since the previous pass as already written (at most half of `--max-gb`). It trims when the total plus that growth is above `--max-gb`, down to 90 % less the growth, so a tier that a burst keeps filling is trimmed ahead of it. The growth is measured from one pass to the next, so in core v0.4.7 a burst that starts while the pruner is idle (one pass every `--every`) is not trimmed ahead: on NFS, two writers took a tier capped at 0.85 GiB to 1.07 GiB before the first trim, 10 s after the burst began. - From core v0.4.8, while idle the loop also reads the volume's free space every second (one `statfs` call, not a walk) and runs a pass at once when it has dropped by a twentieth of `--max-gb`. The same two-writer burst then peaked at 0.95–1.08 × the cap in four runs. Another writer on the same volume only brings a pass forward. - From core v0.4.7, a pass lists up to 32 directories at once. On a network filesystem (NFS) each listing is a round trip, and vLLM puts almost every block in its own directory: a one-at-a-time pass took 3.7 s for 3,362 blocks on NFS, long enough for two writers to take a 1 GiB tier to 2.28 GiB. 3. Entries named in `--keep` are never touched. With `--every`, a pass that removes nothing prints nothing (except with `--json`), and a failed pass prints `error: …` and the next pass tries again. A single pass that fails exits `1`. JSON per pass: `dir`, `dryRun`, `usedBytes` (before the pass), `removed` (files), `freedBytes`, `totalBytes` and `freeBytes` (the volume), `volumeErr`, `walkMs`, `removeMs`. A pass much longer than `--every` is how a burst outruns the cap. ## Exit codes | Code | Meaning | | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `0` | Done (or a dry run). | | `1` | An error: `error: …` on stderr. | | `2` | No `--dir` and no `$OPOD_MODELS_DIR` (`error: --dir or OPOD_MODELS_DIR required`), or, for `kv-prune`, no `--dir` or no `--max-gb` (`error: --dir and --max-gb are required`). | From core v0.4.6: - Every message starts with `opod:`, and `kv-prune` names the flag it lacks (`needs --dir, the tier directory` or `needs --max-gb, the tier's cap in GiB`). An extra argument is a usage error. - Sizes are labelled **GiB**, which is what they always were (bytes ÷ 2³⁰). - `ls` on an empty cache says `(no weights cached in )`. - `prune`'s dry run says it does not sweep crashed pulls; with `--apply` the sweep's count is on stdout with the summary, and a failed sweep is a warning. - `kv-prune` on a directory that does not exist warns (`… does not exist — nothing to prune`) and still exits `0` with its result — a sweep may find a tier already gone. With `--every` it prints a start line, waits for the directory the engine creates (warning every 10 minutes while it is missing, so a mistyped `--dir` shows), and prints an idle pass at most once a minute. - `--json` stays one object per line: a control plane reads the last line that starts with `{`. --- title: "opod image" description: "List the container images opod publishes, show one image's node requirements and limits, and find the image that serves a model, offline." url: "https://opod.io/docs/core-cli/image/" markdown_url: "https://opod.io/docs/core-cli/image.md" section: "Core CLI" last_updated: "2026-11-02" --- # opod image > List the container images opod publishes, show one image's node requirements and limits, and find the image that serves a model, offline. ## In short `opod image` answers which container image runs which engine on which accelerator, from a list embedded in the binary. `recommend` picks the image for a catalog model. It needs no registry, no config and no leader, so it gives the same answer everywhere. ```bash opod image recommend llama-3.1-8b --vendor nvidia ``` ```text llama-3.1-8b — weights: safetensors, min VRAM 20 GB IMAGE ENGINE VENDOR ARCH GANG PROVEN ★ opod-worker-vllm-nvidia vllm nvidia amd64 ray yes ``` ## Usage ```text opod image ls [--engine E] [--vendor V] [--json] opod image show IMAGE [--json] opod image recommend MODEL [--vendor V] [--json] ``` The list of published images is data embedded in the binary (`images/images.yaml` in the core repository). These commands read only that list and the embedded catalog. They open no config file, no store and no registry, so they give the same answer on a laptop, in CI and to an agent that plans a deployment. | Sub-command | Aliases | | ----------- | ------- | | `ls` | `list` | | `show` | `info` | | `recommend` | `for` | Every sub-command takes `--json`, anywhere on the line. **Vendors:** `nvidia`, `amd`, `intel`, `tt` (Tenstorrent), `cpu`. `tenstorrent` is accepted for `tt` and `none` for `cpu`. **Engines:** `llamacpp`, `mlx`, `ollama`, `sglang`, `trtllm`, `vllm`, and their aliases (`llama-cpp`, `sgl`, `tensorrt-llm`, `tt`, …). Only `llamacpp`, `vllm`, `sglang` and `trtllm` have images; `ollama` and `mlx` run on a host started with `opod up`. ## opod image ls | Flag | Default | Effect | | ------------ | ------- | ------------------------------------------------------------------- | | `--engine E` | all | Only worker images of this engine. An alias resolves to its engine. | | `--vendor V` | all | Only worker images for this vendor. | | `--json` | off | A JSON array of images. | A filter matches worker images only, since the leader has no engine and no vendor. ```bash opod image ls ``` ```text IMAGE ENGINE VENDOR ARCH GANG PROVEN opod-leader - - amd64,arm64 - yes opod-worker-llamacpp-nvidia llamacpp nvidia amd64 rpc yes opod-worker-llamacpp-amd llamacpp amd amd64 rpc yes opod-worker-llamacpp-intel llamacpp intel amd64 rpc yes opod-worker-llamacpp-cpu llamacpp cpu amd64,arm64 rpc yes opod-worker-vllm-nvidia vllm nvidia amd64 ray yes opod-worker-vllm-amd vllm amd amd64 - yes opod-worker-vllm-intel vllm intel amd64 - no opod-worker-vllm-tt vllm tt amd64 - yes opod-worker-sglang-nvidia sglang nvidia amd64 - yes opod-worker-sglang-amd sglang amd amd64 - no opod-worker-sglang-intel sglang intel amd64 - no nvcr-trtllm-nvidia trtllm nvidia amd64,arm64 - yes Tip: `opod image show ` for node requirements and limits. `opod image recommend ` to pick one. ``` | Column | Meaning | | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ARCH` | The platforms the image is published for. | | `GANG` | How a worker on this image joins a model split across nodes: `rpc` (a llama.cpp RPC part), `ray` (vLLM multi-node), `-` (the manifest names no scheme). | | `PROVEN` | `yes` once the image has served requests on the hardware it names. `no` means built and published, not yet run on that hardware. | > **SGLang gangs** > > The SGLang images read `-` in `GANG`, but they do form multi-node gangs, through SGLang's own launcher (`--dist-init-addr`, `--nnodes`, `--node-rank`; rank 0 serves). The manifest's `gang` field accepts only `rpc` and `ray`, so the column cannot say it. The image's own notes say the same. ```bash opod image ls --vendor amd --json opod image ls --engine vllm opod image ls --vendor tenstorrent ``` When nothing matches, it exits `1` with `opod: no image matches (vendors: …; engines with an image: …)`. With `--json`, an empty match prints `[]` and exits `0`. From core v0.4.6, a `--vendor` or `--engine` no image is built for is a usage error in both views, `no image is built for vendor "foo" (vendors: …)`, exit `2`; a real filter with no match prints `[]` and exits `1` under `--json` too, so the exit code says the same thing in both. `--engine` lists only engines with an image, an extra argument to `ls` is refused, and `image show` with part of a name (`vllm-nvidi`) suggests the full one. ## opod image show ```bash opod image show vllm-nvidia ``` ```text opod-worker-vllm-nvidia vLLM on CUDA. … pull ghcr.io/opod-io/opod-worker-vllm-nvidia:0.21.0 role worker engine vllm vendor nvidia hardware NVIDIA GPUs (CUDA) platforms amd64 weights safetensors gang ray — vLLM multi-node proven yes — has served on this hardware base vllm/vllm-openai:… dockerfile images/worker-vllm/Dockerfile The node must provide - … Limits - … Pin it by digest before deploying: crane digest ghcr.io/opod-io/opod-worker-vllm-nvidia: ``` `IMAGE` may be: - the full name: `opod-worker-vllm-nvidia`; - the name without `opod-` or `opod-worker-`: `vllm-nvidia`, `leader`; - a repository path: anything up to the last `/` is dropped, so `ghcr.io/opod-io/opod-worker-vllm-nvidia` works. Matching ignores case. An unknown name prints `opod: no image "…"` with a "Did you mean" hint when one is close, else ``opod: no image "…" (run `opod image ls`)``. The `pull` line names a tag only on a release binary, whose version is `X.Y.Z`. A dev build prints the repository with no tag and says so: releases are tagged `X.Y.Z` and there is no floating `latest`. The `gang` line reads `rpc — a part of a llama.cpp RPC split across nodes (label io.opod.llamacpp.rpc=true)`, `ray — vLLM multi-node`, or `one node only`. ### Upstream images `nvcr-trtllm-nvidia` is run exactly as NVIDIA publishes it (`upstream: true`). NVIDIA's container licence forbids a derived copy, so opod never rebuilds or pushes it, it has no Dockerfile, and its repository is `nvcr.io/nvidia/tensorrt-llm/release`, not ghcr. The manager copies the `opod` binary and entrypoint into it at start from the leader image. Pulling it means accepting NVIDIA's terms. ## opod image recommend | Argument / flag | Effect | | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `MODEL` | A catalog id from the **embedded** catalog, or a scheme id `opod model add` takes: `hf:/`, `file:`, `ollama:`. Override directories are not read, so the answer does not depend on the machine. | | `--vendor V` | Only that vendor's images. A vendor with no image is refused: `opod: no image is built for vendor "…" (vendors: …)`. | | `--json` | The recommendation as JSON. | ```bash opod image recommend llama-3.1-8b --vendor nvidia opod image recommend hf:Qwen/Qwen2.5-7B-Instruct --json opod image recommend llama-3.3-70b-sharded ``` ```text llama-3.1-8b — weights: safetensors, min VRAM 20 GB IMAGE ENGINE VENDOR ARCH GANG PROVEN ★ opod-worker-vllm-nvidia vllm nvidia amd64 ray yes ★ = the pick for that vendor: the model's first recommended engine with an image, proven hardware first. Every endpoint also runs one opod-leader. `opod image show ` lists what the node must provide. ``` How it decides, step by step: 1. **Weights.** The entry's source sets the format: a `.gguf` file → `gguf`; a Hugging Face repo with no file → `safetensors`; an Ollama-library entry → `ollama`, which no image pulls. 2. **Engines, in order.** It walks the entry's `recommended_engines`. A scheme id has none, so every engine with an image is tried. 3. For each engine it skips, with a reason under "Not offered": - an engine with no worker image (`ollama`, `mlx`): ``no worker image runs …; it serves on a host started with `opod up` ``; - for an entry that must be split, an engine other than its `sharding.engine`: `the entry is split across workers by …`; - an engine that does not load these weights: `vllm loads safetensors; this entry's weights are a GGUF file`; - with `--vendor`, an engine with no image for that vendor; - for an entry that must be split, an image with no gang scheme: `the entry must be split across workers and this image serves one node only`. 4. **Order and star.** Candidates keep the engine order; within an engine, proven images come before unproven ones. The first candidate of each vendor gets `★` (`"recommended": true` in JSON). When no image fits, it prints `No published image can serve this entry.` and still exits `0`. An id that is neither in the embedded catalog nor a scheme id exits `1` with ``opod: no catalog entry for "…" (try `opod model search`, or hf:/)``. It is a lookup, not a measurement. Whether the model fits a card is `min_vram_gb` (`opod model info ID`) and your decision. > **Sharded SGLang entries** > > Because the SGLang images carry no `gang` value, `recommend` skips them for an entry that must be split, even when that entry's `sharding.engine` is `sglang`. Read the image notes, or choose the image by hand. ## JSON fields `ls --json` prints an array of image objects; `show --json` prints one. | Field | Meaning | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `name` | Image name. | | `repository` | `ghcr.io/opod-io/`; for an upstream image, its base without the tag. | | `tag` | This binary's version, on a release binary only. | | `role` | `leader` or `worker`. | | `engine`, `vendor` | Absent on the leader. | | `arch` | Platforms. | | `dockerfile` | Path in the core repository; empty for an upstream image. | | `base` | The upstream image, tag without digest. | | `weights` | `gguf`, `safetensors`, or both. | | `gang` | `rpc`, `ray`, or absent. | | `proven` | Boolean. | | `hardware` | Free text: the cards it is built for. | | `families` | GPU architecture generations, for example `nvidia:ampere`, `amd:rdna3`. Absent = unknown, not "none". The image carries the same tokens in its `io.opod.gpu.families` label from `0.3.0`; the published `0.2.1` images have no such label, so a control plane reads them as unknown. | | `requires` | What the node must provide (driver, runtime, device files). | | `upstream` | `true` for an image run as its vendor publishes it. | | `summary`, `notes` | One line, and the limits to know before choosing it. | `recommend --json` prints: ```json { "model": "llama-3.1-8b", "weights": "safetensors", "engines": ["vllm"], "sharded": false, "candidates": [ { "name": "opod-worker-vllm-nvidia", "…": "…", "recommended": true } ], "min_vram_gb": 20, "min_ram_gb": 32 } ``` `shard_by` is present when `sharded` is `true`. `skipped`, `min_vram_gb` and `min_ram_gb` are left out when empty or zero. ## Pin by digest There is no floating `latest` tag. Pin what you deploy: ```bash crane digest ghcr.io/opod-io/opod-worker-vllm-nvidia: docker buildx imagetools inspect ghcr.io/opod-io/opod-worker-vllm-nvidia: ``` See [Images](https://opod.io/docs/core-reference/images/) for each image's details and the container contract. --- title: "opod batch" description: "Run an OpenAI batch input file against any OpenAI-compatible URL at bounded concurrency, resumably, never sending a line twice." url: "https://opod.io/docs/core-cli/batch/" markdown_url: "https://opod.io/docs/core-cli/batch.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod batch > Run an OpenAI batch input file against any OpenAI-compatible URL at bounded concurrency, resumably, never sending a line twice. ## In short `opod batch run` sends an OpenAI batch file (JSONL, one request per line) to any OpenAI-compatible URL at bounded concurrency. It keeps its progress in a work directory, so a stopped run resumes on the same directory and never sends a line twice. It needs no leader and no store. ```bash export OPOD_API_KEY=sk-orc- opod batch run --input requests.jsonl --base-url http://leader:8080 --dir ./run1 ``` ```json {"progress": {"total": 1000, "completed": 420, "failed": 3}} {"batch": {"total": 1000, "completed": 997, "failed": 3, "interrupted": 0, "state": "completed", "output": "run1/output.jsonl", "errors": "run1/errors.jsonl"}} ``` ## Usage ```text opod batch run (--input FILE|URL | --input-url PRESIGNED_URL) --base-url URL --dir WORKDIR [options] ``` `opod batch run` is a generic OpenAI batch client. It reads a file in OpenAI's batch line format (one JSON object per line with `custom_id`, `method`, `url`, `body`), sends each line to an OpenAI-compatible server, and writes OpenAI's batch output shape. It needs no leader and no store: point it at an opod leader or any other server. ## Flags | Flag | Default | Effect | | ----------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | | `--input FILE\|URL` | — | The input: a JSONL path, or an `http(s)` URL read with the key (for example an OpenAI files content URL). | | `--input-url URL` | `$OPOD_BATCH_INPUT_URL` | The input as a URL that carries its own authorization (a presigned GET). Read **without** the key. Give `--input` or `--input-url`, not both. | | `--base-url URL` | `$OPOD_BASE_URL` | The server, with or without `/v1`. Required. | | `--dir DIR` | — | Work directory: the progress record and the result files. Required. | | `--concurrency N` | `8` | Requests in flight at once. | | `--file-order` | off | Send lines in file order. By default lines that share a leading prompt are sent together, so the engine's prefix cache reuses it. | | `--model-map a=b[,c=d]` | — | Rewrite a line's `model`. Other models are sent as written. | | `--ca FILE` | `$OPOD_LEADER_CA` | PEM certificate an `https` base URL must be signed by. | | `--timeout D` | `10m` | Per-request timeout. | | `--ready-timeout D` | `0` | Wait up to this long for `GET /v1/models` to accept the key before the first line. `0` does not wait. | | `--drain D` | `20s` | After a stop, how long in-flight requests may finish. | | `--status-url URL` | — | An OpenAI batch object (`…/v1/batches/`), read with the key on `SIGTERM`. | | `--output-url URL` | `$OPOD_BATCH_OUTPUT_URL` | `PUT` `output.jsonl` here when the run ends. A URL that carries its own authorization. | | `--error-url URL` | `$OPOD_BATCH_ERROR_URL` | `PUT` `errors.jsonl` here when the run ends. | | `--progress-every D` | `5s` | How often a progress line is printed. `0` = never. | The key comes from `OPOD_API_KEY`, else `OPENAI_API_KEY`, and is sent as `Authorization: Bearer`. With neither set, requests go out with no key. `--base-url` may end in `/v1` or not; a line's `url` of `/v1/chat/completions` is joined to it without doubling the `/v1`. ```bash export OPOD_API_KEY=sk-orc- opod batch run --input requests.jsonl --base-url http://leader:8080 --dir ./run1 opod batch run --input requests.jsonl --base-url http://leader:8080/v1 --dir ./run2 \ --concurrency 32 --model-map gpt-4o-mini=llama-3.2-3b ``` More flags, one per line: ```bash opod batch run --input requests.jsonl --base-url https://leader.example.com --dir ./run3 \ --ca /etc/opod/ca.crt \ --file-order \ --timeout 2m \ --ready-timeout 10m \ --drain 1m \ --progress-every 30s # A managed job: presigned input and result URLs, and the batch's status URL for SIGTERM opod batch run --input-url "$OPOD_BATCH_INPUT_URL" --base-url http://leader:8080 --dir /work \ --output-url "https://bucket.example.com/out.jsonl?X-Amz-Signature=…" \ --error-url "https://bucket.example.com/err.jsonl?X-Amz-Signature=…" \ --status-url http://batch-api.example.com/v1/batches/batch_abc ``` ## Input lines Each non-blank line is one request in OpenAI's batch format: ```json {"custom_id": "q-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "llama-3.2-3b", "messages": [{"role": "user", "content": "hi"}]}} ``` Blank lines are skipped and not counted; line numbers stay the input's. A line longer than 64 MiB fails the whole run before anything is sent. A line that cannot be sent is not sent, and goes to `errors.jsonl` with code `invalid_request` and one of these messages: | Message | Cause | | ------------------------------------------------- | ------------------------------------------------------------------ | | `the line is not a JSON object: …` | Not JSON. | | `custom_id is required` | No `custom_id`. | | `method must be POST` | A `method` other than `POST` (an empty method is taken as `POST`). | | `url must be a path such as /v1/chat/completions` | `url` does not start with `/`. | | `body must be a JSON object` | `body` missing or not an object. | `--model-map` rewrites `body.model` before the line is sent; a bad map is refused at start: `error: --model-map "x": want alias=id[,alias=id]`. An `http(s)` `--input` (or `--input-url`) is downloaded once into the work directory as `input.jsonl` (temporary file, then rename), so a resume never reads a file that changed underneath it. `--input` sends the key with the download; `--input-url` does not, because a presigned URL is its own credential. ## The work directory The directory is the whole progress record. Run the same command on the same directory to resume. | File | Holds | | -------------- | ----------------------------------------------------------------------------------------------------------------- | | `sent.jsonl` | One `{"line":N}` per input line, written and synced **before** that line's request leaves. | | `output.jsonl` | One OpenAI output object per answered line (2xx). | | `errors.jsonl` | One object per failed line: a non-2xx answer, a transport error, a malformed line, or a line in flight at a kill. | Every result's id is `batch_req_`. One result line looks like this: ```json {"id": "batch_req_0", "custom_id": "q-1", "response": {"status_code": 200, "request_id": "…", "body": {…}}, "error": null} {"id": "batch_req_7", "custom_id": "q-8", "response": null, "error": {"code": "request_failed", "message": "…"}} ``` A non-2xx answer keeps the server's own status and body in `response`. The runner's own error codes are `invalid_request` (a malformed line), `request_failed` (a transport error or the per-request timeout), `interrupted` (in flight at a kill) and `cancelled` (cut off by a cancel). When a resume finds `input.jsonl` already in the directory, it uses it as is. **At most once.** A line recorded as sent but with no result was in flight when the previous run died. It is **not** sent again: it goes to `errors.jsonl` with code `interrupted`. Collect those `custom_id`s and submit them again if you want them retried. A lost work directory starts again from line 0. ## Output Progress lines and the final summary are JSON on stdout: ```json {"progress": {"total": 1000, "completed": 420, "failed": 3}} {"batch": {"total": 1000, "completed": 997, "failed": 3, "interrupted": 0, "state": "completed", "output": "run1/output.jsonl", "errors": "run1/errors.jsonl"}} ``` `state` is `completed`, `cancelled` or `interrupted`. With `--output-url` or `--error-url`, the summary also carries `written`. The results are uploaded even after a stop, so a stopped batch still returns what it finished. ## Signals and exit codes - `SIGINT` (Ctrl-C) cancels: no new line is sent, in-flight requests get `--drain`. - `SIGTERM` cancels only when the batch at `--status-url` is no longer `validating` or `in_progress`, or answers `401`, `403` or `404` (the batch is gone). Otherwise — including with no `--status-url`, or a status URL that does not answer — the run stops as **interrupted** and exits `75`, so a supervisor resumes it. A Kubernetes Job counts exit `0` as finished and never runs it again; `75` keeps it retrying. Uploads with `--output-url` and `--error-url` are one plain `PUT` each, with the body's length stated and no `Authorization` header (the URL is the credential). An empty result file is not uploaded; `written` says which were: `{"output": true, "errors": false}`. The upload has 10 minutes, even after a stop. A resumed run uploads again and replaces what an earlier attempt wrote. | Code | Meaning | | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `0` | Completed or cancelled. | | `1` | The run or the upload failed. | | `2` | Usage error: no input, both `--input` and `--input-url` (`error: give --input or --input-url, not both`), no `--dir` or no `--base-url`, a bad `--model-map`, or an unreadable `--ca` file. | | `75` | Interrupted; run again on the same `--dir`. | From core v0.4.6, every message starts with `opod:` (not `error:`) and names what is missing (`batch run needs --dir, the work directory it resumes from`). A run in which some lines failed still exits `0` — it completed, as an OpenAI batch does, and a Job would run it again on any other code — but stderr says `N of M line(s) failed — see /errors.jsonl`. A resumed run logs `resuming` with the lines done and the lines left. A `--ready-timeout` that runs out says which it was: `no server answering at … — check --base-url`, `… did not accept the key (401 …) — set OPOD_API_KEY (or OPENAI_API_KEY)`, or the status it answered. --- title: "opod connect, disconnect" description: "Print copy-paste settings that point a coding tool or SDK at your opod leader, and the steps to point it back. Neither command changes any file." url: "https://opod.io/docs/core-cli/connect/" markdown_url: "https://opod.io/docs/core-cli/connect.md" section: "Core CLI" last_updated: "2026-10-30" --- # opod connect, disconnect > Print copy-paste settings that point a coding tool or SDK at your opod leader, and the steps to point it back. Neither command changes any file. ## In short `opod connect CLIENT` prints the settings that point a tool (Cursor, Aider, the OpenAI SDK, `curl` and 11 more) at your leader, with your URL, model and key filled in. `opod disconnect CLIENT` prints how to undo them. Both only print text: they change no file. ```bash opod connect aider --model qwen-coder-14b ``` ```text # Aider → Opod (OpenAI API) aider \ --openai-api-base http://localhost:8080/v1 \ --openai-api-key sk-orc- \ --model openai/qwen-coder-14b … ``` ## Usage ```text opod connect CLIENT [--model ID] [--base-url URL] [--token KEY] [--retries N] opod connect --list opod disconnect CLIENT opod disconnect --list ``` Both commands only **print text** to stdout. They change no shell profile, editor setting or config file, and they call no leader. You copy what they print into the tool. ## opod connect | Flag | Default | Effect | | ---------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--list` | off | List the supported clients and exit. | | `--model ID` | `auto` | The model id written into the snippet. `auto` resolves, on the leader, to its default model (`router.default_model`). | | `--base-url URL` | see below | The opod base URL written into the snippet, without `/v1`. A trailing `/` is removed. | | `--token KEY` | see below | The API key written into the snippet. | | `--retries N` | `0` (off) | Ask the gateway to retry each candidate up to `N` times (`1` to `5`). Only the `curl` snippet carries it, as `-H "X-Opod-Num-Retries: N"`; the other clients have no per-request header setting, so the value is ignored for them. | Flags may come before or after the client name. `connect` takes exactly one client name. From core v0.4.6, a value flag with no value (`opod connect curl --retries`) is a usage error, `--retries needs a value`, where it used to take the client name as its value; and when the key is this leader's admin key (no `--token`, no `OPOD_TOKEN`), stderr says so — `give curl its own key instead: opod token create curl, then --token ` — because the snippet goes into another tool's config file. The base URL is the first of: 1. `--base-url`; 2. `$OPOD_BASE_URL`; 3. `external_url` in `config.yaml`; 4. `http://localhost` followed by `listen` (`http://localhost:8080` by default). The key is the first of: 1. `--token`; 2. `$OPOD_TOKEN`; 3. the admin key in `~/.opod/admin.key`, written by the first `opod up`. > **Do not hand out the admin key** > > With no `--token` and no `$OPOD_TOKEN`, the snippet carries the **admin** key, which can call `/admin/v1/*`. Give each person their own `user` key instead: > > ```bash > opod token create alice > opod connect cursor --token sk-orc- --model qwen-coder-14b > ``` ### Pick a client interactively With no client name, or a name that is not in the list, on an interactive terminal, `connect` opens a picker (arrow keys, Enter to choose, the typed name as the starting filter). With no terminal (a pipe, CI), it prints the help to stderr and exits `2`. ### Example ```bash opod connect aider --model qwen-coder-14b ``` ```text # Aider → Opod (OpenAI API) aider \ --openai-api-base http://localhost:8080/v1 \ --openai-api-key sk-orc- \ --model openai/qwen-coder-14b # Or set permanently in ~/.aider.conf.yml: # openai-api-base: http://localhost:8080/v1 # openai-api-key: sk-orc- # model: openai/qwen-coder-14b ``` ```bash opod connect continue --base-url http://leader.example.com:8080 --model llama-3.2-3b ``` ```text # Continue.dev → Opod (OpenAI API) # Add to ~/.continue/config.json under "models": { "title": "Opod · llama-3.2-3b", "provider": "openai", "model": "llama-3.2-3b", "apiBase": "http://leader.example.com:8080/v1", "apiKey": "sk-orc-" } ``` The `curl` snippet prints two smoke tests: the OpenAI shape (`POST /v1/chat/completions` with `Authorization: Bearer`) and the Anthropic shape (`POST /v1/messages` with `x-api-key` and `anthropic-version: 2023-06-01`). ```bash opod connect curl --retries 3 > smoke.sh && sh smoke.sh ``` ### Errors | Error | Cause | | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | ``opod: no token available — set $OPOD_TOKEN, pass --token , or run `opod up` to create one`` | No `--token`, no `$OPOD_TOKEN` and no `~/.opod/admin.key`. | | `opod: --retries must be between 1 and 5 (got 9)` | `--retries` out of range. | | `opod: connect takes exactly one client name (got: a b)` | Two names. | ## Clients `opod connect --list` prints the same list with a one-line description of each. | Id | Client | Wire | | --------------- | ----------------------------- | -------- | | `cursor` | Cursor | OpenAI | | `aider` | Aider | OpenAI | | `continue` | Continue (VS Code, JetBrains) | both | | `zed` | Zed | OpenAI | | `cline` | Cline / Roo Code | both | | `openclaw` | OpenClaw | OpenAI | | `opencode` | OpenCode | both | | `open-webui` | Open WebUI | OpenAI | | `open-notebook` | Open Notebook | OpenAI | | `goose` | goose | OpenAI | | `plandex` | Plandex | OpenAI | | `openhands` | OpenHands | both | | `codex-cli` | Codex CLI | OpenAI | | `openai-sdk` | OpenAI Python / JS SDK | OpenAI | | `curl` | curl | raw HTTP | "Both" means the client can use the OpenAI shape or the Anthropic Messages shape. Opod serves `/v1/messages` on every chat model, so a tool that speaks Anthropic Messages points at the same base URL. Any other OpenAI-compatible tool works without a snippet: give it the base URL with `/v1` and a key. ```bash export OPENAI_BASE_URL=http://leader.example.com:8080/v1 export OPENAI_API_KEY=sk-orc- ``` ## opod disconnect ```bash opod disconnect aider # the unset commands for the variables connect set opod disconnect cursor # the settings steps to clear the override opod disconnect openai-sdk # remove base_url from code or env opod disconnect --list ``` ```text # Aider takes its base URL from CLI flags or env vars. # Reverse the Opod override: unset OPENAI_API_BASE unset OPENAI_API_KEY # Then run aider with your own vendor key: export OPENAI_API_KEY=sk-... # for OpenAI … ``` `disconnect` takes no flags other than `--list`, and exactly one client name. With no name it prints the help and exits `2`. An unknown name prints ``opod: disconnect: unknown client "x" (try `opod disconnect --list`)``. It never opens a picker. Afterwards the client talks to its vendor again with whatever key you give it. Nothing on the opod side changes: your keys and usage history stay on the leader, and `opod connect` points the client back at any time. --- title: "config, doctor, update, completion, version" description: "Show and locate the effective configuration, diagnose a node, update the binary, install shell completion, and print the version or the leader's feature keys." url: "https://opod.io/docs/core-cli/utilities/" markdown_url: "https://opod.io/docs/core-cli/utilities.md" section: "Core CLI" last_updated: "2026-10-30" --- # config, doctor, update, completion, version > Show and locate the effective configuration, diagnose a node, update the binary, install shell completion, and print the version or the leader's feature keys. ## In short These commands look after the binary and its settings: `config` shows the effective configuration, `doctor` checks the machine, `update` replaces the binary with a release, `completion` prints shell completion, and `version` prints the version and the feature list. ```bash opod config path opod version ``` ```text /home/opod/.opod/config.yaml opod 0.21.0 (linux/amd64, go1.26.4) ``` ## opod config ```text opod config [show [--json] | path | edit] ``` `opod config` with no sub-command is `opod config show`. | Sub-command | Does | | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `show` | The effective configuration. It asks the running leader (`GET /admin/v1/config`). When no leader answers, it prints the configuration this CLI loaded and says so. `--json` for JSON. | | `path` | Print the config file path: `~/.opod/config.yaml`. | | `edit` | Print the command to edit it, `$EDITOR` (else `vi`) and the path, then `(then restart opod for changes to take effect)`. It opens no editor. | ```bash opod config path # /home/opod/.opod/config.yaml opod config edit # Run: vi /home/opod/.opod/config.yaml # (then restart opod for changes to take effect) ``` The configuration is edited in the file or set with `OPOD_*` variables, never through the API, and a change takes effect on the next start. See [Configuration](https://opod.io/docs/core-reference/configuration/). The config file is always `~/.opod/config.yaml` in the home directory of the user that runs the command. `data_dir` (or `OPOD_DATA_DIR`) moves the store, the models and the admin key, but not the config file itself. ### From the running leader The leader returns a fixed view of the main fields, with the vLLM API key redacted: ```bash opod config show ``` ```text auth.require_keys true data_dir /home/opod/.opod engine.llamacpp_endpoint http://127.0.0.1:8089 engine.mlx_endpoint http://127.0.0.1:8080 engine.ollama_endpoint http://127.0.0.1:11434 engine.preferred ollama engine.vllm_api_key engine.vllm_endpoint http://127.0.0.1:8000 external_url listen :8080 log_level info observability.otlp_endpoint observability.otlp_status disabled (set OPOD_OTLP_ENDPOINT to a collector URL) observability.response_cache.DefaultTTLSeconds 0 observability.response_cache.Driver observability.response_cache.Enabled false observability.response_cache.MaxEntries 0 router.default_model llama-3.2-1b router.sticky_sessions true storage.dsn /home/opod/.opod/state.db storage.models_dir /home/opod/.opod/models storage.type sqlite Edit /home/opod/.opod/config.yaml or set OPOD_* env vars, then restart opod. ``` Keys are dotted and sorted. On 0.2.1 the response-cache block keeps its Go field names (`Enabled`, `Driver`, …), the edit hint names `/config.yaml`, and `--json` carries an empty `egress` object. From 0.3.0 the block reads `enabled`, `driver`, `max_entries`, `default_ttl_seconds`, the hint names the file `opod config path` prints, and `egress` is gone. `--json` prints the leader's object as is, with `edit_hint`. The view does not list every field: the full list is on [Configuration](https://opod.io/docs/core-reference/configuration/). ### With no leader It prints `(leader not reachable; showing config loaded by this CLI — secrets redacted)` on stderr, then the configuration the CLI loaded. In 0.3.0 that is the same redacted view the leader serves, in the same two forms: dotted, sorted keys, or the object as is with `--json`. Neither token is in it, and a database DSN's password reads `redacted` (on 0.2.1 the leader's view printed the DSN in clear too). > **Up to and including 0.2.1, the local fallback is not redacted** > > Despite the notice, the 0.2.1 fallback prints the whole configuration struct, with Go field names as keys, and `Auth.AdminToken` and `Auth.JoinToken` in clear when `config.yaml` or `OPOD_ADMIN_TOKEN` / `OPOD_JOIN_TOKEN` set them. Do not paste that output anywhere. A leader that answers with an error is final: `opod: config show: …`. ## opod doctor ```text opod doctor ``` Runs every check, prints a line for each, and a fix for each failure. It changes nothing. It always exits `0`: read the `⚠` lines. | # | Check | Pass | Fail and fix | | - | ---------------------------------------------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 1 | Hardware | `✔ hardware: linux/amd64 · 16 cores · 64 GB RAM`, then `✔ GPU: ( GB)` per GPU. | — | | 2 | The listen port is free | `✔ listen port :8080 available` | `⚠ listen port :8080 already in use`. A running leader holds it, which is normal. | | 3 | `ollama` on `PATH` | `✔ ollama binary at …` | `⚠ ollama not found in PATH — install: brew install ollama`. Needed only for the Ollama engine. | | 4 | `rpc-server` and `llama-server` on `PATH` | `✔ llama.cpp binaries present — …` | A note when both are missing (needed only for gangs and `engine.preferred: llamacpp`), or which one is missing and how to get it (`rpc-server` is not in the Homebrew bottle; build llama.cpp with `-DGGML_RPC=ON`). | | 5 | The configured engine answers within 2 seconds | `✔ ollama engine healthy at http://127.0.0.1:11434` | `⚠ … engine not reachable: …`, then the command that starts that engine. | | 6 | The data directory exists | `✔ data dir: …` | `⚠ data dir missing: …` | | 7 | The catalog loads | `✔ catalog: 48 entries`, plus the signature policy when `OPOD_CATALOG_PUBKEY` is set | A signature refusal names the file and says `sign the file (minisign -S -m ), remove it, or review OPOD_CATALOG_PUBKEY / OPOD_CATALOG_REQUIRE_SIGNED`. Any other error points at `OPOD_CATALOG_DIR`. | The signature policy reads ` (directory files: minisign signature verified when present)`, or ` (directory files: minisign signature required)` with `OPOD_CATALOG_REQUIRE_SIGNED=1`. From core v0.4.6, `opod doctor [--json]` reports every check as a row — `✔` ok, `✖` a problem with its fix on the next line, `▶` a note — and ends with `all checks passed` (exit `0`) or `N problem(s) found — each says its fix above` (exit `1`). Before, it always exited `0`. It also checks: | Check | Ok | Problem or note | | --------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | The config file | `✔ config: ~/.opod/config.yaml` | a file that does not parse is a problem (the other checks use the defaults); no file is a note: `opod up writes one on its first run` | | A leader on this host | `✔ leader: answering at http://localhost:8080` | a note: `start one with opod up — on a worker host this is expected` | | The listen port | `✔ listen port: :8080 is this host's opod leader (pid N)`, or `… is free` | a problem only when another program holds it: `stop it, or set listen: … or OPOD_LISTEN` | | The admin key | `✔ admin key: ~/.opod/admin.key` | a problem when a leader answers and there is no key here; else a note | | The engine | `✔ engine: ollama healthy at …` | an unknown engine name is a problem with the valid names (the report goes on; before, it stopped there) | On a managed leader's host (`OPOD_MANAGED=1`), from core v0.4.6: the admin key row is ok with `the leader's admin token (OPOD_ADMIN_TOKEN or auth.admin_token)` when the leader was started with one, the engine row is a note (`a managed leader (OPOD_MANAGED=1) runs no engine itself — its workers do`, then `opod node ls lists them …`), and the leader row finds a leader that serves TLS with a certificate for its service name. Up to core v0.4.5 such a host read `no leader answering`, `:8080 is in use by another program` and a missing admin key, all three false. Install hints follow the OS (`brew install …` on macOS, the project's installer or release on Linux), and a missing data directory says `opod up creates it, or: mkdir -p `. `--json` prints `{"checks": [{name, state, detail, fix}], "problems": N}`. > **A listen address with a host** > > The port check expects `listen` in the form `:PORT`. A `listen` with a host, such as `127.0.0.1:8080`, is reported as in use even when it is free. From core v0.4.0 a host:port is checked as it is. From core v0.4.6, `opod config path` prints the path alone on stdout and, when the file does not exist yet, `(not created yet — the defaults are in use; opod up writes it on its first run)` on stderr; `config edit` says the editor will create it; and `config show` without a leader names why it shows this CLI's own config (`no admin key at …` or `no leader answering at …`). `opod doctor` flags an engine endpoint on the leader's own port (MLX-LM's server also defaults to 8080). Shell completion offers `cache kv-prune`, and completing installed models no longer creates `state.db`. ## opod update ```text opod update [--check] [--version vX.Y.Z] [--force] [--yes] opod upgrade ``` `upgrade` is the same command. | Flag | Default | Effect | | ------------------ | ---------- | ------------------------------------------------- | | `--check` | off | Report whether an update exists. Install nothing. | | `--version vX.Y.Z` | the latest | Install that version instead of the latest. | | `--force` | off | Install even when already on that version. | What it does: 1. Unless `--version` names one, it asks GitHub for the latest release of `opod-io/opod-core` (`https://api.github.com/repos/opod-io/opod-core/releases/latest`). 2. When the binary is already on that version, it says `✔ already on the latest version (…)` and stops, unless `--force`. With `--check` it prints `update available: vA → vB` and stops. 3. Downloads `opod--.tar.gz` from the release. 4. Downloads the release's `checksums.txt` and checks the archive's SHA-256: `checksum verified (sha256)`. A `checksums.txt` that does not list the archive refuses the install. Up to and including 0.2.1, a release with **no** `checksums.txt` installs **unverified**, with the note `checksums.txt not available for … — skipping verification`. From 0.3.0 it refuses: `checksums.txt for … could not be read … refusing to install a binary nobody can verify`, and the installed binary stays as it was. Every published release ships `checksums.txt`. 5. Replaces the running binary, following symlinks, in place. When the install path is not writable, it prints the exact `sudo install -m 0755 …` command to finish. Then it prints `✔ installed vX.Y.Z at /usr/local/bin/opod` and reminds you to restart a running leader: `opod down` then `opod up`. A worker is restarted the same way it was started. Opod never checks for updates by itself. From core v0.4.6: | Case | What it does | | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | the release is newer | `--check` prints `update available: vA → vB — install it with: opod update` and **exits `10`** (no update: `0`); without `--check` it asks `Replace … with vB? (y/N)` first, or takes `--yes`; with no terminal and no `--yes` it refuses and prints the exact command with `--yes` | | the release is older than this build | refused: `vB is older than this build (vA) — to downgrade on purpose: opod update --version vB --force`. Versions are compared as numbers; before, they were compared as text, and a build reading `0.21.0-dev` took `v0.4.5` as an update and installed it | | this is a development build (a `-dev` version, or a commit name from an image build) | `this is a development build (…); the latest release is vB`; it replaces itself only with `--force` or a named `--version` | | GitHub refuses the call | its message, not the raw JSON; a rate limit says when to try again and that `--version vX.Y.Z` goes around it | A build made without release flags now reads `0.0.0-dev`. ## opod completion ```text opod completion bash | zsh | fish ``` ```bash source <(opod completion bash) # in ~/.bashrc source <(opod completion zsh) # in ~/.zshrc opod completion fish | source ``` The scripts complete the commands and sub-commands, catalog ids after `model add` and `model info`, installed ids after `model load`, `unload` and `remove`, and client names after `connect`. They ask the binary for those lists at completion time, through the hidden helpers `opod completion __models`, `__installed` and `__clients`. With no shell named, it prints the help. ## opod version ```text opod version [--features] opod --version opod -v ``` Prints the version, OS, architecture and Go version: ```text opod 0.21.0 (linux/amd64, go1.26.4) ``` A development build reads `0.21.0-dev`; a release build has its version stamped at link time. `--features` prints the leader's feature keys, comma-separated and sorted, on one line — the same list `GET /admin/v1/capabilities` advertises. It reads the binary, not a running leader. The leader image carries this list in its OCI label `io.opod.leader.features`, so a manager can tell what a leader speaks from the image alone. See [Admin API](https://opod.io/docs/core-reference/admin-api/#capabilities). ```bash opod version --features | tr , '\n' | grep kv_ ```