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.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 theopenlit-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 callopenlit.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:
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
