opentelemetry-instrumentation-openai-v2
OpenTelemetry Official OpenAI instrumentation
Decision gist · record as of 2026-08-14
Yes, if you already have OpenTelemetry configured in your application and need visibility into OpenAI or compatible LLM API calls. The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it safe to adopt. Not necessary if you have no OpenTelemetry setup or do not use the OpenAI SDK.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires OpenTelemetry tracing, logging, and events to be configured before instrumentation will emit telemetry.
- Requires Python 3.10 or later.
- Low friction installation with four stable OpenTelemetry dependencies already in the ecosystem.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restrictions.
last release 2026-05-01 (105 days) · last repo commit 2026-08-14 · 1,086 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,897,611 downloads/mo, #3,447 on PyPI
Alternatives
Verify before relying
pip install opentelemetry-instrumentation-openai-v2
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
from openai import OpenAI
OpenAIInstrumentor().instrument()
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}]
)- Whether the package works with all listed OpenAI-compatible platforms (Azure OpenAI, Gemini, Perplexity, xAI, DeepSeek, Groq, MistralAI) equally well or if some have limitations.
- Performance overhead of instrumentation on high-volume LLM applications.
- Whether the optional upload hook for prompts/completions (requiring fsspec) is production-ready.
What it is and what it does
This package integrates OpenTelemetry tracing into applications using the OpenAI Python SDK or compatible LLM platforms. When installed and initialized, it automatically captures spans for chat completions, embeddings, and other API operations, recording metrics like token usage and operation duration. It works with OpenAI-compatible services including Azure OpenAI, Gemini, Perplexity, xAI, DeepSeek, Groq, and MistralAI when accessed through the OpenAI SDK.
The instrumentation is configured via environment variables to control what telemetry is captured—by default it traces operations without capturing message content, but you can enable content logging as events or span attributes. It requires an existing OpenTelemetry setup (tracing, logging, and events configured) to emit the captured telemetry. The package is in Beta status and aligns with OpenTelemetry Semantic Conventions v1.30.0, with experimental features available through opt-in environment variables.
Use it for
- Monitor and debug OpenAI API calls in production applications by viewing traces of chat completions and embeddings.
- Track token consumption across LLM operations for cost analysis and quota management.
- Correlate LLM requests with other application traces in a centralized observability platform.
- Audit and log prompt and completion content when compliance or debugging requires it.
- Observe applications using OpenAI-compatible services (Groq, Gemini, etc.) with a single instrumentation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you already have OpenTelemetry configured in your application and need visibility into OpenAI or compatible LLM API calls.
The low install friction, active maintenance, permissive license, and zero known vulnerabilities make it safe to adopt. Not necessary if you have no OpenTelemetry setup or do not use the OpenAI SDK.
Install
opentelemetry-instrumentation-openai-v2 on PyPI
Before you install
Low friction installation with four stable OpenTelemetry dependencies already in the ecosystem. Active maintenance (last commit 2026-08-14) and no known vulnerabilities. Requires Python 3.10 or later.
Requires OpenTelemetry tracing, logging, and events to be configured before instrumentation will emit telemetry. Requires Python 3.10 or later.
License in practice
Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restrictions.
Quickstart
pip install opentelemetry-instrumentation-openai-v2
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
from openai import OpenAI
OpenAIInstrumentor().instrument()
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}]
)
Verify before relying
- Whether the package works with all listed OpenAI-compatible platforms (Azure OpenAI, Gemini, Perplexity, xAI, DeepSeek, Groq, MistralAI) equally well or if some have limitations.
- Performance overhead of instrumentation on high-volume LLM applications.
- Whether the optional upload hook for prompts/completions (requiring fsspec) is production-ready.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packagesopentelemetry-apiopentelemetry-instrumentationopentelemetry-semantic-conventionsopentelemetry-util-genai |
| Maintenance | Actively maintained 105 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,897,611 / month, #3,447 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14 |
Evidence: opentelemetry_instrumentation_openai_v2-2.4b0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “openai request monitoring”
- opentelemetry-instrumentation-openai-v2Automatically traces and logs OpenAI API calls (and compatible…
- openinference-instrumentation-openaiAuto-instruments OpenAI Python SDK calls to emit…
- opentelemetry-instrumentation-openaiCaptures traces of OpenAI API calls (prompts, completions,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Monitoring packages
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
Provides generated Python code for OpenTelemetry semantic conventions, enabling standardized attribute naming and constant definitions for instrumentation and telemetry collection.
Install it if you are using OpenTelemetry and want to follow semantic conventions correctly.
Provides the reference implementation of the OpenTelemetry API for collecting and exporting traces, metrics, and logs from Python applications.
Provides the abstract API and interfaces for OpenTelemetry instrumentation in Python, defining how to emit traces, metrics, and logs without tying code to a specific SDK implementation.
Exports OpenTelemetry observability data to an OpenTelemetry Collector using Protobuf-encoded messages over HTTP.
Install it if you are using OpenTelemetry in Python and need to send data to a Collector over HTTP.
Provides automatic instrumentation commands and programmatic APIs to inject distributed tracing into Python applications without code changes, detecting and instrumenting packages used by your program.
Install it if you need distributed tracing without code changes and have compatible instrumented packages in your environment.
See also opentelemetry-instrumentation-google-genai · opentelemetry-instrumentation-openai · opentelemetry-instrumentation-openai-agents-v2 · langwatch · loongsuite-util-genai · opentelemetry-util-genai · opentelemetry-semantic-conventions-ai · opentelemetry-instrumentation-groq · opentelemetry-instrumentation-google-generativeai · openinference-instrumentation-portkey