OpenAI Tracing
Instrument OpenAI SDK calls (Python & JS/TS) with OpenInference and view traces in Arize.
OpenInference provides auto-instrumentation for the OpenAI Python Library and also supports the OpenAI JS/TS Library. Traces from both can be sent to Arize.
Launch Arize
To get started, sign up for a free Arize account and get your Space ID and API Key.
Install
API Key Setup
Add your OpenAI API key as an environment variable:
For Azure OpenAI, you would set AZURE_OPENAI_API_KEY
, AZURE_OPENAI_ENDPOINT
, etc., as per Azure's requirements.
Use the register
function to connect your application to Arize and instrument the OpenAI client:
Run OpenAI
The OpenAI client will automatically use the OPENAI_API_KEY
(or Azure-specific variables) from your environment.
Observe
Now that you have tracing setup, all invocations of OpenAI (completions, chat completions, embeddings) using the instrumented client will be streamed to your Arize account for observability and evaluation.

JavaScript/TypeScript Support
OpenInference also provides instrumentation for the OpenAI JS/TS SDK. For setup and examples, please refer to the OpenInference JS examples for OpenAI.
Resources
Last updated
Was this helpful?