---
title: "config.yaml"
description: "Every field of the opod configuration file, its default, and the environment variable that overrides it."
url: "https://opod.io/docs/core-reference/configuration/"
markdown_url: "https://opod.io/docs/core-reference/configuration.md"
section: "Core reference"
last_updated: "2026-10-30"
---

# config.yaml

> Every field of the opod configuration file, its default, and the environment variable that overrides it.

## In short

`~/.opod/config.yaml` is optional: every field has a default, and every field has an environment variable that wins over it. Write only the fields you change. `opod config show` prints the effective values.

```yaml
# ~/.opod/config.yaml
listen: ":8090"
engine:
  preferred: vllm
router:
  default_model: qwen2.5-7b-instruct
```

No configuration file is required. Every field has a default. Precedence, lowest to highest:

1. built-in defaults;
2. the YAML file: `~/.opod/config.yaml`, or `opod up --config PATH`;
3. environment variables.

The file is YAML. Unknown keys are ignored, so a file written by an older opod still loads. A leading `~/` in a path field is expanded to the home directory. When `data_dir` changes, `storage.dsn` and `storage.models_dir` follow it unless they are set explicitly.

`opod config show` prints the effective values with secrets redacted.

## Full reference

```yaml
listen: ":8080"                 # OPOD_LISTEN
external_url: ""                # OPOD_EXTERNAL_URL — public URL in the ready block and in `opod connect`
tls_cert: ""                    # OPOD_TLS_CERT — with tls_key, the main listener speaks TLS
tls_key: ""                     # OPOD_TLS_KEY
probe_listen: ""                # OPOD_PROBE_LISTEN — e.g. ":8081": probes + /metrics, always plain HTTP
plain_listen: ""                # OPOD_PLAIN_LISTEN — e.g. ":8082": the WHOLE API, always plain HTTP
data_dir: "~/.opod"             # OPOD_DATA_DIR — state.db, admin.key, node.yaml, opod.pid
log_level: "info"               # OPOD_LOG_LEVEL — debug | info | warn | error
catalog_dir: ""                 # a path = read ONLY that directory (see Catalog format)
max_body_bytes: 0               # OPOD_MAX_BODY_BYTES — /v1/chat/completions body cap; 0 = 32 MiB
trust_proxy_headers: false      # OPOD_TRUST_PROXY_HEADERS — honour X-Forwarded-Host/-Proto
block_private_targets: false    # OPOD_BLOCK_PRIVATE_TARGETS — refuse outbound probes to private addresses

storage:
  type: "sqlite"                # the only store today
  dsn: "~/.opod/state.db"       # OPOD_STORAGE_DSN
  models_dir: "~/.opod/models"  # no environment variable

auth:
  require_keys: true            # OPOD_REQUIRE_KEYS — false lets /v1 through without a key (development only)
  admin_token: ""               # OPOD_ADMIN_TOKEN — seeded as an admin key at every start
  join_token: ""                # OPOD_JOIN_TOKEN — seeded as a node key at every start; a worker's join token

engine:
  preferred: "ollama"           # OPOD_ENGINE — ollama | vllm | sglang | mlx | llamacpp | trtllm, or an alias
  ollama_endpoint:   "http://127.0.0.1:11434"   # OPOD_OLLAMA_ENDPOINT
  vllm_endpoint:     "http://127.0.0.1:8000"    # OPOD_VLLM_ENDPOINT
  mlx_endpoint:      "http://127.0.0.1:8080"    # OPOD_MLX_ENDPOINT
  llamacpp_endpoint: "http://127.0.0.1:8089"    # OPOD_LLAMACPP_ENDPOINT
  sglang_endpoint:   "http://127.0.0.1:30000"   # OPOD_SGLANG_ENDPOINT
  trtllm_endpoint:   "http://127.0.0.1:8000"    # OPOD_TRTLLM_ENDPOINT

router:
  default_model: ""                    # OPOD_DEFAULT_MODEL — what model "auto" means; empty = picked at first start
  pull_default_model: false            # OPOD_PULL_DEFAULT_MODEL — true = the leader serves that model itself
  heartbeat_max_age_seconds: 30        # OPOD_HEARTBEAT_MAX_AGE_SECONDS — 0 = a 60 s bound
  sticky_sessions: true                # kept for old files; the TTL below decides
  sticky_session_ttl_seconds: 0        # OPOD_STICKY_SESSION_TTL_SECONDS — >0 pins (user, model) to its last worker
  latency_fallback_p95_seconds: 0      # OPOD_LATENCY_P95_SECONDS — >0 tries a faster fallback first
  placement_allowed_fails: 0           # OPOD_PLACEMENT_ALLOWED_FAILS — circuit breaker: errors before a cooldown
  placement_cooldown_seconds: 0        # OPOD_PLACEMENT_COOLDOWN_SECONDS — both must be > 0
  hedge_replicas: 0                    # >1 allows per-request hedging (at most 3)

observability:
  otlp_endpoint: ""                    # OPOD_OTLP_ENDPOINT — OTLP/HTTP traces; empty = off
  response_cache:
    enabled: false
    driver: ""                         # memory | sqlite; empty = memory; anything else turns the cache off with a warning
    max_entries: 0                     # memory only; 0 = 1000
    default_ttl_seconds: 0             # 0 = 24 h

placement:
  exclusive: false                     # OPOD_EXCLUSIVE — one resident model per machine
  reserve_percent: 0                   # OPOD_PLACEMENT_RESERVE_PERCENT — % of RAM held back from admission; 0 (or ≥ 100) = 20
  drain_timeout_seconds: 0             # OPOD_PLACEMENT_DRAIN_TIMEOUT_SECONDS — eviction drain bound; 0 = 30 s

surfaces:
  managed: false                       # OPOD_MANAGED — run by an external manager
```

## Field notes

### Listeners

- `listen` serves everything: `/v1`, `/admin/v1`, the join path and the probes.
- With both `tls_cert` and `tls_key`, that listener speaks TLS. Workers trust it through `OPOD_LEADER_CA`.
- `probe_listen` serves only `/healthz`, `/readyz`, `/loadz` and `/metrics`, always plain HTTP.
- `plain_listen` serves the whole API in plain HTTP for a load balancer that cannot originate TLS. Prompts and keys cross it in clear text. A leader that cannot bind it does not start.

### `max_body_bytes`

Caps the body of `/v1/chat/completions`, the route that carries inline images. `0` uses the built-in 32 MiB ceiling. Other routes have fixed caps: 8 MiB for `/v1/embeddings` and `/v1/rerank`, 1 MiB for the rest, including `/admin/v1`.

### `catalog_dir`

Empty: the embedded catalog plus the override directories (see [Catalog format](https://opod.io/docs/core-reference/catalog/)). A path: that directory alone, merged over nothing else from disk.

### `auth`

- `require_keys: false` is for local development. `/admin/v1` needs a key either way.
- `admin_token` and `join_token` are seeded into the store at every start and are idempotent. Neither has a built-in default.

### `router`

- `heartbeat_max_age_seconds`: a worker whose last heartbeat is older gets no new requests. Workers heartbeat every 5 seconds.
- `sticky_session_ttl_seconds`: pins a `(user, model)` pair to the worker that served it last, so the engine's prefix cache is reused. A key with no user id pins as itself from core v0.4.1 (v0.4.0 never pins it). Off by default. From core v0.4.0, a policy snapshot's `routing.stickyTtlSeconds` overrides it live; `0` there keeps this value.
- `latency_fallback_p95_seconds`: when the model's recent p95 latency exceeds this, the router tries the catalog `fallback` chain first.
- `placement_allowed_fails` and `placement_cooldown_seconds`: after that many consecutive engine errors from a worker, the router parks it for the cooldown. Both must be above 0.
- `hedge_replicas`: above 1, a request that asks for hedging (`opod.hedge: true` or `X-Opod-Hedge: 1`) goes to that many least-loaded workers at once and the first answer wins. The maximum is 3.

### `observability.response_cache`

Caches **embeddings** responses by a SHA-256 of the canonical request body. A request can opt out with `Cache-Control: no-cache` or `no-store`, and scope its entries with `opod.cache.namespace` in the body. The response carries `X-Opod-Cache: hit` or `miss`. `GET /admin/v1/cache/stats` and `DELETE /admin/v1/cache` manage it. Caching chat completions **(planned)**.

### `placement`

The memory lifecycle of the leader's own engine. See [Models](https://opod.io/docs/core/models/#memory-lifecycle).

### `surfaces.managed`

`true` (or `OPOD_MANAGED=1`; `off`, `0`, `false` and `no` mean false) makes the store an in-memory cache unless `OPOD_STORAGE_DSN` names one, and the ready block prints `Mode: managed`.

## Files in the data directory

| File          | Written by                     | Holds                                                                 |
| ------------- | ------------------------------ | --------------------------------------------------------------------- |
| `config.yaml` | you                            | this file                                                             |
| `state.db`    | the leader                     | SQLite store: nodes, models, placements, keys, usage, events, audit   |
| `admin.key`   | the first standalone `opod up` | the admin key, mode `0600`                                            |
| `opod.pid`    | `opod up`                      | the leader's PID, read by `opod down`                                 |
| `node.yaml`   | `opod join`                    | `node_id`, `leader_url`, `token`, `address`, `joined_at`, mode `0600` |
| `catalog/`    | you                            | catalog overrides                                                     |
| `models/`     | pulls and `opod fetch`         | weights (`storage.models_dir`)                                        |
