Skip to content

Instrument OpenAI Responses API #3436

Open
@alexmojaki

Description

@alexmojaki

What problem do you want to solve?

OpenAI has introduced a new 'Responses API' as an alternative to the chat completions API. Some models like https://platform.openai.com/docs/models/o1-pro only support the Responses API. Currently this records nothing even when exporters are configured:

import os

import openai
import opentelemetry.instrumentation.openai_v2

os.environ['OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT'] = 'true'
opentelemetry.instrumentation.openai_v2.OpenAIInstrumentor().instrument()

response = openai.responses.create(model='gpt-4o', input='hi')
print(response)

Describe the solution you'd like

Methods of the Responses API should be instrumented in the same manner as the chat completions API.

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions