---
title: "Models"
description: "The model catalog, adding your own models, versions with approval and licence, prefetch, the Hugging Face token, LoRA adapters and the node cache."
url: "https://opod.io/docs/control-plane-endpoints/models/"
markdown_url: "https://opod.io/docs/control-plane-endpoints/models.md"
section: "Endpoints"
last_updated: "2026-10-30"
---

# Models

> The model catalog, adding your own models, versions with approval and licence, prefetch, the Hugging Face token, LoRA adapters and the node cache.

An endpoint serves exactly one model from the control plane's **model registry**: the bundled catalog plus models you add. The catalog records each model's repo, files, formats, recommended engines, size and architecture, which the planner uses to size it.

## In short

Before an endpoint can serve a model, the control plane must know it: its Hugging Face repo, its file format and its size, which the planner uses to place it. The bundled catalog already knows many models. You add your own by repo. A **version** pins exact bytes of a model, so a plan can say "run v2" and roll back to "v1" later.

## When you need it

- The model you want is not in the catalog.
- The repo is gated (Llama, Gemma): set the cluster's Hugging Face token once.
- You want to warm a node's cache before a create, so the first start is fast.
- You fine-tuned a model and want to promote and roll back by name.
- Your security team must approve a model before it runs (0.3.0).
- You serve LoRA adapters on vLLM.

## Do it

1. **Check the repo**

   ```bash
   curl -s -H "$H" "https://cp.example.com/api/v1/models/validate?repo=acme/my-model-GGUF&file=my-model-q4_k_m.gguf"
   # {"ok":true,"repo":"acme/my-model-GGUF","sizeGb":4,"files":[…],"gguf":true,"engine":"llamacpp","format":"gguf"}
   ```

2. **Set the Hugging Face token, if the repo is gated**

   ```bash
   curl -s -H "$H" -H 'Content-Type: application/json' -X PUT \
     https://cp.example.com/api/v1/settings/hub-token -d '{"token":"hf_<your token>"}'
   ```

3. **Add the model**

   ```bash
   curl -s -H "$H" -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/models \
     -d '{"id":"my-model-q4","repo":"acme/my-model-GGUF","file":"my-model-q4_k_m.gguf","format":"gguf","engine":"llamacpp"}'
   ```

   The answer is `201` with the model record, `origin: user`.

4. **Warm a node, optionally**

   ```bash
   curl -s -H "$H" -X POST "https://cp.example.com/api/v1/models/my-model-q4/prefetch?node=node-a" | jq '{state, job}'
   ```

5. **Use it in a plan**

   Name it in `model` and `plan.model.id` of a create body ([Create](https://opod.io/docs/control-plane-endpoints/create/)).

## Check it worked

```bash
curl -s -H "$H" https://cp.example.com/api/v1/models | jq '.[] | select(.id=="my-model-q4") | {id, status, sizeGb, origin}'
curl -s -H "$H" "https://cp.example.com/api/v1/models/my-model-q4/prefetch?node=node-a" | jq .state
```

A good answer: `status` is `ready`, and the prefetch `state` is `cached` or `succeeded`. In the console the **Models** page lists the model, and the machine page lists the cached file.

## If it fails

| Symptom or code                          | Cause                                                                | Fix                                                 |
| ---------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------- |
| `validate` answers `{"ok": false, …}`    | the repo or file name is wrong, or the repo is gated                 | fix the name; set the Hub token                     |
| `400` on `PUT …/hub-token`               | the value does not start with `hf_`                                  | paste a Hugging Face token                          |
| `E-HUB-TOKEN-MISSING`                    | gated repo and no token in the cluster                               | set a token with read access                        |
| `E-HUB-TOKEN-REFUSED`                    | the token is mistyped, expired or revoked                            | set a current token                                 |
| `E-HUB-ACCESS-DENIED`                    | the token's account may not read the repo                            | accept the model's terms on the Hub as that account |
| Prefetch answers `400`                   | the model is not GGUF, the node is unknown, or the cache has no room | a GGUF model, a known node, or prune the cache      |
| `E-MODEL-IN-USE` on delete               | an endpoint still names the model                                    | delete or change that endpoint first                |
| `E-MODEL-UNAPPROVED` (0.3.0)             | approval is required and the version is not approved                 | an admin approves it                                |
| `E-VERSION-IN-USE`, `E-VERSION-ARCHIVED` | archive of a pinned version, or a pin to an archived one             | unpin first; pin a live version                     |

## Browse and add

```bash
curl -s -H "$H" https://cp.example.com/api/v1/models | jq '.[] | {id, format, engines, sizeGb, origin}'
curl -s -H "$H" "https://cp.example.com/api/v1/models/validate?repo=acme/my-model-GGUF&file=my-model-q4_k_m.gguf"
curl -s -H "$H" -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/models \
  -d '{"id":"my-model-q4","repo":"acme/my-model-GGUF","file":"my-model-q4_k_m.gguf","format":"gguf","engine":"llamacpp"}'
```

`validate` probes the Hub (your mirror, when `OPODCP_HUB_ENDPOINT` is set, from the release after 0.3.6). It answers `{"ok": true, "repo", "sizeGb", "files", "gguf", "engine", "format"}`, where `engine` and `format` are its guess (`llamacpp` and `gguf` when the repo holds GGUF files, else `vllm` and `safetensors`), or `{"ok": false, "error": "…"}`.

| Add-model field    | Default                                                 | Meaning                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------ | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id`               | from the repo's last part                               | a slug: `a-z`, `0-9`, `.`, `_`, `-`, 2 to 63 characters                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `repo`             | —                                                       | the Hugging Face repo; required for `source: hf`                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `file`             | the repo's `Q4_K_M` GGUF file, else its first GGUF file | the GGUF file inside the repo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `source`           | `hf`                                                    | where the weights come from                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `engine`, `format` | read from the Hub                                       | `llamacpp` and `gguf` for a GGUF repo, else `vllm` and `safetensors`                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `sizeGb`           | read from the Hub                                       | the weights' size in GB, which the planner and the ledger size every worker by. A GGUF model is the size of its `file`. From the release after 0.3.6, a safetensors repo is the sum of its top-level `*.safetensors` files (a `consolidated*` copy is skipped when shard files are there too), read whatever `engine` and `format` you name, and from your Hub mirror (`OPODCP_HUB_ENDPOINT`) when one is set; before it, a safetensors repo registered with no size, so pass `sizeGb` yourself. A size you pass is kept |
| `name`             | the id                                                  | a display name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `protocol`         | `chat`                                                  | `chat`, `embeddings` or `rerank`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `tools`            | `false`                                                 | the model can call tools; a door auto route sends a request with `tools` only to such models. New in 0.3.0                                                                                                                                                                                                                                                                                                                                                                                                               |

A model you add reads `origin: user`; a catalog model reads `origin: catalog`. A model record also carries `engines` (the catalog's recommended engines, best first), `sizeGb`, `contextWindow`, `vramHintGb`, `minRamGb` (host memory, an advisory only), `license`, `shardable`, `architecture` (`params`, `layers`, `heads`, `kvHeads`, `experts` and more; unknown fields warn and never refuse) and `status` (`ready`, `validating`, `error`). Adding a model answers `201` and needs the operator role; deleting one needs admin and is refused `E-MODEL-IN-USE` while an endpoint names it. The console's **Models** page does the same.

## Gated models: the Hugging Face token

A gated repository (Llama, Gemma) needs a token. There is **one token per cluster**:

```bash
curl -s -H "$H" -H 'Content-Type: application/json' -X PUT \
  https://cp.example.com/api/v1/settings/hub-token -d '{"token":"<your hf token>"}'
```

Setting it needs admin. The control plane writes it into Secret `opodcp-hub` (`opod-hub` on `0.3.0`) and nowhere else: never its own store, an event or a log. No route returns it; `GET` answers only whether it is set. A value that does not start with `hf_` is refused. Workers and prefetch Jobs receive it as `HF_TOKEN` and `HUGGING_FACE_HUB_TOKEN`. In the console: **Settings → Hugging Face token**.

A fetch the Hub refuses fails the rollout's prefetch step with a code:

| Code                  | Cause                                                                                  | Fix                                                 |
| --------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------- |
| `E-HUB-TOKEN-MISSING` | the repository is gated or private and the cluster has no token (or the name is wrong) | set a token with read access                        |
| `E-HUB-TOKEN-REFUSED` | the Hub answers the token `401`: mistyped, expired, revoked                            | set a current token                                 |
| `E-HUB-ACCESS-DENIED` | the token is valid and its account may not read the repository                         | accept the model's terms on the Hub as that account |

## Prefetch

A rollout's prefetch step pulls the plan's weights once into each target node's cache (`/data/models`), and from the release after 0.3.6 a speculative draft model's weights too. You can also warm a GGUF model onto a node ahead of any endpoint (operator):

```bash
curl -s -H "$H" -X POST "https://cp.example.com/api/v1/models/<id>/prefetch?node=node-a"
curl -s -H "$H" "https://cp.example.com/api/v1/models/<id>/prefetch?node=node-a"
```

The `POST` answers at once: `200` when the node's cache already lists the file, `202` when it started a pull or one was already running. Both answer `{ model, node, file, state, job, detail }`. `state` is `cached`, `started`, `running`, `succeeded`, `failed` or `none`. A model that is not GGUF, an unknown node, a cache with no room or no image is `400` with the reason. The `GET` needs `?node=`.

A vLLM worker pulls its own snapshot at launch. Weights are fetched atomically, and the cache prune never removes a file it did not fetch.

## Versions

A **version** is a pinned revision of one catalog id, never a second model.

```bash
opodcp model versions qwen2.5-7b
curl -s -H "$H" -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/models/qwen2.5-7b/versions \
  -d '{"version":"v2","revision":"<commit sha>","licence":"Apache-2.0","note":"fine-tune 2026-10"}'
curl -s -H "$H" -H 'Content-Type: application/json' -X POST \
  https://cp.example.com/api/v1/models/qwen2.5-7b/versions/v2/promote -d '{"state":"prod"}'
curl -s -H "$H" -X POST https://cp.example.com/api/v1/models/qwen2.5-7b/versions/v2/archive
```

| Version field                                  | Meaning                                                                                                                 |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `version`                                      | the name; never reused for other bytes                                                                                  |
| `revision`, `sha256`                           | the Hub commit and the file digest; a version needs at least one                                                        |
| `sizeBytes`, `origin`, `lineage`               | the size, where it came from (a repo, a training job, an import) and the version it was derived from                    |
| `state`                                        | `draft` (default), `staging`, `prod` or `archived`                                                                      |
| `evals`                                        | measured scores by suite name, written by a rollout's eval step                                                         |
| `note`, `createdBy`, `createdAt`, `promotedAt` | —                                                                                                                       |
| `licence`                                      | an SPDX expression (`Apache-2.0`, `MIT OR Apache-2.0`, `LicenseRef-…`); its shape is checked. New in 0.3.0              |
| `approval`                                     | `by`, `at`, `note` once an admin approved it. New in 0.3.0                                                              |
| `signature`                                    | the last signature check: `state`, `reason`, `file`, `detail`, `identity`, `commit`, `root`, `node`, `at`. New in 0.3.0 |

- Registering and promoting a version needs the operator role.
- A state is a label and routes nothing: a plan pins a version with `model.version`, resolved to `revision` and `sha256` when the plan is stored.
- Archiving is refused `E-VERSION-IN-USE` while an endpoint pins the version. No weight file is deleted. Pinning an archived version is refused `E-VERSION-ARCHIVED`.
- `opodcp model` is new in 0.3.0.

**Roll a model back.** `POST /api/v1/models/{id}/versions/{v}/rollback` starts one verified rollout per endpoint that pins a version registered after `v`. `GET …/rollback/preview` answers the same and starts nothing. A team-scoped operator rolls back only their team's endpoints; `otherTeams` counts the others. Rolling back to a version that does not exist is `E-VERSION-UNKNOWN`, and to an archived one `E-VERSION-ARCHIVED`.

## Approval

Approval is new in 0.3.0. An admin approves a version for deployment. The operator who registers and pins a version is not the one who says it may run.

```bash
opodcp model approve --note 'eval 0.82, licence reviewed' qwen2.5-7b v2
opodcp model revoke qwen2.5-7b v2      # clears the approval (0.3.6); the release after 0.3.6: opodcp model unapprove qwen2.5-7b v2
opodcp model approval on          # models.requireApproval
```

| Route                                             | Purpose                                    |
| ------------------------------------------------- | ------------------------------------------ |
| `POST /api/v1/models/{id}/versions/{v}/approve`   | approve, with an optional `note` (admin)   |
| `DELETE /api/v1/models/{id}/versions/{v}/approve` | revoke the approval (admin)                |
| `GET`, `PUT /api/v1/settings/model-approval`      | `{"requireApproval": true}` (admin to set) |

With `requireApproval` on (default off), a **new** pin must be an approved version: a create, preview or plan edit that pins an unapproved version, or no version at all, is refused `E-MODEL-UNAPPROVED`. A plan that keeps the pin its endpoint already runs passes, so turning the setting on never stops a running endpoint. Remote endpoints are never judged.

## Signatures

Signature checks are new in 0.3.0. Each prefetch checks whether the repository publishes a model signature (`model.sig`, OpenSSF model signing) and verifies it with the same Sigstore trust root images use. The signer is matched against `images.trust`, where a model's key is `hf.co/<org>/<repo>`:

```yaml
images:
  trust:
    - repositoryPrefix: hf.co/acme/
      issuer: https://token.actions.githubusercontent.com
      identityRegex: ^https://github\.com/acme/models/\.github/workflows/.+$
```

| Result       | Meaning                                                                         | Effect                                                |
| ------------ | ------------------------------------------------------------------------------- | ----------------------------------------------------- |
| `verified`   | the signature verifies, a trust entry allows its signer, and every file matches | none                                                  |
| `invalid`    | bad signature, untrusted signer, or a file that does not match                  | **the rollout holds** for an admin's accept or reject |
| `unverified` | signed, and no trust entry covers the repository                                | recorded                                              |
| `unsigned`   | no signature published                                                          | recorded                                              |
| `unknown`    | the Hub could not be asked                                                      | recorded                                              |

Only `invalid` holds. See [Rollouts](https://opod.io/docs/control-plane-endpoints/rollouts/) for accept and reject. With `weights.skipSourceCheck` (air-gapped), no signature is checked.

## LoRA adapters

**Proven** on vLLM with an NVIDIA card (2026-11-06): one worker with two adapters answered under three names (the base, `:python`, `:fin`) with three different answers, and held one card. Not proven on vLLM with AMD.

`plan.adapters[]` serves LoRA variants of the one model identity on vLLM, each as `<model>:<name>`:

```yaml
adapters:
  - { name: support, source: acme/qwen-support-lora, rank: 16 }
```

Names are lower-case letters, digits, `.`, `_` and `-` (at most 64), unique, and at most 16 per endpoint. `source` is a Hugging Face repo or a path under the node cache, and is required. `rank` is the adapter's own r, 0 or more: the workers size vLLM's LoRA slots from the largest rank in the set. A remote endpoint takes no adapters. A changed set in the plan rolls the pods. To add or remove one **live**, with no pod roll (operator):

```bash
curl -s -H "$H" -H 'Content-Type: application/json' -X POST https://cp.example.com/api/v1/endpoints/<id>/adapters \
  -d '{"name":"support","source":"acme/qwen-support-lora","rank":16}'
curl -s -H "$H" -X DELETE https://cp.example.com/api/v1/endpoints/<id>/adapters/support
```

A live adapter whose rank exceeds the rank the running engines were started for is refused `E-LORA-RANK`. A non-vLLM engine is `E-NO-ENGINE`. Adding a name the endpoint already serves is refused: drop it first to change its source or rank. Dropping a name it does not serve is `400`. A live change is a plan revision with cause `adapters`.

## The node cache

Each node keeps weights under `/data/models`. `GET /api/v1/nodes/{name}/cache?minAge=24h` (admin) previews what a prune would remove: it keeps the file of every plan with a worker there (parked ones included), every file a prefetch is pulling now, and every model with a version in `staging` or `prod`. `POST …/cache/prune` removes the rest; the default minimum age of 24 hours keeps a recent rollback's weights warm. With cache management off (`cache.gc.mode=off`), a prune is refused `E-CACHE-GC-OFF`. The console's machine page lists each cached file with the endpoints that reference it.

## Tenstorrent workers

tt-metal's vLLM reads its model from a vendor **model spec**. A worker on a Tenstorrent node names a ConfigMap (item `spec.json`) in `workers[].modelSpec`; generate the spec once per model and device with Tenstorrent's `tt-inference-server`. Weights sit on the node under the model cache and are not prefetched. Refusals: `E-TT-SPEC` (no spec on a Tenstorrent node, or a spec on any other), `E-TT-WEIGHTS` (no node holds the weights at the directory the spec names), `E-TT-HUGEPAGES` (1 GiB huge pages per chip), `E-TT-GANG` (Tenstorrent gangs are not placed).
