ConfigsApr 2, 2026·2 min read

OpenLIT — OpenTelemetry LLM Observability

Monitor LLM costs, latency, and quality with OpenTelemetry-native tracing. GPU monitoring and guardrails built in. 2.3K+ stars.

TL;DR
OpenLIT provides one-line OpenTelemetry instrumentation for LLM observability.
§01

What it is

OpenLIT is an open-source observability platform built on OpenTelemetry that monitors LLM application costs, latency, and output quality. With a single line of code, it auto-instruments calls to OpenAI, Anthropic, Google, and other LLM providers. It also provides GPU monitoring and built-in guardrails for content safety.

It targets AI engineers and platform teams who want standardized observability for LLM applications using the OpenTelemetry ecosystem they already know.

§02

How it saves time or tokens

OpenLIT's one-line setup eliminates the boilerplate of manually instrumenting every LLM call. By surfacing cost breakdowns per model, endpoint, and user, it identifies where tokens are being wasted. The latency tracking helps optimize slow requests, and the quality monitoring catches degraded outputs before users notice. All data flows through standard OpenTelemetry pipelines, so it integrates with existing observability stacks (Grafana, Jaeger, Datadog).

§03

How to use

  1. Install and initialize:
pip install openlit
  1. Add one line to instrument all LLM calls:
import openlit

openlit.init()

# Now use any LLM library as usual
from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
    model='gpt-4o',
    messages=[{'role': 'user', 'content': 'Hello'}]
)
# OpenLIT automatically traces this call
  1. View traces in the OpenLIT dashboard or export to any OpenTelemetry-compatible backend.
§04

Example

import openlit
from openai import OpenAI
from anthropic import Anthropic

# Initialize once at startup
openlit.init()

# All LLM calls are automatically traced
oai = OpenAI()
ant = Anthropic()

# OpenAI call -- traced with cost, latency, tokens
oai_response = oai.chat.completions.create(
    model='gpt-4o',
    messages=[{'role': 'user', 'content': 'Summarize this article'}]
)

# Anthropic call -- also traced automatically
ant_response = ant.messages.create(
    model='claude-sonnet-4-20250514',
    max_tokens=1024,
    messages=[{'role': 'user', 'content': 'Summarize this article'}]
)

# Compare costs and latency in the OpenLIT dashboard
§05

Related on TokRepo

§06

Common pitfalls

  • OpenLIT auto-instruments supported libraries. If you use a niche LLM provider without a supported SDK, you need manual instrumentation via OpenTelemetry spans.
  • The built-in dashboard requires Docker to run. For teams already using Grafana or Datadog, export traces via OTLP instead of running a separate dashboard.
  • GPU monitoring requires additional system-level permissions. Ensure the process has access to nvidia-smi or equivalent GPU metrics endpoints.

Frequently Asked Questions

Which LLM providers does OpenLIT support?+

OpenLIT auto-instruments OpenAI, Anthropic, Google (Gemini), Mistral, Cohere, Bedrock, and several other providers. It also supports vector databases like Pinecone, Chroma, and Qdrant. The instrumentation hooks into the provider SDK, so no code changes are needed beyond the init() call.

How does OpenLIT compare to Langfuse?+

Both provide LLM observability. OpenLIT is built on OpenTelemetry, making it compatible with any OTLP-compatible backend (Grafana, Jaeger, Datadog). Langfuse is a standalone platform with its own backend. Choose OpenLIT if you want to integrate LLM monitoring into an existing OpenTelemetry stack.

Can I use OpenLIT with existing monitoring tools?+

Yes. OpenLIT exports data via OpenTelemetry Protocol (OTLP). You can send traces, metrics, and logs to Grafana, Jaeger, Datadog, New Relic, or any OTLP-compatible backend. This avoids adding yet another monitoring dashboard to your stack.

Does OpenLIT track costs?+

Yes. OpenLIT automatically calculates costs based on token usage and model pricing. It breaks down costs per model, per endpoint, and per user. This helps identify expensive queries and optimize token usage across your application.

What are OpenLIT guardrails?+

OpenLIT includes built-in guardrails that check LLM outputs for content safety issues. You can configure rules to detect PII, toxic content, or off-topic responses. Guardrails run as part of the tracing pipeline and flag issues in the dashboard without blocking the response.

Citations (3)
🙏

Source & Thanks

Created by OpenLIT. Licensed under Apache-2.0.

openlit — ⭐ 2,300+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets