Skip to main content
OpenLIT enables full-stack AI observability with one line of code—covering LLMs, vector databases, and GPUs. Combined with Portkey, get automatic tracing plus gateway features like caching, fallbacks, and load balancing.

Why OpenLIT + Portkey?

One-Line Setup

Enable complete observability with a single line of code

Full-Stack Monitoring

Monitor LLMs, vector databases, and GPUs in a unified view

OpenTelemetry Native

Built on OpenTelemetry standards for seamless integration

Gateway Intelligence

Portkey adds caching, fallbacks, and load balancing to every request

Quick Start

pip install openlit openai
import os
import openlit
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry import trace
from openai import OpenAI

# Send traces to Portkey
os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://api.portkey.ai/v1/logs/otel"
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = "x-portkey-api-key=YOUR_PORTKEY_API_KEY"

# Initialize OpenLIT
trace_provider = TracerProvider()
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(trace_provider)
openlit.init(tracer=trace.get_tracer(__name__), disable_batch=True)

# Use Portkey gateway
client = OpenAI(
    api_key="YOUR_PORTKEY_API_KEY",
    base_url="https://api.portkey.ai/v1"
)

response = client.chat.completions.create(
    model="@openai-prod/gpt-4.1",  # Provider slug from Model Catalog
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
OpenTelemetry traces in Portkey

Setup

  1. Add provider in Model Catalog → get provider slug (e.g., @openai-prod)
  2. Get Portkey API key
  3. Use model="@provider-slug/model-name" in requests

Next Steps


See Your Traces in Action

Once configured, view your OpenLIT instrumentation combined with Portkey gateway intelligence in the Portkey dashboard:
OpenTelemetry traces in Portkey