---
title: "Models"
description: "Find, install, load, unload, pin and remove models, add your own entries, serve LoRA adapters, and reclaim cache space."
url: "https://opod.io/docs/core/models/"
markdown_url: "https://opod.io/docs/core/models.md"
section: "Core"
last_updated: "2026-10-30"
---

# Models

> Find, install, load, unload, pin and remove models, add your own entries, serve LoRA adapters, and reclaim cache space.

## In short

A model goes through three states: in the catalog, installed (weights on disk) and resident (in engine memory). `opod model add` installs it, `opod model load` makes it resident now, and `opod model remove` deletes it. On a cluster, `--node` installs it on named workers instead of the leader.

1. **Find the model**

   ```bash
   opod model search coder
   ```

2. **Install it**

   ```bash
   opod model add qwen-coder-7b                     # on the leader's own engine
   opod model add qwen-coder-7b --node n_abc123     # or on a worker
   ```

3. **Load it into memory (optional)**

   A model loads on its first request anyway. Load it now to skip the cold start:

   ```bash
   opod model load qwen-coder-7b
   ```

4. **Send it a request**

   ```bash
   curl http://localhost:8080/v1/chat/completions \
     -H "Authorization: Bearer sk-orc-<your-admin-key>" -H "Content-Type: application/json" \
     -d '{"model":"qwen-coder-7b","messages":[{"role":"user","content":"hi"}]}'
   ```

## Find a model

```bash
opod model search                 # the whole catalog
opod model search coder           # by text
opod model search vision          # by capability
opod model search --sort=released # newest first
opod model search --since 2026-01-01
opod model info qwen-coder-14b    # one entry in full
opod catalog ls                   # catalog ids only, one per line
```

`--json` works on `search`, `info`, `ls` and `ps`.

## Install a model

There are four ways to name a model:

| Form                                  | Example                                                                                   | Hardware check |
| ------------------------------------- | ----------------------------------------------------------------------------------------- | -------------- |
| catalog id                            | `opod model add qwen3.6-27b`                                                              | yes            |
| scheme prefix                         | `opod model add hf:bartowski/Phi-3-mini-GGUF`, `ollama:phi3:mini`, `file:/models/my.gguf` | no             |
| your own catalog file                 | `opod model add --file ./my-model.yaml` (`--from` up to core v0.4.5)                      | yes            |
| a file you drop in `~/.opod/catalog/` | `opod model add my-model`                                                                 | yes            |

`--from` copies the file into `~/.opod/catalog/`, so the entry persists and appears in `search` and `info`.

What `model add` does:

1. Checks the entry's `hardware.min_ram_gb` and `min_vram_gb` against this machine. It refuses when the floor is higher; `--force` overrides.
2. Sends a HEAD request (5 s) to the upstream — the Ollama registry or Hugging Face — and refuses on a `404`. A network problem only warns. `OPOD_SKIP_SOURCE_CHECK=1` skips the check for air-gapped mirrors:

   ```bash
   OPOD_SKIP_SOURCE_CHECK=1 opod model add llama-3.2-3b
   ```
3. Records the model and pulls the weights into the engine.
4. For an entry with `sharding.required: true`, hands off to `opod shard create`.

`--dry-run` prints the download size, RAM, engine and the source check, and pulls nothing.

### Install on specific workers

```bash
opod model add llama-3.2-3b --node n_abc123
opod model add llama-3.2-3b --nodes n_abc123,n_def456
```

The leader tells each worker to pull and load the model. The model is placed once the worker's heartbeat reports it. On a worker whose engine serves one model per process (vLLM, SGLang, llama.cpp, TensorRT-LLM), loading another model stops the current one, so the command refuses and names both models; `--force` replaces it. `--dry-run` does not work with `--node`.

Without `--node`, `model add` installs to the leader's own engine.

## Memory lifecycle

Installed is not the same as resident. A model on disk loads into engine memory on its first request. These commands control what is in memory now, on the leader's engine:

```bash
opod model ps                          # resident models and free memory
opod model load qwen-coder-14b         # load now; refuse if it does not fit
opod model load qwen-coder-14b --swap  # evict least-recently-used models to make room
opod model load nomic-embed-text --pin # never evicted, no idle unload
opod model load qwen3-14b --priority 3 # restore order on the next start
opod model unload qwen-coder-14b       # drain, then release memory; weights stay
```

- **Admission.** A model's footprint is its weights plus about 20 %. The budget is total RAM minus a reserve (`placement.reserve_percent`, default 20).
- **Swap.** `--swap` evicts only as many models as needed, least-recently-used first, never pinned ones. Each victim is drained (router stops sending to it; requests finish within `placement.drain_timeout_seconds`, default 30), unloaded and recorded as `model_evicted`.
- **Restore.** Loaded and pinned models are remembered and restored in priority order on the next `opod up`.
- **Exclusive.** `opod up --exclusive`, `placement.exclusive: true` or `OPOD_EXCLUSIVE=1` keeps one resident model per machine: every load evicts all other non-pinned models. For example `OPOD_EXCLUSIVE=1 opod up`.
- **Unload** clears the model from the remembered set, so it stays unloaded after a restart.
- **Shutdown.** `opod down` unloads by default. Ctrl-C on `opod up` keeps models warm; `--unload-on-exit` changes that.

Live residency comes from Ollama. Engines without an unload call (vLLM, MLX-LM) are skipped; processes that opod launched are stopped at shutdown.

The API returns `409` with `type: needs_swap` when `--swap` would make room, `409 blocked_by_pinned` when pinned models hold the memory, and `422 impossible` when the model is larger than the empty budget.

## Remove a model

```bash
opod model remove qwen-coder-14b        # prompts; weights are deleted
opod model remove qwen-coder-14b --yes
```

`rm` is an alias. With no id, or an id that is not installed, `add`, `info`, `remove`, `load` and `unload` open an interactive picker.

## Pin a model version

For Hugging Face weights, `OPOD_MODEL_REVISION` pins a commit sha, tag or branch, and `OPOD_MODEL_SHA256` names the digest the file must have. A pinned revision is cached under `<repo>@<rev>`, so two revisions coexist. Without a pin the revision is `main`, which moves. Set them on the process that pulls, usually the worker:

```bash
OPOD_LOAD_MODEL=llama-3.2-3b \
  OPOD_MODEL_REVISION=0cb88a4f764b7a12671c53f0838cd831a0843b95 \
  OPOD_MODEL_SHA256=<64 hex characters> \
  opod join "http://leader:8080?token=sk-orc-<node-token>"
```

## Signed catalog files

A catalog file decides which weights get pulled. You can sign your own files with [minisign](https://jedisct1.github.io/minisign/):

```bash
minisign -S -m my-model.yaml          # writes my-model.yaml.minisig
export OPOD_CATALOG_PUBKEY=~/.minisign/minisign.pub
export OPOD_CATALOG_REQUIRE_SIGNED=1  # refuse unsigned files too
```

- With `OPOD_CATALOG_PUBKEY` set, a file that has a `.minisig` beside it must verify. A bad signature is always refused, and the error names the file.
- Unsigned files still load unless `OPOD_CATALOG_REQUIRE_SIGNED=1`.
- The check applies to every catalog directory and to `model add --file` (`--from` up to core v0.4.5).
- The embedded catalog is never checked.

## LoRA adapters

vLLM workers serve LoRA adapters as `<model>:<adapter>`.

- At start: set `OPOD_ADAPTERS` on the worker to a JSON list:

  ```bash
  OPOD_ENGINE=vllm OPOD_ADAPTERS='[{"name":"sql","source":"org/sql-lora","rank":16}]' \
    opod join "http://leader:8080?token=sk-orc-<node-token>"
  ```

  A request then names `"model": "<base model>:sql"`.
- At runtime, on a leader with a [plan file](https://opod.io/docs/core-reference/plan-file/): `POST /admin/v1/adapters` with `{"name","source","rank"}` loads one on every worker that holds the plan's model; `DELETE /admin/v1/adapters/{name}` drops it. A leader with no plan file answers `409` (it has no single model to attach the adapter to):

  ```bash
  curl -s -X POST http://localhost:8080/admin/v1/adapters -H "Authorization: Bearer $ADMIN" \
    -H 'Content-Type: application/json' -d '{"name":"sql","source":"org/sql-lora","rank":16}'
  curl -s -X DELETE http://localhost:8080/admin/v1/adapters/sql -H "Authorization: Bearer $ADMIN"
  ```

vLLM fixes its LoRA slots when it starts (`--enable-lora`, `--max-lora-rank`). A worker started with no adapters, or asked for a `rank` above its start value, answers `409` with both numbers. Restart that worker with the adapter in `OPOD_ADAPTERS`. A move does not carry adapters.

There is no CLI command for adapters.

## Weights on disk

Weights live in the models directory: `storage.models_dir`, default `~/.opod/models`. Every worker on a node shares it.

- [`opod fetch`](https://opod.io/docs/core-cli/fetch/) makes one GGUF, or a safetensors snapshot, present in a directory. It takes a per-file lock, writes to a temporary file and renames it only when complete and verified.
- [`opod cache`](https://opod.io/docs/core-cli/cache/) lists the cache and removes what no plan references. It only ever deletes files opod fetched, and is a dry run unless you pass `--apply`.

## Container images for a model

`opod image recommend <model> --vendor nvidia` names the worker image that serves a catalog model on that accelerator. See [`opod image`](https://opod.io/docs/core-cli/image/).

## Check it worked

```bash
opod model ls     # installed: STATUS ready
opod model ps     # resident in the leader's engine (Ollama only)
curl -s http://localhost:8080/v1/models -H "Authorization: Bearer sk-orc-<your-admin-key>"
```

A model is served when `GET /v1/models` lists it. A model placed with `--node` appears there once the worker's next heartbeat reports it loaded.

## If it fails

| Symptom                                                                | Fix                                                                                                               |
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `opod: model … needs at least N GB RAM; this machine has M GB`         | Pick a smaller model, or pass `--force` if you know it fits.                                                      |
| `opod: source for … does not exist: …`                                 | The upstream repo or tag is gone. Check the catalog entry's `source`, or use a scheme id such as `hf:owner/repo`. |
| `opod: source type "ollama" in … is not compatible with engine vllm …` | Use an entry whose source suits the engine, or switch engines.                                                    |
| `409` `needs_swap` from `model load`                                   | Run it again with `--swap` to accept the evictions.                                                               |
| `409` `blocked_by_pinned`                                              | Pinned models hold the memory. Unload or unpin one.                                                               |
| `422` `impossible`                                                     | The model is larger than the empty budget. Use a smaller quantization or another machine.                         |
| `--node` refuses and names two models                                  | The worker's one-model engine already serves another model. Add `--force` to replace it on purpose.               |
| A catalog file is refused with a signature error                       | Sign it again with `minisign -S -m FILE`, or check `OPOD_CATALOG_PUBKEY`.                                         |
