OpenInference OpenAI Instrumentation
Actively maintained. Last release 9 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install openinference-instrumentation-openaiOpenInference OpenAI Instrumentation
Python auto-instrumentation library for OpenAI's python SDK.
The traces emitted by this instrumentation are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.
Installation
pip install openinference-instrumentation-openai
SDK compatibility
The supported SDK range is openai>=2.8.0, matching the instruments extra
and the OpenTelemetry instrumentation dependency check. OpenAI 1.x and earlier
2.x releases are outside this range. Install the SDK with the instrumentor using:
pip install 'openinference-instrumentation-openai[instruments]'
CI tests OpenAI 2.8.0, OpenAI 3.0.0, and the latest available SDK on Python 3.10 and 3.15. There is no SDK upper bound; the latest lane is a required compatibility check, including when a new major version becomes available.
OpenAI 3 uses httpx2 as its default HTTP transport. OpenAIInstrumentor wraps
the SDK request methods and supports this transport without application changes.
Chat Completions, Completions, Embeddings, Responses, Images, and Decisions are
tested with sync and async clients, including streaming where the API supports it.
OpenInference spans are independent of HTTP transport spans:
opentelemetry-instrumentation-httpx does not instrument the SDK's default httpx2
client in normal application use.
Decisions API
Calls to the Decisions API
(client.decisions.create, openai>=3.26.0) are recorded as DECISION spans
following the decision span conventions.
A decision model answers a fixed set of typed questions (predicate, choice,
score) about the input rather than generating text, so the span identifies the
model under decision.* instead of and carries no attributes: