Skip to main content
OpenLIT automatically instruments LLMs, vector databases, MCP, and frameworks — no manual span creation needed.
1

Install the SDK

2

Initialize OpenLIT in your application

Call openlit.init() once, as early as possible in your application — before any LLM client is imported or constructed.
If you omit otlp_endpoint, OpenLIT still initialises and instruments your libraries. Traces are produced but not exported anywhere — useful for local development and testing.
3

Make an LLM call

Use any supported library normally. OpenLIT intercepts the call and records a span automatically.
Each call produces a span with attributes including:
  • Model name and provider
  • Prompt and completion tokens
  • Estimated cost in USD
  • Latency (wall-clock duration)
  • Prompt and response content (disable with capture_message_content=False)

Zero-code instrumentation (CLI)

If you cannot modify your application source, use the openlit-instrument CLI wrapper instead. It injects instrumentation at process startup with no code changes:
openlit-instrument is a drop-in replacement for opentelemetry-instrument. It provides the same upstream OpenTelemetry instrumentations plus all AI-specific capabilities.

What to expect when no OTLP endpoint is configured

When you call openlit.init() without an otlp_endpoint and without the OTEL_EXPORTER_OTLP_ENDPOINT environment variable set, OpenLIT initialises successfully but does not export any data. You will see a log message similar to:
No spans or metrics are lost — they are generated in memory but discarded because no exporter is configured. This is safe for local development.

Next steps

Configuration

All openlit.init() parameters and their environment variable equivalents

Tracing

Custom spans, content capture options, and manual tracing

Integrations

60+ supported LLM providers, frameworks, and databases