> ## Documentation Index
> Fetch the complete documentation index at: https://opentracy.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Welcome to OpenTracy

> The auto-distillation layer for your LLM calls — drop in, cut cost, keep quality

<img src="https://mintcdn.com/opentracy/GPH9CFICBELzB50g/images/diagram.jpeg?fit=max&auto=format&n=GPH9CFICBELzB50g&q=85&s=0d5da28aa6a9fb2587cb90eba9814eb8" alt="The OpenTracy loop: your app → engine → providers, with trace → dataset → distillation → alias swap feeding back in" width="1280" height="714" data-path="images/diagram.jpeg" />

## What OpenTracy gives you

Drop OpenTracy in where your OpenAI SDK sits today. Every request becomes a
**trace**. Same-intent traces cluster into a **dataset**. Datasets train a
**distilled student model** that matches your teacher's output on *your*
traffic. The routing layer swaps the student in under your app through an
alias — **your code never changes, your cost curve goes down**.

## Install

```bash theme={null}
pip install opentracy
```

The wheel ships the Go routing engine, the ONNX embedder, and a pre-trained
router — `pip install` and you can route on Linux (x86\_64 / ARM64), macOS
(Apple Silicon), or Windows (x86\_64).

Then jump to the [Quickstart](/quickstart).

## The loop, one step at a time

<Steps>
  <Step title="Your app calls the engine" icon="plug">
    Point your OpenAI SDK (or any of the 13 providers) at OpenTracy. No code
    changes beyond `base_url`.
  </Step>

  <Step title="Every call becomes a trace" icon="magnifying-glass">
    Prompt, response, model, cost, latency, tokens — persisted to ClickHouse
    automatically.
  </Step>

  <Step title="Traces cluster into a dataset" icon="diagram-project">
    Same-intent traces are grouped and labeled (e.g. "classify support tickets",
    "generate SQL").
  </Step>

  <Step title="A student model gets distilled" icon="wand-magic-sparkles">
    The teacher (GPT-4o, Sonnet, ...) labels the dataset; a tiny student
    (llama-3.2-1b, qwen3-0.6b, ...) fine-tunes to match.
  </Step>

  <Step title="Alias re-points at the student" icon="shuffle">
    `model="smart"` now resolves to the distilled student. Your app code
    never changed.
  </Step>
</Steps>

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Five minutes: install, route your first request, see cost + latency metadata.
  </Card>

  <Card title="Pipeline" icon="route" href="/concepts/pipeline">
    The full story — request → trace → dataset → student → alias.
  </Card>

  <Card title="Traces" icon="magnifying-glass" href="/concepts/traces">
    What we capture per request, where it lives, how it becomes training data.
  </Card>

  <Card title="Distillation" icon="wand-magic-sparkles" href="/concepts/distillation">
    Turn your teacher's output on your traffic into a cheap custom student.
  </Card>
</CardGroup>

## Why OpenTracy exists

Every team running LLMs in production hits the same wall:

* GPT-4o / Claude Sonnet works — but it's **expensive**.
* GPT-4o-mini / Haiku is cheap — but **quality risk is real** on hard prompts.
* Fine-tuning a smaller model is the right answer — but it needs **a dataset
  you don't have**, training infrastructure you don't want, and a way to
  **actually serve the new model behind your existing code**.

OpenTracy is the four things, glued together: a gateway that turns traffic
into training data, automatic dataset curation, distillation training, and
a routing layer that swaps models behind aliases so your app code doesn't
change on the day the cheap model goes live.

## How this documentation is organized

<CardGroup cols={2}>
  <Card title="Concepts" icon="book" href="/concepts/pipeline">
    The "why" — traces, datasets, auto-routing, distillation, and the pipeline that ties them together.
  </Card>

  <Card title="Guides" icon="map" href="/guides/drop-in-openai">
    Task-oriented walkthroughs — drop-in OpenAI replacement, self-hosting, Python SDK.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/completion">
    Every function in the Python SDK with arguments, return types, and examples.
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/OpenTracy/opentracy">
    Source code, issues, and the CI workflow that ships the wheels.
  </Card>
</CardGroup>
