
pip install opentracy. You need the
full self-hosted stack if you want:
- Trace storage and analytics (ClickHouse-backed).
- The UI at
localhost:3000for browsing traces, datasets, experiments. - Distillation (
Distillerclient — requires the REST API + a GPU). - Engine-side routing aliases (the
model="smart"→ distilled-student swap).
Prerequisites
- Docker ≥ 24 and Docker Compose v2
- An NVIDIA GPU +
nvidia-container-toolkitif you plan to run distillation - ~10 GB free disk for ClickHouse + weights + training artifacts
Start the stack
| Service | URL | Purpose |
|---|---|---|
| Gateway engine | http://localhost:8080 | OpenAI-compatible, routes requests. |
| REST / Python API | http://localhost:8000 | Datasets, distillation, evaluations. |
| UI | http://localhost:3000 | Browser dashboard. |
| ClickHouse HTTP | http://localhost:8123 | Trace storage. |
What each service is
opentracy-engine(Go) — the gateway. Receives/v1/chat/completions, authenticates to upstream providers, streams responses back, writes traces to ClickHouse. Also exposes/v1/routefor auto-routing.opentracy-api(Python, FastAPI) — business logic on top of traces: datasets, evaluations, distillation jobs. Uses ClickHouse for reads, launches training subprocesses.clickhouse— column-store for traces and analytics.ui(Next.js) — the dashboard.
Configuration knobs
Provider API keys live under~/.opentracy/secrets.json on the host
(mounted into the engine container):
opentracy-api container):
| Variable | Default | Purpose |
|---|---|---|
OPENTRACY_CH_HOST | clickhouse | ClickHouse host inside the compose network. |
OPENTRACY_CH_DATABASE | opentracy | ClickHouse database name. |
OPENTRACY_CH_ENABLED | false | Enable ClickHouse writes. make start-full sets this. |
OPENTRACY_DATA_DIR | /app/data | Training artifacts root (mapped to a volume). |
OPENTRACY_TRACE_REDACT | false | Strip PII patterns from trace content. |
OPENTRACY_TRACE_CONTENT | true | Set to false to drop prompt/response text. |
AUTO_TRAINER | false | Enable the autonomous operator loop. |
Legacy
LUNAR_* env vars still work and fall back to the new
OPENTRACY_* names with a one-time DeprecationWarning. Migrate when
you touch the env file — no rush.Point your app at the local stack
Running distillation
With the stack up and at least one GPU visible:Updating
ot.download("weights-default") refreshes them locally).
Stopping
clickhouse-data, weights-data,
distillation-data). To wipe everything and start fresh:
Production considerations
Next
Pipeline
Understand how the self-hosted stack implements the pipeline.
Python SDK
The thin client that talks to the stack you just started.

