opentracy) is the native entry point. Use it if you’re
starting a new project or if you want features (auto-routing, distillation,
trace ingestion) that aren’t part of the OpenAI API shape.
Install
The four things you’ll do
1. One-off completion
Just a chat completion, no routing, no trace.2. Explicit router with fallbacks
When you want deterministic rules (“try GPT-4o first, then Claude, then DeepSeek”), use theRouter class:
3. Semantic auto-router
Load the pre-trained router once; it picks the right model per prompt:ot.completion this becomes a cost-optimizing client:
4. Distillation
The one-call path —ot.distill() runs the full 4-phase pipeline
in-process and returns a callable Student. Needs opentracy[distill]
and a CUDA GPU.
Distiller instead — same engine,
different deployment shape.
Async
Everything that has a sync version hasasync:
acompletion shares its request-preparation path with the sync version,
so force_engine, force_direct, fallbacks, and engine-prefix handling
all behave identically.
Trace ingestion
If you have existing logs from another LLM provider and want to use them for dataset building or distillation in OpenTracy, you can import them directly:Engine routing opt-in
By default the SDK calls providers directly. To route through an OpenTracy engine (for observability, aliases, etc.), set the env var once:ot.completion(...) routes through the engine.
Per-call overrides:
localhost:8080 is a footgun. Opt-in is explicit.
13 providers via create_client
If you want a first-class LLMClient object (for profiling, or to fit into
custom routing code), create_client covers every provider:
UnifiedClient that speaks
the OpenAI-chat protocol. Bedrock is registered but raises a clear error
on construction — AWS SigV4 is not handled by UnifiedClient yet; use
ot.completion(force_engine=True) instead.
Public API
Everythingimport opentracy as ot exposes publicly:
load_router, UniRouteRouter, RouterEvaluator,
LLMJudge, …) resolve via __getattr__ — they import the first
time you touch them, so they don’t slow down the initial import opentracy.
Legacy code using
import lunar_router as lr keeps working via a
backwards-compat shim that redirects to opentracy and emits a
DeprecationWarning. New code should use import opentracy as ot.Next
Self-host
Run engine + ClickHouse + UI locally or in your cloud.
API Reference
Every parameter and return value.

