Skip to main content
This module provides instrumentation for the OpenAI Go SDK (openai/openai-go) using the openinference-instrumentation-openai-go Go package, exporting OpenInference LLM spans to Phoenix.

Install

Setup

Configure an OTLP/HTTP exporter pointed at Phoenix. Create tracing.go:

Run OpenAI

Pass openaiotel.Middleware to the client via option.WithMiddleware. Session and user identifiers are stored on the Go context and applied to every LLM span descended from it.
To redact sensitive data, set OPENINFERENCE_HIDE_INPUTS=true or OPENINFERENCE_HIDE_OUTPUTS=true. See the openinference Go README for the full env-var matrix and the in-code WithTraceConfig override.

Observe

After setting up instrumentation and running your OpenAI application, traces will appear in the Phoenix UI for visualization and analysis.

Resources