--- id: opentelemetry-instrumentation-openai version: "0.62.3" license: Apache-2.0 license_treatment: permissive maintenance: active --- # opentelemetry-instrumentation-openai — OpenTelemetry OpenAI instrumentation License: permissive · Maintenance: active · Downloads: 4.8M/mo ## 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 above — 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 pip install opentelemetry-instrumentation-openai uv add opentelemetry-instrumentation-openai 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_current - Install friction: low - Maintenance: active - Downloads: 4.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags openai tracing, llm observability, opentelemetry instrumentation, ai prompt logging, openai span tracing, llm debugging traces, openai api monitoring, observability, llm-tracing, openai [View on SkillFed](https://skillfed.io/packages/opentelemetry-instrumentation-openai) · [View on PyPI](https://pypi.org/project/opentelemetry-instrumentation-openai/)