---
title: "OpenAI Integration"
sidebar:
  label: "OpenAI"
seo:
  title: "OpenAI Integration with Judgment | Model Provider Docs"
  description: "Use Judgment with OpenAI to capture model calls, trace agent behavior, and evaluate production AI systems."
---

{/* @test-flow
  id: provider-openai
  lang: python
  env: JUDGMENT_API_KEY, JUDGMENT_ORG_ID, OPENAI_API_KEY
*/}

If you use OpenAI models within your application, you can trace, monitor, and analyze them with **Judgment**. You can do this by either

1. **Judgeval Wrap**: Add our [wrap()](/sdk-reference/python/trace/tracer#wrap) around the initialization of your client
2. **OpenTelemetry**: Use the [OpenAIInstrumentor](https://pypi.org/project/opentelemetry-instrumentation-openai/) library to wrap OpenAI SDK calls and send Otel spans to Judgment.

1. ### Judgeval Wrap

    ```python
    from openai import OpenAI
    from judgeval import Tracer, wrap

    Tracer.init(project_name="openai_project")

    openai_client = OpenAI()
    wrapped_client = wrap(openai_client)  # Use wrapped_client from here on
    ```

2. ### OpenTelemetry

    ```python
    from judgeval import Tracer
    # Make sure you installed the dependency: opentelemetry-instrumentation-openai
    from opentelemetry.instrumentation.openai import OpenAIInstrumentor

    Tracer.init(project_name="openai_project")
    Tracer.registerOTELInstrumentation(OpenAIInstrumentor())
    ```

    Register the instrumentor before `Tracer.init()`. Python accepts either
    order, but TypeScript requires this one.

> **Info**
>
> {" "}
> Only use one of these options to trace OpenAI calls or you may see duplicate
> tracing.{" "}
