---
title: "Concepts"
description: "The terms opod core uses — leader, worker, engine, placement, gang, front door, cell door, keys and the watched files."
url: "https://opod.io/docs/core/concepts/"
markdown_url: "https://opod.io/docs/core/concepts.md"
section: "Core"
last_updated: "2026-11-01"
---

# Concepts

> The terms opod core uses — leader, worker, engine, placement, gang, front door, cell door, keys and the watched files.

## In short

A **leader** is the one URL clients call; **workers** run the engines that hold the models and report what they hold every 5 seconds. The router sends each request to a worker whose engine has the model loaded. A model too big for one machine runs as a **gang** across several. This page defines each term the other pages use.

## Leader

The **leader** is the process `opod up` starts. It is the one URL clients call. It holds:

- the **gateway**: the OpenAI-compatible `/v1` routes and their key check;
- the **router**: which worker serves each request;
- the **store**: a SQLite database (`~/.opod/state.db`) with nodes, models, placements, keys, usage rows and events (from core v0.4.0 it keeps no usage rows: they are pushed out, see below);
- the **admin API** `/admin/v1`, which the CLI and any external manager call.

A leader listens on `:8080` by default. One leader serves one cluster. Leader failover is a process restart; there is no standby leader **(planned)**.

## Worker

A **worker** is the process `opod join` starts on a machine with an engine. It registers with the leader, then sends a **heartbeat** every 5 seconds. The heartbeat carries the models its engine has loaded, the engine's load sample (KV-cache use, queue depth, tokens per second) and the state of the engine process.

The worker runs its own HTTP API on `:8081`. The leader calls it to send inference requests, to load or unload a model, and to start processes for a gang. Every leader-to-worker call is signed with HMAC-SHA256 using that worker's token.

A worker's **node id** stays the same across restarts. It comes from, in order: `OPOD_NODE_ID`, the id saved in `~/.opod/node.yaml` by the last join, `n_` plus `POD_NAME`, or a new random id `n_…`.

The leader also lists itself as a node with the id `local`.

## Engine

An **engine** is the inference server opod drives: Ollama, vLLM, SGLang, llama.cpp `llama-server`, MLX-LM or TensorRT-LLM `trtllm-serve`. Each node uses one engine, chosen by `engine.preferred` (or `OPOD_ENGINE`). See [Engines](https://opod.io/docs/core-reference/engines/).

Some engines serve exactly one model per process (vLLM, SGLang, llama.cpp, TensorRT-LLM). Loading another model on such a worker stops the running one. Ollama holds several models and loads on request.

## Node states

`opod node ls` shows the state the leader acts on, computed when it reads the row:

| State           | Meaning                                                                                                                                  |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `joining`       | Registered, not yet ready.                                                                                                               |
| `ready`         | Takes new requests.                                                                                                                      |
| `draining`      | You drained it. No new requests or gang parts; running requests finish. It stays drained until you undrain it.                           |
| `lost`          | No heartbeat within the heartbeat bound (`router.heartbeat_max_age_seconds`, default 30 s; `0` means a 60 s bound).                      |
| `engine-silent` | Heartbeats arrive, but the engine has not answered the worker within that bound. It gets no new requests until the engine answers again. |

**Figure: A node's states, as the leader sees them.** A state diagram: no row, ready, draining, engine-silent and lost, with the events that move a node between them. The interactive figure is on the web page: <https://opod.io/docs/core/concepts/>

## Placement

A **placement** says that a node serves a model. Placements come from residency: a model is placed on a worker when the worker's heartbeat reports that its engine has the model loaded. Three paths make the leader target a specific node: `opod model add --node`, `opod model move` and `opod shard create`.

The router picks, for each request, a node that holds the requested model and takes new work. It prefers the leader's own engine when that holds the model, else the least-loaded live worker. A manager can switch on load-aware scoring, prefix-cache affinity and a speed rank through the [policy snapshot](https://opod.io/docs/core-reference/policy-snapshot/).

## Model ids

A request's `model` field selects the backend:

| `model` value                                   | Served by                                                                                                       |
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| a catalog id, e.g. `qwen3-coder-30b`            | its gang if it is sharded; else the leader's engine if it holds it; else the least-loaded live worker that does |
| `auto`                                          | the leader's default model (`router.default_model`)                                                             |
| an engine-native name, e.g. `qwen2.5-coder:14b` | any node that reports it loaded; no catalog entry needed                                                        |
| `<model>:<adapter>`                             | a LoRA adapter of that model (vLLM workers)                                                                     |
| `<model>:nitro`                                 | the same model, with the fallback chain sorted by throughput                                                    |
| a vendor id such as `gpt-4o`                    | nothing; core does not proxy to vendors                                                                         |

## Gang

A **gang** is one complete serving copy of a model that is split across several machines: N parts plus one **coordinator** (the process that serves the API for the whole gang). The catalog entry's `sharding.engine` picks the scheme: llama.cpp RPC (layer split), vLLM on a Ray cluster (tensor and pipeline parallel), or SGLang's own launcher. A model can have several gangs; each serves whole requests, and the router picks the least-loaded ready one. See [Sharding](https://opod.io/docs/core/sharding/).

## Catalog

The **catalog** is a set of model entries: where the weights come from, the size, the minimum hardware, the capabilities and the recommended engines. A curated catalog is embedded in the binary. Files in override directories add or replace entries. See [Catalog format](https://opod.io/docs/core-reference/catalog/).

## API keys

Every caller authenticates with an API key `sk-orc-…`. A key has exactly one scope:

| Scope   | Can call                                               |
| ------- | ------------------------------------------------------ |
| `user`  | `/v1/*`                                                |
| `admin` | `/v1/*` and `/admin/v1/*`                              |
| `node`  | worker register and heartbeat; `opod join` presents it |

Keys are identities. Core attaches no rate limit, quota or model allowlist to them.

## Front door and cell door

`opod up --role gateway --leader URL` starts a **front door**: an extra copy of the gateway for one leader's endpoint. It serves `/v1` and the probes only. It mirrors the leader's worker list, routes to those workers itself, and pushes its usage rows to the leader. Run several behind a load balancer to spread client connections.

`opod up --role door --routes FILE` starts a **cell door**: one URL in front of many leaders. It reads each request's `model`, looks up the endpoint in a routes file and forwards the request unchanged. It holds no key and no store. See [Front doors](https://opod.io/docs/core-reference/front-doors/).

## Standalone and managed

A leader started by hand is **standalone**: its store is a durable SQLite file and you manage it with the CLI.

A leader run by an external manager (a control plane, a systemd unit you template, a script) is **managed** when `OPOD_MANAGED=1`. Its store is then an in-memory cache, unless `OPOD_STORAGE_DSN` names a file. The manager steers it through three watched files, each re-read every 10 seconds:

| File            | Default path                 | Carries                                                                   |
| --------------- | ---------------------------- | ------------------------------------------------------------------------- |
| plan            | `/etc/opod/plan.json`        | the endpoint's one model, its revision, adapters, gangs, workload context |
| auth snapshot   | `/etc/opod-auth/auth.json`   | API keys as hashes, `requireKeys`, revocations, worker-certificate policy |
| policy snapshot | `/etc/opod-auth/policy.json` | routing weights, access log, admission, wake rules, fallback target       |

A leader keeps serving from the last good copy of each file when the manager is down. See [Managed mode](https://opod.io/docs/core/managed-mode/).

## Usage and events

Each request leaves a **usage row**: key, model, protocol, tokens, latency, time to first token, outcome and serving node. Fleet changes leave **lifecycle events** (`node.registered`, `model.loaded`, `shard.created`, …). Both are read by cursor from `/admin/v1/usage/stream` and `/admin/v1/events/stream`. See [Streams](https://opod.io/docs/core-reference/streams/).

In core v0.4.0 the usage stream is replaced. The leader keeps no usage table: it holds each record in a queue in memory (64 MiB by default) and pushes it as an OTLP log record to `OPOD_USAGE_OTLP_ENDPOINT`, freeing it only when the receiver answers 2xx. Without a receiver, usage is not kept. Events are still read by cursor. See [Usage push](https://opod.io/docs/core-reference/streams/#usage-push).
