Skip to main content
The shortest possible path to adopting OpenTracy is to not install anything new in your app. Just change base_url on your existing OpenAI client.

What this buys you

  • Every request your app already makes becomes an OpenTracy trace.
  • The engine can fan out to 13 providers — keep calling model="gpt-4o", or switch to model="anthropic/claude-sonnet-4-6" without touching your auth code.
  • Routing aliases become usable: later, point model="smart" at a distilled student without the app knowing.

The change

Python (OpenAI SDK)

That’s it. Your app makes the same API calls, gets the same response shape, but every call is traced in ClickHouse and the engine handles routing / fallback / retry / cost tracking.

TypeScript (OpenAI SDK)

curl

Where do provider API keys live?

On the engine, not the client. Three ways:
  1. ~/.opentracy/secrets.json on the host running the engine:
  2. Environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) read by the engine process.
  3. UI: Settings → Integrations in the self-hosted UI. Stored encrypted in ClickHouse.

Changing models across providers

Because the engine speaks all 13 provider APIs, switching models is a string change:
The provider/model format is the only convention to learn.

Using a routing alias

An alias is a logical name you define once in the engine, then call by name:
Later, when you’ve distilled a student, point "smart" at the student. The app code doesn’t change — the model upgrade is a config change on the engine side.

What you get in the response

Standard OpenAI fields plus OpenTracy extras:
The extras are under single-underscore names so they don’t collide with any future OpenAI SDK field.

Streaming

Streaming works unmodified. The engine translates upstream streaming formats (Anthropic SSE, Bedrock event-stream, etc.) into OpenAI’s SSE shape, so your client code doesn’t need per-provider logic:

Tool calls

Tool / function calls translate across providers. You pass OpenAI-shaped tools and tool_choice, and the engine adapts them to Anthropic’s tools, Gemini’s function declarations, etc.:

Caveats

The engine has to be reachable from your app. For production: run the engine in the same VPC / network as your app, or expose it on a trusted internal hostname. Don’t put the engine on the public internet without auth.
By default every request is traced with full prompt and response text. If you handle PII, set OPENTRACY_TRACE_REDACT=true or OPENTRACY_TRACE_CONTENT=false on the engine — see Traces → Privacy.

Next

Self-host

Run engine + ClickHouse + UI with Docker Compose.

Python SDK

If you’re starting fresh (not adapting an OpenAI app), use opentracy directly.