skillfed

opentelemetry-instrumentation-openai

OpenTelemetry OpenAI instrumentation

opentelemetry-instrumentation-openai v0.62.3 4.8M downloads/30d#2,236 on PyPI7,377
Permissive license Apache-2.0 Active released

What it is and what it does

This package automatically instruments the official OpenAI Python library to emit OpenTelemetry spans for every API call. It captures prompts, completions, and embeddings as span attributes, giving you visibility into what your LLM application is sending and receiving. The instrumentation is enabled by calling a single method after import.

By default, full prompt and completion text is logged to spans for debugging visibility. If you need to reduce trace size or protect sensitive user data, you can disable content logging via the TRACELOOP_TRACE_CONTENT environment variable. The package integrates with any OpenTelemetry-compatible observability backend (Jaeger, Datadog, etc.) to centralize and analyze these traces.

Use it for:

  • Debug LLM application behavior by inspecting what prompts were sent and what completions were returned.
  • Monitor OpenAI API usage patterns and costs across your application.
  • Trace latency and performance of individual OpenAI calls within distributed systems.
  • Audit and log all AI interactions for compliance or quality review.
  • Correlate OpenAI calls with other application spans for end-to-end request tracing.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Captures traces of OpenAI API calls (prompts, completions, embeddings) and exports them to OpenTelemetry backends for observability and debugging.

Yes, if you use the OpenAI library and need observability. Installation is frictionless, maintenance is active, and the permissive license poses no constraints. The single-line instrumentation API is straightforward. Only skip if you have no observability backend configured or if you cannot tolerate the default logging of prompt/completion text (though that can be disabled).

Install

opentelemetry-instrumentation-openai on PyPI

pip

pip install opentelemetry-instrumentation-openai

uv

uv add opentelemetry-instrumentation-openai

poetry

poetry add opentelemetry-instrumentation-openai

Installing opentelemetry-instrumentation-openai

Before you install

Low friction: pure Python wheel with four lightweight OpenTelemetry dependencies. Actively maintained with a release 4 days old and 7377 repository stars.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions.

Quickstart

pip install opentelemetry-instrumentation-openai

from opentelemetry.instrumentation.openai import OpenAIInstrumentor

OpenAIInstrumentor().instrument()

Requires Python 3.10 or later; OpenAI library must be installed separately for instrumentation to be useful.

Verify before relying

  • Whether the package works with all OpenAI library versions or has specific version constraints.
  • How trace export backends are configured (whether this package handles that or requires separate setup).
  • Performance overhead when tracing high-volume LLM applications.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — opentelemetry-api, opentelemetry-instrumentation, opentelemetry-semantic-conventions-ai, opentelemetry-semantic-conventions
Maintenance actively maintained — 4 days since the last release
Last repo commit
First released
Downloads 4,773,887/month — #2,236 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: opentelemetry_instrumentation_openai-0.62.3-py3-none-any.whl

Tags

openai tracingllm observabilityopentelemetry instrumentationai prompt loggingopenai span tracingllm debugging tracesopenai api monitoring
observabilityllm-tracingopenai

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

literalai

Literalai is a Python SDK for observability in…

permissive · top 15,000 on PyPI

opentelemetry-instrumentation-google-generativeai

Automatically traces prompts, completions, and…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-groq

Automatically captures traces of Groq SDK API…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-mistralai

Automatically captures and traces calls to the…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-openai-v2

Automatically traces and logs OpenAI API calls…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-replicate

Adds OpenTelemetry tracing to Replicate API…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-together

Automatically traces calls to Together AI's API…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-vertexai

Automatically captures traces of VertexAI API…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-voyageai

Automatically captures and traces Voyage AI API…

permissive · top 5,000 on PyPI

traceloop-sdk

Traceloop SDK instruments LLM applications to…

permissive · top 5,000 on PyPI