From f3fbd787354f81665a2eded8746499163b78e201 Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 5 Feb 2026 00:42:29 -0500 Subject: [PATCH 01/20] Implement OpenAI Responses API instrumentation and examples - Added instrumentation for the OpenAI Responses API, including tracing for `Responses.create` and `Responses.stream` methods. - Introduced example scripts demonstrating the usage of the Responses API with OpenTelemetry. - Created a `.env` file for configuration, including API keys and OpenTelemetry settings. - Updated README files to include instructions for running examples and configuring the environment. - Added unit tests for the new Responses API functionality, ensuring proper tracing and metrics collection. This update enhances the observability of OpenAI API interactions within the OpenTelemetry framework. --- .../README.rst | 18 +- .../examples/responses/.env | 22 + .../examples/responses/README.rst | 44 ++ .../examples/responses/main.py | 36 ++ .../examples/responses/requirements.txt | 6 + .../instrumentation/openai_v2/__init__.py | 20 + .../instrumentation/openai_v2/patch.py | 444 +++++++++++++++- .../instrumentation/openai_v2/utils.py | 10 +- .../cassettes/test_responses_create.yaml | 500 ++++++++++++++++++ ...st_responses_stream_existing_response.yaml | 482 +++++++++++++++++ .../test_responses_stream_new_response.yaml | 362 +++++++++++++ .../tests/test_responses.py | 144 +++++ 12 files changed, 2073 insertions(+), 15 deletions(-) create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst index 1cd3a51b07..f10aa10f0a 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst @@ -82,6 +82,23 @@ Make sure to configure OpenTelemetry tracing, logging, and events to capture all input="Generate vector embeddings for this text" ) + # Responses API example + response = client.responses.create( + model="gpt-4o-mini", + input="Write a short poem on OpenTelemetry.", + ) + + # Responses streaming example + with client.responses.stream( + model="gpt-4o-mini", + input="Write a short poem on OpenTelemetry.", + background=True, + ) as stream: + for event in stream: + if event.type == "response.completed": + response = event.response + break + Enabling message content ************************* @@ -109,4 +126,3 @@ References * `OpenTelemetry OpenAI Instrumentation `_ * `OpenTelemetry Project `_ * `OpenTelemetry Python Examples `_ - diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env new file mode 100644 index 0000000000..8f2dd62b91 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env @@ -0,0 +1,22 @@ +# Update this with your real OpenAI API key +OPENAI_API_KEY=sk-YOUR_API_KEY + +# Uncomment to use Ollama instead of OpenAI +# OPENAI_BASE_URL=http://localhost:11434/v1 +# OPENAI_API_KEY=unused +# CHAT_MODEL=qwen2.5:0.5b + +# Uncomment and change to your OTLP endpoint +# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 +# OTEL_EXPORTER_OTLP_PROTOCOL=grpc + +OTEL_SERVICE_NAME=opentelemetry-python-openai + +# Change to 'false' to disable collection of python logging logs +OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true + +# Uncomment if your OTLP endpoint doesn't support logs +# OTEL_LOGS_EXPORTER=console + +# Change to 'false' to hide prompt and completion content +OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst new file mode 100644 index 0000000000..6d2e03995d --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst @@ -0,0 +1,44 @@ +OpenTelemetry OpenAI Responses API Instrumentation Example +========================================================== + +This is an example of how to instrument OpenAI Responses API calls with zero code changes, +using ``opentelemetry-instrument``. + +When ``main.py`` is run, it exports traces and metrics to an OTLP +compatible endpoint. Traces include details such as the model used, +response ID, token usage, and duration. Metrics capture token usage and +performance data. + +Note: ``.env`` file configures additional environment variables: + +- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures OpenTelemetry SDK to export logs and events. +- ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures OpenAI instrumentation to capture content on events. +- ``OTEL_LOGS_EXPORTER=otlp`` to specify exporter type. + +Setup +----- + +Minimally, update the ``.env`` file with your ``OPENAI_API_KEY``. An +OTLP compatible endpoint should be listening for traces and logs on +http://localhost:4317. If not, update ``OTEL_EXPORTER_OTLP_ENDPOINT`` as well. + +Next, set up a virtual environment like this: + +:: + + python3 -m venv .venv + source .venv/bin/activate + pip install "python-dotenv[cli]" + pip install -r requirements.txt + +Run +--- + +Run the example like this: + +:: + + dotenv run -- opentelemetry-instrument python main.py + +You should see response output printed while traces and metrics export to your +configured observability tool. diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py new file mode 100644 index 0000000000..c64fcc5114 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py @@ -0,0 +1,36 @@ +import os + +from openai import OpenAI + + +def main(): + client = OpenAI() + model = os.getenv("RESPONSES_MODEL", "gpt-4o-mini") + + response = client.responses.create( + model=model, + input="Write a short poem about OpenTelemetry.", + ) + + print("Responses.create") + print(f"Model: {response.model}") + print(f"Response ID: {response.id}") + print(f"Output text: {response.output_text}") + + print("\nResponses.stream") + with client.responses.stream( + model=model, + input="Write a short poem about OpenTelemetry.", + background=True, + ) as stream: + for event in stream: + if event.type == "response.output_text.delta": + print(event.delta, end="", flush=True) + if event.type == "response.completed": + print("\n") + print(f"Stream response ID: {event.response.id}") + break + + +if __name__ == "__main__": + main() diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt new file mode 100644 index 0000000000..5b6bbd3c5c --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt @@ -0,0 +1,6 @@ +openai~=1.57.3 + +opentelemetry-sdk~=1.36.0 +opentelemetry-exporter-otlp-proto-grpc~=1.36.0 +opentelemetry-distro~=0.57b0 +opentelemetry-instrumentation-openai-v2~=2.2b0 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index 4bb06574ba..eb727c6f69 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -59,6 +59,8 @@ async_embeddings_create, chat_completions_create, embeddings_create, + responses_create, + responses_stream, ) @@ -128,6 +130,22 @@ def _instrument(self, **kwargs): ), ) + wrap_function_wrapper( + module="openai.resources.responses.responses", + name="Responses.create", + wrapper=responses_create( + tracer, logger, instruments, is_content_enabled() + ), + ) + + wrap_function_wrapper( + module="openai.resources.responses.responses", + name="Responses.stream", + wrapper=responses_stream( + tracer, logger, instruments, is_content_enabled() + ), + ) + def _uninstrument(self, **kwargs): import openai # pylint: disable=import-outside-toplevel # noqa: PLC0415 @@ -135,3 +153,5 @@ def _uninstrument(self, **kwargs): unwrap(openai.resources.chat.completions.AsyncCompletions, "create") unwrap(openai.resources.embeddings.Embeddings, "create") unwrap(openai.resources.embeddings.AsyncEmbeddings, "create") + unwrap(openai.resources.responses.responses.Responses, "create") + unwrap(openai.resources.responses.responses.Responses, "stream") diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 31c0a84147..4717a54dd9 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -26,8 +26,12 @@ from opentelemetry.semconv._incubating.attributes import ( server_attributes as ServerAttributes, ) +from opentelemetry.semconv.attributes import ( + error_attributes as ErrorAttributes, +) from opentelemetry.trace import Span, SpanKind, Tracer from opentelemetry.trace.propagation import set_span_in_context +from opentelemetry.trace.status import Status, StatusCode from .instruments import Instruments from .utils import ( @@ -278,9 +282,158 @@ async def traced_method(wrapped, instance, args, kwargs): return traced_method +def responses_create( + tracer: Tracer, + logger: Logger, + instruments: Instruments, + capture_content: bool, +): + """Wrap the `create` method of the `Responses` class to trace it.""" + # TODO: Consider migrating Responses instrumentation to TelemetryHandler + # once content capture and streaming hooks are available. + + def traced_method(wrapped, instance, args, kwargs): + span_attributes = get_llm_request_attributes( + kwargs, + instance, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + span_name = _get_span_name(span_attributes) + streaming = is_streaming(kwargs) + + with tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + end_on_exit=False, + ) as span: + start = default_timer() + result = None + error_type = None + try: + result = wrapped(*args, **kwargs) + if hasattr(result, "parse"): + # result is of type LegacyAPIResponse, call parse to get the actual response + parsed_result = result.parse() + else: + parsed_result = result + + if streaming: + return ResponseStreamWrapper( + parsed_result, + span, + logger, + capture_content, + record_metrics=True, + instruments=instruments, + request_attributes=span_attributes, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + start_time=start, + ) + + if span.is_recording(): + _set_responses_response_attributes( + span, parsed_result, capture_content + ) + + span.end() + return result + + except Exception as error: + error_type = type(error).__qualname__ + handle_span_exception(span, error) + raise + finally: + if not streaming or result is None: + duration = max((default_timer() - start), 0) + _record_metrics( + instruments, + duration, + result, + span_attributes, + error_type, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + + return traced_method + + +def responses_stream( + tracer: Tracer, + logger: Logger, + instruments: Instruments, + capture_content: bool, +): + """Wrap the `stream` method of the `Responses` class to trace it.""" + + def traced_method(wrapped, instance, args, kwargs): + # If this is creating a new response, the create() wrapper will handle tracing. + if "response_id" not in kwargs and "starting_after" not in kwargs: + return wrapped(*args, **kwargs) + + span_attributes = get_llm_request_attributes( + {}, + instance, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + span_name = _get_span_name(span_attributes) + + with tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + end_on_exit=False, + ) as span: + error_type = None + try: + manager = wrapped(*args, **kwargs) + return ResponseStreamManagerWrapper( + manager, + lambda stream: ResponseStreamWrapper( + stream, + span, + logger, + capture_content, + record_metrics=True, + instruments=instruments, + request_attributes=span_attributes, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + start_time=default_timer(), + ), + ) + except Exception as error: + error_type = type(error).__qualname__ + handle_span_exception(span, error) + raise + finally: + if error_type is not None: + _record_metrics( + instruments, + 0, + None, + span_attributes, + error_type, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + + return traced_method + + +def _get_span_name(span_attributes): + """Get span name for LLM operations.""" + operation = span_attributes.get( + GenAIAttributes.GEN_AI_OPERATION_NAME, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + model = span_attributes.get( + GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown" + ) + return f"{operation} {model}" + + def _get_embeddings_span_name(span_attributes): """Get span name for embeddings operations.""" - return f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" + return _get_span_name(span_attributes) def _record_metrics( @@ -291,12 +444,13 @@ def _record_metrics( error_type: Optional[str], operation_name: str, ): + request_model = request_attributes.get( + GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown" + ) common_attributes = { GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name, GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.OPENAI.value, - GenAIAttributes.GEN_AI_REQUEST_MODEL: request_attributes[ - GenAIAttributes.GEN_AI_REQUEST_MODEL - ], + GenAIAttributes.GEN_AI_REQUEST_MODEL: request_model, } if "gen_ai.embeddings.dimension.count" in request_attributes: @@ -336,15 +490,24 @@ def _record_metrics( ) if result and getattr(result, "usage", None): + usage = result.usage + input_tokens = getattr(usage, "prompt_tokens", None) + if input_tokens is None: + input_tokens = getattr(usage, "input_tokens", None) + output_tokens = getattr(usage, "completion_tokens", None) + if output_tokens is None: + output_tokens = getattr(usage, "output_tokens", None) + # Always record input tokens input_attributes = { **common_attributes, GenAIAttributes.GEN_AI_TOKEN_TYPE: GenAIAttributes.GenAiTokenTypeValues.INPUT.value, } - instruments.token_usage_histogram.record( - result.usage.prompt_tokens, - attributes=input_attributes, - ) + if input_tokens is not None: + instruments.token_usage_histogram.record( + input_tokens, + attributes=input_attributes, + ) # For embeddings, don't record output tokens as all tokens are input tokens if ( @@ -355,9 +518,10 @@ def _record_metrics( **common_attributes, GenAIAttributes.GEN_AI_TOKEN_TYPE: GenAIAttributes.GenAiTokenTypeValues.COMPLETION.value, } - instruments.token_usage_histogram.record( - result.usage.completion_tokens, attributes=output_attributes - ) + if output_tokens is not None: + instruments.token_usage_histogram.record( + output_tokens, attributes=output_attributes + ) def _set_response_attributes( @@ -433,6 +597,48 @@ def _set_embeddings_response_attributes( # Don't set output tokens for embeddings as all tokens are input tokens +def _set_responses_response_attributes( + span: Span, + result: Any, + capture_content: bool, +): + if getattr(result, "model", None): + set_span_attribute( + span, GenAIAttributes.GEN_AI_RESPONSE_MODEL, result.model + ) + + if getattr(result, "id", None): + set_span_attribute(span, GenAIAttributes.GEN_AI_RESPONSE_ID, result.id) + + if getattr(result, "service_tier", None): + set_span_attribute( + span, + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, + result.service_tier, + ) + + if getattr(result, "usage", None): + input_tokens = getattr(result.usage, "input_tokens", None) + if input_tokens is None: + input_tokens = getattr(result.usage, "prompt_tokens", None) + if input_tokens is not None: + set_span_attribute( + span, + GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, + input_tokens, + ) + + output_tokens = getattr(result.usage, "output_tokens", None) + if output_tokens is None: + output_tokens = getattr(result.usage, "completion_tokens", None) + if output_tokens is not None: + set_span_attribute( + span, + GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, + output_tokens, + ) + + class ToolCallBuffer: def __init__(self, index, tool_call_id, function_name): self.index = index @@ -705,3 +911,219 @@ def process_chunk(self, chunk): def parse(self): """Called when using with_raw_response with stream=True""" return self + + +class _ResponseProxy: + def __init__(self, response, finalize): + self._response = response + self._finalize = finalize + + def close(self): + try: + self._response.close() + finally: + self._finalize(None, None) + + def __getattr__(self, name): + return getattr(self._response, name) + + +class ResponseStreamWrapper: + def __init__( + self, + stream: Any, + span: Span, + logger: Logger, + capture_content: bool, + *, + record_metrics: bool, + instruments: Instruments, + request_attributes: dict, + operation_name: str, + start_time: Optional[float] = None, + ): + self.stream = stream + self.span = span + self.logger = logger + self.capture_content = capture_content + self.record_metrics = record_metrics + self.instruments = instruments + self.request_attributes = request_attributes + self.operation_name = operation_name + self.start_time = ( + start_time if start_time is not None else default_timer() + ) + self._span_ended = False + self._span_name_updated = False + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + try: + if exc_type is not None: + self._handle_exception(exc_val) + finally: + self.close() + return False # Propagate the exception + + def close(self): + if hasattr(self.stream, "close"): + self.stream.close() + self._finalize(None, None) + + def __iter__(self): + return self + + def __next__(self): + try: + event = next(self.stream) + self.process_event(event) + return event + except StopIteration: + self._finalize(None, None) + raise + except Exception as error: + self._handle_exception(error) + raise + + def get_final_response(self): + if not hasattr(self.stream, "get_final_response"): + raise AttributeError("get_final_response is not available") + self.until_done() + return self.stream.get_final_response() + + def until_done(self): + for _ in self: + pass + return self + + def parse(self): + """Called when using with_raw_response with stream=True""" + return self + + def __getattr__(self, name): + return getattr(self.stream, name) + + @property + def response(self): + response = getattr(self.stream, "response", None) + if response is None: + return None + return _ResponseProxy(response, self._finalize) + + def _handle_exception(self, error): + if self._span_ended: + return + handle_span_exception(self.span, error) + self._span_ended = True + self._record_metrics(None, type(error).__qualname__) + + def _mark_span_error(self, error_type: str, message: str): + self.span.set_status(Status(StatusCode.ERROR, message)) + if self.span.is_recording() and error_type: + self.span.set_attribute(ErrorAttributes.ERROR_TYPE, error_type) + + def _record_metrics(self, result, error_type: Optional[str]): + if not self.record_metrics: + return + duration = max((default_timer() - self.start_time), 0) + _record_metrics( + self.instruments, + duration, + result, + self.request_attributes, + error_type, + self.operation_name, + ) + + def _finalize( + self, + result, + error_type: Optional[str], + error_message: Optional[str] = None, + ): + if self._span_ended: + return + if result and self.span.is_recording(): + _set_responses_response_attributes( + self.span, result, self.capture_content + ) + if error_type: + self._mark_span_error(error_type, error_message or error_type) + self.span.end() + self._span_ended = True + self._record_metrics(result, error_type) + + def _maybe_update_request_model(self, response): + if ( + response + and GenAIAttributes.GEN_AI_REQUEST_MODEL + not in self.request_attributes + and getattr(response, "model", None) + ): + self.request_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( + response.model + ) + if self.span.is_recording(): + set_span_attribute( + self.span, + GenAIAttributes.GEN_AI_REQUEST_MODEL, + response.model, + ) + if not self._span_name_updated and hasattr( + self.span, "update_name" + ): + self.span.update_name( + f"{self.operation_name} {response.model}" + ) + self._span_name_updated = True + + def process_event(self, event): + event_type = getattr(event, "type", None) + if event_type in {"response.created", "response.completed"}: + response = getattr(event, "response", None) + self._maybe_update_request_model(response) + if response and self.span.is_recording(): + _set_responses_response_attributes( + self.span, response, self.capture_content + ) + if event_type == "response.completed": + self._finalize(response, None) + return + + if event_type in {"response.failed", "response.incomplete"}: + response = getattr(event, "response", None) + self._maybe_update_request_model(response) + if response and self.span.is_recording(): + _set_responses_response_attributes( + self.span, response, self.capture_content + ) + self._finalize(response, event_type) + return + + if event_type == "error": + error_type = getattr(event, "code", None) or "response.error" + message = getattr(event, "message", None) or error_type + self._finalize(None, error_type, message) + return + + +class ResponseStreamManagerWrapper: + def __init__(self, manager, wrapper_factory): + self._manager = manager + self._wrapper_factory = wrapper_factory + self._stream = None + + def __enter__(self): + stream = self._manager.__enter__() + self._stream = self._wrapper_factory(stream) + return self._stream + + def __exit__(self, exc_type, exc_val, exc_tb): + if self._stream is not None: + return self._stream.__exit__(exc_type, exc_val, exc_tb) + return self._manager.__exit__(exc_type, exc_val, exc_tb) + + def __getattr__(self, name): + return getattr(self._manager, name) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index 6e3ebad2ed..5b60d1737c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -202,8 +202,11 @@ def get_llm_request_attributes( GenAIAttributes.GEN_AI_REQUEST_MODEL: kwargs.get("model"), } - # Add chat-specific attributes only for chat operations - if operation_name == GenAIAttributes.GenAiOperationNameValues.CHAT.value: + # Add chat-like attributes for chat and generate-content operations + if operation_name in ( + GenAIAttributes.GenAiOperationNameValues.CHAT.value, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ): attributes.update( { GenAIAttributes.GEN_AI_REQUEST_TEMPERATURE: kwargs.get( @@ -213,7 +216,8 @@ def get_llm_request_attributes( or kwargs.get("top_p"), GenAIAttributes.GEN_AI_REQUEST_MAX_TOKENS: kwargs.get( "max_tokens" - ), + ) + or kwargs.get("max_output_tokens"), GenAIAttributes.GEN_AI_REQUEST_PRESENCE_PENALTY: kwargs.get( "presence_penalty" ), diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml new file mode 100644 index 0000000000..f824fdede5 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -0,0 +1,500 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0b1b70a6d91f11da0069841dceb95081949165d050fe8f1c35", + "object": "response", + "created_at": 1770266062, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770266063, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0b1b70a6d91f11da0069841dcf11a481948bdee40b06bf8983", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test. How can I assist you further?" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 13, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 25 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9c8fb1ebbf93436f-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 05 Feb 2026 04:34:23 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1573' + openai-organization: test_openai_org_id + openai-processing-ms: + - '605' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_b30645d3740b4d31ac6c998c158607bd + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '72' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.109.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.109.1 + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.9.6 + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_029f99a286f1ea040069841e50fa0081a38a4e13b98c6d2e3f", + "object": "response", + "created_at": 1770266192, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770266193, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_029f99a286f1ea040069841e51762481a398200772dad9885c", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9c8fb519cbb151ba-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 05 Feb 2026 04:36:33 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '659' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-ratelimit-limit-requests: + - '200' + x-ratelimit-limit-tokens: + - '60000' + x-ratelimit-remaining-requests: + - '199' + x-ratelimit-remaining-tokens: + - '59969' + x-ratelimit-reset-requests: + - 7m12s + x-ratelimit-reset-tokens: + - 31ms + x-request-id: + - req_676e53bd4f8c4770bb6a82a40743c6da + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '72' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.109.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.109.1 + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.9.6 + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_09edbd762bdb54ff0069841ed6c32c8193982e6c6b188159d2", + "object": "response", + "created_at": 1770266326, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770266327, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_09edbd762bdb54ff0069841ed779b08193bcc0dc18a78e1d55", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9c8fb85dfbe78df5-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 05 Feb 2026 04:38:47 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '910' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9963' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 5m15.516s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_36116ec88c4c4adab17e46d22be27cfc + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml new file mode 100644 index 0000000000..d7d5d4fb57 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -0,0 +1,482 @@ +interactions: +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","object":"response","created_at":1770266065,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","object":"response","created_at":1770266065,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770266067}} + + headers: + CF-RAY: + - 9c8fb1fde8b427f6-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:34:26 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '877' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_787c4623a2ca4b899c454b3ecc257759 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770266067}} + + headers: + CF-RAY: + - 9c8fb21d58856a5f-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:34:31 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '555' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_98b5179282b74830a461e6db0ee096bb + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '91' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.109.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.109.1 + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.9.6 + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","object":"response","created_at":1770266328,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","object":"response","created_at":1770266328,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770266330}} + + headers: + CF-RAY: + - 9c8fb86b8fe68456-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:38:49 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '696' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_351e924fb4374959998decf735ed370d + status: + code: 200 + message: OK +- request: + body: '' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + cookie: + - test_cookie + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.109.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.109.1 + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.9.6 + method: GET + uri: https://api.openai.com/v1/responses/resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770266330}} + + headers: + CF-RAY: + - 9c8fb8894b0b8456-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:38:54 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '534' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_886c229a9e304030bb9ffb59380074de + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml new file mode 100644 index 0000000000..2c1efc5ab8 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -0,0 +1,362 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0248c38c3ffac6050069841dd01dac8190af681597b03c5c71","object":"response","created_at":1770266064,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0248c38c3ffac6050069841dd01dac8190af681597b03c5c71","object":"response","created_at":1770266064,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"R0rjCLsAoGyt","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"FUpwiz7MqEtNm","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"W8mwermkTX9NT5","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"veeIiLYpsZC","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"ozfhGdt1xZTOoGk","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0248c38c3ffac6050069841dd01dac8190af681597b03c5c71","object":"response","created_at":1770266064,"status":"completed","background":false,"completed_at":1770266065,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9c8fb1f0fdcd3e9d-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:34:24 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '119' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_b03595fe90914538bcbf04edc0d0b182 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '71' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.109.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.109.1 + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.9.6 + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0c116b3a90990d180069841e51f114819c89e0abbefcb49e9f","object":"response","created_at":1770266193,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0c116b3a90990d180069841e51f114819c89e0abbefcb49e9f","object":"response","created_at":1770266193,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"BQ0VZyX99IHQ","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"rkyhZBvjbt1BG","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"UGQf2uwGMhgYAh","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"TIsiH5ms9qW","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"5pSTap0E4JD7LAG","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0c116b3a90990d180069841e51f114819c89e0abbefcb49e9f","object":"response","created_at":1770266193,"status":"completed","background":false,"completed_at":1770266194,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9c8fb51fe834fef2-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:36:34 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '57' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_11212912366042b999af13099863b3c1 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - Bearer test_openai_api_key + connection: + - keep-alive + content-length: + - '71' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.109.1 + x-stainless-arch: + - arm64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - MacOS + x-stainless-package-version: + - 1.109.1 + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.9.6 + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_003dd6c772a28cfb0069841ed7fbb4819397bfc639f41c322b","object":"response","created_at":1770266328,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_003dd6c772a28cfb0069841ed7fbb4819397bfc639f41c322b","object":"response","created_at":1770266328,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"CvtmfQYtDveH","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"V1Kja1dttDNCV","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"IgSeetEXJTkPrM","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"wsC1P31fEa4","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"kAipRvsdTVL5eoN","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_003dd6c772a28cfb0069841ed7fbb4819397bfc639f41c322b","object":"response","created_at":1770266328,"status":"completed","background":false,"completed_at":1770266328,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9c8fb8659930c451-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 05 Feb 2026 04:38:48 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '59' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_d0c865518dea41eaae1c33b0e0dab6ca + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py new file mode 100644 index 0000000000..45cfc6a00d --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -0,0 +1,144 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pytest + +from opentelemetry.semconv._incubating.attributes import ( + gen_ai_attributes as GenAIAttributes, +) + +from .test_utils import assert_all_attributes + + +@pytest.mark.vcr() +def test_responses_create( + span_exporter, openai_client, instrument_with_content +): + response = openai_client.responses.create( + model="gpt-4o-mini", + input="Say this is a test", + stream=False, + ) + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + + input_tokens = response.usage.input_tokens if response.usage else None + output_tokens = response.usage.output_tokens if response.usage else None + + assert_all_attributes( + spans[0], + "gpt-4o-mini", + response.id, + response.model, + input_tokens, + output_tokens, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + response_service_tier=response.service_tier, + ) + + +@pytest.mark.vcr() +def test_responses_stream_new_response( + span_exporter, openai_client, instrument_with_content +): + with openai_client.responses.stream( + model="gpt-4o-mini", + input="Say this is a test", + ) as stream: + final_response = None + for event in stream: + if event.type == "response.completed": + final_response = event.response + break + + assert final_response is not None + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + + input_tokens = ( + final_response.usage.input_tokens if final_response.usage else None + ) + output_tokens = ( + final_response.usage.output_tokens if final_response.usage else None + ) + + assert_all_attributes( + spans[0], + "gpt-4o-mini", + final_response.id, + final_response.model, + input_tokens, + output_tokens, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + response_service_tier=final_response.service_tier, + ) + + +@pytest.mark.vcr() +def test_responses_stream_existing_response( + span_exporter, openai_client, instrument_with_content +): + response_id = None + starting_after = None + + with openai_client.responses.stream( + model="gpt-4o-mini", + input="Say this is a test", + background=True, + ) as stream: + for event in stream: + if event.type == "response.created": + response_id = event.response.id + starting_after = event.sequence_number + if response_id is not None and starting_after is not None: + break + + assert response_id is not None + assert starting_after is not None + span_count = len(span_exporter.get_finished_spans()) + + with openai_client.responses.stream( + response_id=response_id, + starting_after=starting_after, + ) as stream: + final_response = None + for event in stream: + if event.type == "response.completed": + final_response = event.response + break + + assert final_response is not None + + spans = span_exporter.get_finished_spans() + assert len(spans) == span_count + 1 + + input_tokens = ( + final_response.usage.input_tokens if final_response.usage else None + ) + output_tokens = ( + final_response.usage.output_tokens if final_response.usage else None + ) + + assert_all_attributes( + spans[-1], + final_response.model, + final_response.id, + final_response.model, + input_tokens, + output_tokens, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + response_service_tier=final_response.service_tier, + ) From 2e568bb965403b56d26580fbb449378410716630 Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 5 Feb 2026 00:57:12 -0500 Subject: [PATCH 02/20] Add support for OpenAI Responses API instrumentation in CHANGELOG.md --- .../opentelemetry-instrumentation-openai-v2/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md index 64da947791..29080a0a93 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Add support for OpenAI Responses API instrumentation + ([#4166](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4166)) + ## Version 2.3b0 (2025-12-24) - Fix `AttributeError` when handling `LegacyAPIResponse` (from `with_raw_response`) From 0f670d95277f4a76f3fc62fdb11d1a2c5f623083 Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 5 Feb 2026 01:14:17 -0500 Subject: [PATCH 03/20] Enhance OpenAI Responses API instrumentation with version checks - Updated the OpenAIInstrumentor to conditionally wrap and unwrap the Responses API methods based on the installed OpenAI package version (>=1.66.0). - Added version checks in the test suite to skip tests if the Responses API is not available, ensuring compatibility with earlier versions of the OpenAI library. - Improved error handling for missing API methods to prevent runtime exceptions. --- .../instrumentation/openai_v2/__init__.py | 47 ++++++++++++------- .../tests/test_responses.py | 14 ++++++ 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index eb727c6f69..e236a5888c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -130,21 +130,27 @@ def _instrument(self, **kwargs): ), ) - wrap_function_wrapper( - module="openai.resources.responses.responses", - name="Responses.create", - wrapper=responses_create( - tracer, logger, instruments, is_content_enabled() - ), - ) - - wrap_function_wrapper( - module="openai.resources.responses.responses", - name="Responses.stream", - wrapper=responses_stream( - tracer, logger, instruments, is_content_enabled() - ), - ) + # Responses API is only available in openai>=1.66.0 + # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 + try: + wrap_function_wrapper( + module="openai.resources.responses.responses", + name="Responses.create", + wrapper=responses_create( + tracer, logger, instruments, is_content_enabled() + ), + ) + + wrap_function_wrapper( + module="openai.resources.responses.responses", + name="Responses.stream", + wrapper=responses_stream( + tracer, logger, instruments, is_content_enabled() + ), + ) + except ModuleNotFoundError: + # Responses API not available in this version of openai + pass def _uninstrument(self, **kwargs): import openai # pylint: disable=import-outside-toplevel # noqa: PLC0415 @@ -153,5 +159,12 @@ def _uninstrument(self, **kwargs): unwrap(openai.resources.chat.completions.AsyncCompletions, "create") unwrap(openai.resources.embeddings.Embeddings, "create") unwrap(openai.resources.embeddings.AsyncEmbeddings, "create") - unwrap(openai.resources.responses.responses.Responses, "create") - unwrap(openai.resources.responses.responses.Responses, "stream") + + # Responses API is only available in openai>=1.66.0 + # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 + try: + unwrap(openai.resources.responses.responses.Responses, "create") + unwrap(openai.resources.responses.responses.Responses, "stream") + except (AttributeError, ModuleNotFoundError): + # Responses API not available in this version of openai + pass diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index 45cfc6a00d..6d1bcd2884 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import openai import pytest +from packaging.version import Version from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, @@ -20,7 +22,17 @@ from .test_utils import assert_all_attributes +# The Responses API was introduced in openai>=1.66.0 +# https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 +OPENAI_VERSION = Version(openai.__version__) +RESPONSES_API_MIN_VERSION = Version("1.66.0") +skip_if_no_responses_api = pytest.mark.skipif( + OPENAI_VERSION < RESPONSES_API_MIN_VERSION, + reason=f"Responses API requires openai >= {RESPONSES_API_MIN_VERSION}, got {OPENAI_VERSION}", +) + +@skip_if_no_responses_api @pytest.mark.vcr() def test_responses_create( span_exporter, openai_client, instrument_with_content @@ -49,6 +61,7 @@ def test_responses_create( ) +@skip_if_no_responses_api @pytest.mark.vcr() def test_responses_stream_new_response( span_exporter, openai_client, instrument_with_content @@ -87,6 +100,7 @@ def test_responses_stream_new_response( ) +@skip_if_no_responses_api @pytest.mark.vcr() def test_responses_stream_existing_response( span_exporter, openai_client, instrument_with_content From 8987864e0b7d0cce4dc8b9673b4e7ef625aa4496 Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 5 Feb 2026 01:17:53 -0500 Subject: [PATCH 04/20] Refactor OpenAI instrumentation code and add comments for clarity - Added pylint disable comments to suppress warnings for specific lines in the Responses API example and patch files. - Updated the `responses_create` and `responses_stream` methods with links to relevant OpenAI documentation for better reference. - Improved code formatting for readability by adjusting line breaks and indentation in the patch file. --- .../examples/responses/main.py | 3 +++ .../instrumentation/openai_v2/patch.py | 25 ++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py index c64fcc5114..69d3bf4100 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py @@ -1,3 +1,6 @@ +# pylint: disable=no-member +# The responses API is only available in openai>=1.66.0 +# https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 import os from openai import OpenAI diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 4717a54dd9..4a02c42900 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=too-many-lines from timeit import default_timer from typing import Any, Optional @@ -30,8 +31,8 @@ error_attributes as ErrorAttributes, ) from opentelemetry.trace import Span, SpanKind, Tracer -from opentelemetry.trace.propagation import set_span_in_context from opentelemetry.trace.status import Status, StatusCode +from opentelemetry.trace.propagation import set_span_in_context from .instruments import Instruments from .utils import ( @@ -289,6 +290,7 @@ def responses_create( capture_content: bool, ): """Wrap the `create` method of the `Responses` class to trace it.""" + # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L828 # TODO: Consider migrating Responses instrumentation to TelemetryHandler # once content capture and streaming hooks are available. @@ -365,6 +367,7 @@ def responses_stream( capture_content: bool, ): """Wrap the `stream` method of the `Responses` class to trace it.""" + # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L966 def traced_method(wrapped, instance, args, kwargs): # If this is creating a new response, the create() wrapper will handle tracing. @@ -425,9 +428,7 @@ def _get_span_name(span_attributes): GenAIAttributes.GEN_AI_OPERATION_NAME, GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, ) - model = span_attributes.get( - GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown" - ) + model = span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown") return f"{operation} {model}" @@ -436,7 +437,7 @@ def _get_embeddings_span_name(span_attributes): return _get_span_name(span_attributes) -def _record_metrics( +def _record_metrics( # pylint: disable=too-many-branches instruments: Instruments, duration: float, result, @@ -950,9 +951,7 @@ def __init__( self.instruments = instruments self.request_attributes = request_attributes self.operation_name = operation_name - self.start_time = ( - start_time if start_time is not None else default_timer() - ) + self.start_time = start_time if start_time is not None else default_timer() self._span_ended = False self._span_name_updated = False @@ -1062,18 +1061,16 @@ def _maybe_update_request_model(self, response): not in self.request_attributes and getattr(response, "model", None) ): - self.request_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( - response.model - ) + self.request_attributes[ + GenAIAttributes.GEN_AI_REQUEST_MODEL + ] = response.model if self.span.is_recording(): set_span_attribute( self.span, GenAIAttributes.GEN_AI_REQUEST_MODEL, response.model, ) - if not self._span_name_updated and hasattr( - self.span, "update_name" - ): + if not self._span_name_updated and hasattr(self.span, "update_name"): self.span.update_name( f"{self.operation_name} {response.model}" ) From 02a80cd0c8ae4d2d7661a63c44a26fae9b3af3c2 Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 5 Feb 2026 01:21:34 -0500 Subject: [PATCH 05/20] Refactor OpenAI instrumentation code for improved readability - Reformatted code in the patch file to enhance readability by adjusting line breaks and indentation. - Ensured consistent style for model retrieval and span name updates in the ResponseStreamWrapper class. - Minor adjustments to import statements for clarity and organization. --- .../instrumentation/openai_v2/patch.py | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 4a02c42900..50146c6a24 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -31,8 +31,8 @@ error_attributes as ErrorAttributes, ) from opentelemetry.trace import Span, SpanKind, Tracer -from opentelemetry.trace.status import Status, StatusCode from opentelemetry.trace.propagation import set_span_in_context +from opentelemetry.trace.status import Status, StatusCode from .instruments import Instruments from .utils import ( @@ -428,7 +428,9 @@ def _get_span_name(span_attributes): GenAIAttributes.GEN_AI_OPERATION_NAME, GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, ) - model = span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown") + model = span_attributes.get( + GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown" + ) return f"{operation} {model}" @@ -951,7 +953,9 @@ def __init__( self.instruments = instruments self.request_attributes = request_attributes self.operation_name = operation_name - self.start_time = start_time if start_time is not None else default_timer() + self.start_time = ( + start_time if start_time is not None else default_timer() + ) self._span_ended = False self._span_name_updated = False @@ -1061,16 +1065,18 @@ def _maybe_update_request_model(self, response): not in self.request_attributes and getattr(response, "model", None) ): - self.request_attributes[ - GenAIAttributes.GEN_AI_REQUEST_MODEL - ] = response.model + self.request_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( + response.model + ) if self.span.is_recording(): set_span_attribute( self.span, GenAIAttributes.GEN_AI_REQUEST_MODEL, response.model, ) - if not self._span_name_updated and hasattr(self.span, "update_name"): + if not self._span_name_updated and hasattr( + self.span, "update_name" + ): self.span.update_name( f"{self.operation_name} {response.model}" ) From 88c790877d621a900829bd2799725c34f656e8fe Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 5 Feb 2026 22:59:15 -0500 Subject: [PATCH 06/20] Update OpenAI package version and refactor span name retrieval - Updated the OpenAI package version in requirements.txt to 1.66.0 for compatibility. - Refactored span name retrieval in the patch.py file to directly format the span name using operation and model attributes, removing the redundant _get_span_name function. - Improved code clarity and consistency in the responses_create and responses_stream methods. --- .../examples/responses/requirements.txt | 2 +- .../instrumentation/openai_v2/patch.py | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt index 5b6bbd3c5c..aff4f2e81e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt @@ -1,4 +1,4 @@ -openai~=1.57.3 +openai~=1.66.0 opentelemetry-sdk~=1.36.0 opentelemetry-exporter-otlp-proto-grpc~=1.36.0 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 50146c6a24..dfb6804076 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -300,7 +300,7 @@ def traced_method(wrapped, instance, args, kwargs): instance, GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, ) - span_name = _get_span_name(span_attributes) + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" streaming = is_streaming(kwargs) with tracer.start_as_current_span( @@ -379,7 +379,7 @@ def traced_method(wrapped, instance, args, kwargs): instance, GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, ) - span_name = _get_span_name(span_attributes) + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" with tracer.start_as_current_span( name=span_name, @@ -422,21 +422,9 @@ def traced_method(wrapped, instance, args, kwargs): return traced_method -def _get_span_name(span_attributes): - """Get span name for LLM operations.""" - operation = span_attributes.get( - GenAIAttributes.GEN_AI_OPERATION_NAME, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - model = span_attributes.get( - GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown" - ) - return f"{operation} {model}" - - def _get_embeddings_span_name(span_attributes): """Get span name for embeddings operations.""" - return _get_span_name(span_attributes) + return f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" def _record_metrics( # pylint: disable=too-many-branches From 65ee9c07b3f1db120f9b54e726c8a965023358ca Mon Sep 17 00:00:00 2001 From: Teja Date: Sat, 7 Feb 2026 16:29:29 -0500 Subject: [PATCH 07/20] Enhance OpenAI instrumentation with improved span name handling and comments - Added a comment in the `responses_stream` method to clarify the purpose of avoiding duplicate span creation. - Updated span name retrieval to use a default value of 'unknown' for the model attribute if not present, improving robustness. - Refactored the `_record_metrics` function to directly access the request model from attributes, enhancing clarity and consistency. --- .../opentelemetry/instrumentation/openai_v2/patch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index dfb6804076..add8be0fc4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -371,6 +371,7 @@ def responses_stream( def traced_method(wrapped, instance, args, kwargs): # If this is creating a new response, the create() wrapper will handle tracing. + # This is done to avoid duplicate span creation. https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1036 if "response_id" not in kwargs and "starting_after" not in kwargs: return wrapped(*args, **kwargs) @@ -379,7 +380,7 @@ def traced_method(wrapped, instance, args, kwargs): instance, GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" with tracer.start_as_current_span( name=span_name, @@ -435,13 +436,12 @@ def _record_metrics( # pylint: disable=too-many-branches error_type: Optional[str], operation_name: str, ): - request_model = request_attributes.get( - GenAIAttributes.GEN_AI_REQUEST_MODEL, "unknown" - ) common_attributes = { GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name, GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.OPENAI.value, - GenAIAttributes.GEN_AI_REQUEST_MODEL: request_model, + GenAIAttributes.GEN_AI_REQUEST_MODEL: request_attributes[ + GenAIAttributes.GEN_AI_REQUEST_MODEL + ], } if "gen_ai.embeddings.dimension.count" in request_attributes: From 9bbdd62cb955113b395ead8b37c9225b71b057a1 Mon Sep 17 00:00:00 2001 From: Teja Date: Mon, 9 Feb 2026 18:58:52 -0500 Subject: [PATCH 08/20] Implement tracing for OpenAI Responses.retrieve method - Added a new wrapper function `responses_retrieve` to trace the `retrieve` method of the `Responses` class, enhancing observability. - Updated the `OpenAIInstrumentor` to include the new tracing functionality for the `retrieve` method. - Enhanced test coverage for the `retrieve` method, including new test cases for both standard and streaming responses. - Added new YAML cassettes to support the updated tests for the `retrieve` functionality. --- .../instrumentation/openai_v2/__init__.py | 12 +- .../instrumentation/openai_v2/patch.py | 103 +- .../cassettes/test_responses_create.yaml | 510 +++++++++ .../cassettes/test_responses_retrieve.yaml | 965 ++++++++++++++++++ ...ses_retrieve_stream_existing_response.yaml | 779 ++++++++++++++ ...st_responses_stream_existing_response.yaml | 744 ++++++++++++++ .../test_responses_stream_new_response.yaml | 393 +++++++ .../tests/test_responses.py | 133 ++- 8 files changed, 3634 insertions(+), 5 deletions(-) create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index e236a5888c..89def46b89 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -60,6 +60,7 @@ chat_completions_create, embeddings_create, responses_create, + responses_retrieve, responses_stream, ) @@ -148,7 +149,15 @@ def _instrument(self, **kwargs): tracer, logger, instruments, is_content_enabled() ), ) - except ModuleNotFoundError: + + wrap_function_wrapper( + module="openai.resources.responses.responses", + name="Responses.retrieve", + wrapper=responses_retrieve( + tracer, logger, instruments, is_content_enabled() + ), + ) + except (AttributeError, ModuleNotFoundError): # Responses API not available in this version of openai pass @@ -165,6 +174,7 @@ def _uninstrument(self, **kwargs): try: unwrap(openai.resources.responses.responses.Responses, "create") unwrap(openai.resources.responses.responses.Responses, "stream") + unwrap(openai.resources.responses.responses.Responses, "retrieve") except (AttributeError, ModuleNotFoundError): # Responses API not available in this version of openai pass diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index add8be0fc4..0889411fc4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -423,6 +423,102 @@ def traced_method(wrapped, instance, args, kwargs): return traced_method +def responses_retrieve( + tracer: Tracer, + logger: Logger, + instruments: Instruments, + capture_content: bool, +): + """Wrap the `retrieve` method of the `Responses` class to trace it.""" + retrieval_enum = getattr( + GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None + ) + operation_name = retrieval_enum.value if retrieval_enum else "retrieval" + + def traced_method(wrapped, instance, args, kwargs): + span_attributes = get_llm_request_attributes( + {}, + instance, + operation_name, + ) + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" + streaming = is_streaming(kwargs) + + with tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + end_on_exit=False, + ) as span: + start = default_timer() + result = None + error_type = None + try: + result = wrapped(*args, **kwargs) + if hasattr(result, "parse"): + parsed_result = result.parse() + else: + parsed_result = result + + if streaming: + return ResponseStreamWrapper( + parsed_result, + span, + logger, + capture_content, + record_metrics=True, + instruments=instruments, + request_attributes=span_attributes, + operation_name=operation_name, + start_time=start, + ) + + if ( + GenAIAttributes.GEN_AI_REQUEST_MODEL + not in span_attributes + and getattr(parsed_result, "model", None) + ): + span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( + parsed_result.model + ) + if span.is_recording(): + set_span_attribute( + span, + GenAIAttributes.GEN_AI_REQUEST_MODEL, + parsed_result.model, + ) + if hasattr(span, "update_name"): + span.update_name( + f"{operation_name} {parsed_result.model}" + ) + + if span.is_recording(): + _set_responses_response_attributes( + span, parsed_result, capture_content + ) + + span.end() + return result + + except Exception as error: + error_type = type(error).__qualname__ + handle_span_exception(span, error) + raise + finally: + if not streaming or result is None: + duration = max((default_timer() - start), 0) + _record_metrics( + instruments, + duration, + result, + span_attributes, + error_type, + operation_name, + ) + + return traced_method + + def _get_embeddings_span_name(span_attributes): """Get span name for embeddings operations.""" return f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" @@ -439,10 +535,11 @@ def _record_metrics( # pylint: disable=too-many-branches common_attributes = { GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name, GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.OPENAI.value, - GenAIAttributes.GEN_AI_REQUEST_MODEL: request_attributes[ - GenAIAttributes.GEN_AI_REQUEST_MODEL - ], } + if request_model := request_attributes.get( + GenAIAttributes.GEN_AI_REQUEST_MODEL + ): + common_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = request_model if "gen_ai.embeddings.dimension.count" in request_attributes: common_attributes["gen_ai.embeddings.dimension.count"] = ( diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index f824fdede5..5a7fb485a2 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -497,4 +497,514 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_05c57262f43718d1006989e158bca88195adf66f24f30e1873", + "object": "response", + "created_at": 1770643800, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770643801, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_05c57262f43718d1006989e159a14c8195833f0325056cb25c", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3b803f8cf187f-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:30:01 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1119' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=yYN9OhPtOTNDXZ7PAgbMN55jQD6enH260TMCT4O31MU-1770643799.6738563-1.0.1.1-ak0XllYGcXlqKOWWW8we3uhfDon48xF5Qs.UMtekewHY4XM91.OqJAjNtM6t0gVCXn_USW7rWqvD9LF1treKLJKJ4TbjCw.m5adAcnGVOgoHRTwlD7hIvWL1v643wmyj; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:01 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_1ece7d17a31847bb9d346cc7703044a4 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0045ca85f1f0f66a006989e2f015548196aa0850ea7d894061", + "object": "response", + "created_at": 1770644208, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770644209, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0045ca85f1f0f66a006989e2f0fdd48196bb9ccadfe941795e", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test!" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3c1f88eca1325-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:36:49 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1068' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=6DEosT5G.YYiJ4sRm.eesC0PDSQ69w1UsqpfNSEds04-1770644207.4421477-1.0.1.1-182TAXB7kODeUjVY8_HVkxudBab48tlIKrMlIr075WJvsQ55BcFM4T.IVN7R70Eaw40HIqiL7W3H.9CYFXaKrhWVG5QxU3G4CYn6o87WAu3AzpolDMlN6XFeMlYlyqGe; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:06:49 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_3373b0ec8435486e80e359c53bece0bd + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_09ffefdabc58dfa3006989e752d0388194a0a3508d358da156", + "object": "response", + "created_at": 1770645330, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770645331, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_09ffefdabc58dfa3006989e75366dc8194af6c540481183eb1", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3dd654f4af4d7-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:55:31 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '760' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ncyRcnHSHBZCymvuIKVeWZW6cmjitBWjVw6Wq.GNKSY-1770645330.7677965-1.0.1.1-CW7sPX00Wn_NNdmRB6OKxI9e6AC6CI6MLL0gXFrRd7DmrfOFgVdGSVNhYAd9B3eqWUXPU3aVvbB2XsH72lWrRs9_BJjGi_bjmj.U4hMpuLLi5Az42YLZZCM_M5ChV7gV; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:31 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_e2451b6f2f5841c3b3b92f2cfc24cc5a + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml new file mode 100644 index 0000000000..1684a08511 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -0,0 +1,965 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0deb4578b1ea0c09006989e164cc848196a8fe5c4dc957cbbb", + "object": "response", + "created_at": 1770643812, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770643813, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0deb4578b1ea0c09006989e165ac788196839d7f3837c04090", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3b855c859b547-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:30:13 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1029' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=pIcQAIMC8MUVfpXdPlIjq4fTiDuezIFZvzziXp1Rs4M-1770643812.764382-1.0.1.1-NEgiKilvlEFpWKu.MMAGwyA1mERdnaMR5I6KX7g_PzLXyRx3mtIUMFWN5rRYJzm.GPufBfa0rkUJ95hb5IsHrMiICM4hRPklRPgwTCoaOO1JBwLLJ9GUzqnibXgQbGUo; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:13 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 22.615s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_9bbc4bd4010f421a83aad23471fa0f9a + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0deb4578b1ea0c09006989e164cc848196a8fe5c4dc957cbbb + response: + body: + string: |- + { + "id": "resp_0deb4578b1ea0c09006989e164cc848196a8fe5c4dc957cbbb", + "object": "response", + "created_at": 1770643812, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770643813, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0deb4578b1ea0c09006989e165ac788196839d7f3837c04090", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3b85d7eb54243-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:30:14 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '169' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Ruc_aRSy487JW7wSxFlF896ZwWg4htfukl8b1y_a6Wk-1770643813.9922419-1.0.1.1-blfwDmS3yTE1WZ6Z0gl4EmBHSfxIjXw053bek.KD3eHVotcWcP8tAeznha71ljnbbT0RngX1MXcSxI26h8lSxognfwJMRqICqiyC3sEI7m6reLFhzCGaTIEns5km7Y7p; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:14 GMT + x-request-id: + - req_057fdfe719624005ae5dbc7da7c703c5 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_053b3f93be7d6ffc006989e2fa2fec81a3b2a497b161dc5efd", + "object": "response", + "created_at": 1770644218, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770644218, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_053b3f93be7d6ffc006989e2fa72a081a39d8eab61e86e2a77", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3c23b7c24f21e-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:36:58 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '412' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=SFOcKcjNEDpzoUmfIKDJd.15lnCtbOfXanUR7wLHoGw-1770644218.1567044-1.0.1.1-JDhjei9N4r1s0dsfPYtGAhye9Sx_vhzxOgiiV_efx7T5JDhFZjrh.g3QzhC1TuMrg5MzUTlD0vcrVyn7qbJTk8UNPqx7lIT6wH7WZtgFGUtZN9P.rWf5hP4MDqIGrt5z; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:06:58 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 25.059s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_7fe7e6d2616041f49756c26bf5efea08 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_053b3f93be7d6ffc006989e2fa2fec81a3b2a497b161dc5efd + response: + body: + string: |- + { + "id": "resp_053b3f93be7d6ffc006989e2fa2fec81a3b2a497b161dc5efd", + "object": "response", + "created_at": 1770644218, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770644218, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_053b3f93be7d6ffc006989e2fa72a081a39d8eab61e86e2a77", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3c23f3dbc4f3a-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:36:59 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '61' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=LpxYnxNo5m4mIrzMqYWamG2zJ3hpXYyK4chjzsxBPlM-1770644218.7603755-1.0.1.1-e5HAjIPJGP1O3jdwrtbi72sH1rXzf8itmn9UEP53XYKoGl9oLqVFU50UZWfFrI_DG_h_4J8oEZeEF5ACQneWjD10rmjyQWDmWGJWU8VNRTbfxaFmtYTI60i2IycU1ViR; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:06:59 GMT + x-request-id: + - req_1db4602566924030a244244f7f97ed77 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0628c14e8a3741c3006989e75c5d988194b4967cf999ec8659", + "object": "response", + "created_at": 1770645340, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770645341, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0628c14e8a3741c3006989e75d1b888194bb6626e5dda13fc4", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3dd9e9967c60f-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:55:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1026' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=dEIsVQHaNDUM0MFsGpS1PCFrpJWUNTJRnK7pmnYcscM-1770645339.9409304-1.0.1.1-GIiT6.xalTCBYHdL3Hej5L3zFblKXv0zwUIlfQFTy1iyuxHTba4QBySApR2ctuzfb1.MCR1CcJX6JMcgOE7asSjNYbg.zzvMvgzyqz_lqksrqQJXCVO.LUnXi76HXrUO; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:41 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 24.792s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_fe8c6abaac104a319f78fa0566ab649f + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0628c14e8a3741c3006989e75c5d988194b4967cf999ec8659 + response: + body: + string: |- + { + "id": "resp_0628c14e8a3741c3006989e75c5d988194b4967cf999ec8659", + "object": "response", + "created_at": 1770645340, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770645341, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0628c14e8a3741c3006989e75d1b888194bb6626e5dda13fc4", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cb3ddaa2d73d123-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Mon, 09 Feb 2026 13:55:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '90' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=7BFl.6ENIMMPYrS5TrOJHAsH_JixfdQNnXUa50gtauQ-1770645341.7887216-1.0.1.1-gMAn5JB2Kifg6erhNIDyxotgCD1HDynTQDvCfQQLdIrdGlYDWhxu_uRJKPD4cQt8Fr0rtu_eVQuesIX1wLZS.Bslen3W9LB5NHfAh.BVJuuDkTzCVrqBHq4TmUg6LrYC; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:42 GMT + x-request-id: + - req_c12d76842dc74895ac75814a561506c7 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml new file mode 100644 index 0000000000..d88e4d5138 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -0,0 +1,779 @@ +interactions: +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","object":"response","created_at":1770643814,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","object":"response","created_at":1770643814,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" How","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":10} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" can","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" I","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":12} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" assist","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":13} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" you","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":14} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" further","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":15} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":16} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test. How can I assist you further?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":17} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":18} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":19} + + event: response.completed + data: {"type":"response.completed","sequence_number":20,"response":{"truncation":"disabled","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":13,"total_tokens":25},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643816}} + + headers: + CF-RAY: + - 9cb3b85f9c2dde92-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:30:15 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '762' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=uTQPoDt1NER0KiGrwEOejBN8EnkV.7x0zYADlPNG6E0-1770643814.3347235-1.0.1.1-rgQGweyMxj_CRAGuvkoDDHXkY6Qgt5b9T.Dd6XuXSqGIRQwDnlmyn1Z995BajUgQ9v2NqMk5WjBQ5A5ZRqJVLWnWqboMZgYzRpzDMrDInAZ6VpNkFXWP1mLPNdbhnOzG; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:15 GMT + x-request-id: + - req_bb34d05fd10048589240908a42187d56 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" How","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":10} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" can","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" I","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":12} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" assist","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":13} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" you","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":14} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" further","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":15} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":16} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test. How can I assist you further?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":17} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":18} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":19} + + event: response.completed + data: {"type":"response.completed","sequence_number":20,"response":{"truncation":"disabled","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":13,"total_tokens":25},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643816}} + + headers: + CF-RAY: + - 9cb3b87dcb9b8c7b-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:30:19 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '413' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=.0V0NVX9_w8uuITr.NxJALLrwLLbf1U1lP3GTCHfPJg-1770643819.1714222-1.0.1.1-6Ptd8ph0lH.9qsuSCL2UtoEfVbnffxG5zqD.uxc5gKmIXZOPSC9avsRabNRQ_7m1eSrT2YDdTeXqxbOfsaRb_ETCF8mhLMl3vGwGEUHUYizsD4TfBkRwGZsOAh68aCjo; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:19 GMT + x-request-id: + - req_ff976aefe1cc4d8485b134e4bf0ff7a1 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","object":"response","created_at":1770644219,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","object":"response","created_at":1770644219,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770644221}} + + headers: + CF-RAY: + - 9cb3c2443f734f3a-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:37:00 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '1151' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=hPyZrwMbpm1hdEbhNU2MOCYu1NcKeHgSJIyvbErJEtk-1770644219.5582347-1.0.1.1-gufdMNZl6SC9ZIQICSbJm.QtMrfnyuSkAXZnBhHYnEEy5riA9oxPAp9Zz4icB8Rxj.SpS9Ij269JTA5nuEffA4_aMDtr9e41jVLpzV7V3H39LeaHY5JcM2fvjkcFLx.s; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:07:00 GMT + x-request-id: + - req_395b056b30df459ba39abe79636b581b + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770644221}} + + headers: + CF-RAY: + - 9cb3c263cf3942fc-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:37:05 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '598' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=cpmg8OBNGlyNM07o89aL9xrO8ujjoCAafkHhXczdaXA-1770644224.6022356-1.0.1.1-mBGn2XJoY_2sL1zAb6_TbzlmB2hOSPexpvGuAbUjzU1A60GeB4TkoEii.Ep_sJOhAFkZghqVMXcpCHgDvw9zROz.JPXF7bep7ZoRLQ99WmeghxDStCP4ooZWPohHwwmE; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:07:05 GMT + x-request-id: + - req_3c09fbe94b954cf49ea58b4f65836e61 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","object":"response","created_at":1770645342,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","object":"response","created_at":1770645342,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645344}} + + headers: + CF-RAY: + - 9cb3ddb08ae50cc2-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:55:43 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '806' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=DOCAN1Wy9xUEjyyXaB8hDbuQpolLQD2dkMFFcgy1z0U-1770645342.8075092-1.0.1.1-jZuntKTaJV06MImBe1S49tUTDGm2sqb0HrD9Z0Etajv02qY10wZqKslSouJpfbZvCcS5qWEQeUam6Id6l1gAj2Hdrr3m5oJoiPHKXx7qn3cqh6KJY8PQWgnO02TYccyz; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:43 GMT + x-request-id: + - req_7ce464c15d4c4a9ba218492f75fedaca + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645344}} + + headers: + CF-RAY: + - 9cb3ddd03b0341f2-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:55:48 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '511' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=rUJaQ8GcKFstnxcEvGRR17Krf9xkb643VYSXjV0wj.o-1770645347.8736434-1.0.1.1-kQG8DJsh5d4SVoV.ZKPq6VqT0z4Hk1AoYwKpbImnAZfwxOmlhIUFINnLmlaiMOq7G4.9pKHt4NlA0Ki1gLd9BbX99xCiiHe2xkRch_jloxOWitNdMsN6FyuXfH8k9676; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:48 GMT + x-request-id: + - req_82e690bfb9ca4a4ba467f6449299135b + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index d7d5d4fb57..a727109348 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -479,4 +479,748 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","object":"response","created_at":1770643804,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","object":"response","created_at":1770643804,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"content_index":0,"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643807}} + + headers: + CF-RAY: + - 9cb3b81f3eee7c93-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:30:05 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '874' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=rpzn8DkagohwxQctSTtpC6.guQ0CV0EtHESonxILJIE-1770643804.0333288-1.0.1.1-439F17oMty3OVzTrR7nh4NxuIEo2BmfM7wpjHo97hiOFdhlihKYCBqovnTa5qW_MOXveVVyHwCXjQ_u0jC.Z9XSfdpM7fRFFRLQ8zJaNhALEN3zFLAnQGBJCN4C6tGNu; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:05 GMT + x-request-id: + - req_9faebd5c304542c0bebc6d028c3a3923 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0148d8df506da6fe006989e15c99048191bb084218667c8344?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"content_index":0,"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643807}} + + headers: + CF-RAY: + - 9cb3b8434a067c6a-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:30:10 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '341' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=zTAN6tFGn_SGn4aUkttFFprCC8QZpe2K9BO8ZI4NCVM-1770643809.8070018-1.0.1.1-kVggksJw12zveocEikK7xfthogaRXY6Eaii.kgDq4bWoAs6Nh8SIyJUmxusK7bkzBewVAE8Jo8UmjVkhRap27tmGdh7CeT6e5mVRuG_T79AhvoYLGJ0or3dESBJgR1Ns; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:10 GMT + x-request-id: + - req_6967ca9459e1418a85709a65e630caf5 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","object":"response","created_at":1770644211,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","object":"response","created_at":1770644211,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770644213}} + + headers: + CF-RAY: + - 9cb3c211097a643e-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:36:52 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '860' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=4Gwrw3H_pwAeEU79wdn2HMgilTvl4iBzqA7OWhIF84Y-1770644211.3661993-1.0.1.1-.XTNmXiizm6Xx8_QA4B26UQvyd8agBoL5aAgYPP5NPBhgwT7sdTCv75yjicpwVQQwxLPbo1SgwtJBse7bT7ohvl5_XHoKdnXhw20usDLKCLMEWThrdk3T_RMK6RUbM87; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:06:52 GMT + x-request-id: + - req_711a6b2c2b6c4f89b4cd5cc16e1b82dd + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770644213}} + + headers: + CF-RAY: + - 9cb3c22f7f0a41c6-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:36:56 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '382' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=KLyb4w6_uwWDyjN9___24J13UBcBMgWzhrSd9xoiC_Y-1770644216.2335768-1.0.1.1-t_xihvo.XEleyIWC.Nw3jMyYqNCqZZryF.dnk_cPnf85PUk4ENKQ4vo8FPldQIgUvsJw54o2EOmfBa3pFcz66.vnQzejXoIXhMK_RM0ZL327MrFjb1JdYzuA9CzH.UI1; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:06:56 GMT + x-request-id: + - req_e2211e7b86b24125b56c665e816a5de3 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","object":"response","created_at":1770645333,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","object":"response","created_at":1770645333,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645335}} + + headers: + CF-RAY: + - 9cb3dd73dd2143c7-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:55:33 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '810' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=VbUlwocOyFgmNV__PTP3XG7J4yon1c0Ch8Xxo2ppv74-1770645333.0948477-1.0.1.1-1h.4KcbFd5Ytnv4XYjZDMzT8oORoQ_0oWvpvxZwhlzDxUgp1Pj_t9zSm9RxSgPtnzKl.UqVsGu49W_fvgnhWxiLAtB4_qc4hoiLLvn061n35h3.6XiHyZKuodr7ktI8H; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:33 GMT + x-request-id: + - req_17ea2c5d1be447a6b49e140e6e3a289a + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645335}} + + headers: + CF-RAY: + - 9cb3dd930802d2b1-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:55:38 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '403' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ATGl5_dh.lIqECeNIXA7urz6vsnHDhMrvaAa_teMV4E-1770645338.0863152-1.0.1.1-3t5CRAVNrHl7I0_celSPoo7C8PE.gW6dD.Me6QtqB5ZFgYuKwWWR_3_NOfEKyvqkQvOY2erzOIQDUH5AmLCFv2OQeA4BV.Z03duh7sMdrUXRz3OjzTNPPHAB61Vyb_76; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:38 GMT + x-request-id: + - req_656ff7c12bc7464989c84b5107161bdd + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index 2c1efc5ab8..ece81a86c4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -359,4 +359,397 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_03908c6b15ff67cf006989e15aaaac819ca4ff9346b51c65d3","object":"response","created_at":1770643802,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_03908c6b15ff67cf006989e15aaaac819ca4ff9346b51c65d3","object":"response","created_at":1770643802,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"4TKXZ1DG9JAZ","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"RIHhashaKqIlk","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"qdu83NDu3gJ0ck","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"qxqlIJQk0oE","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"GAm0FQDfKGabat1","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_03908c6b15ff67cf006989e15aaaac819ca4ff9346b51c65d3","object":"response","created_at":1770643802,"status":"completed","background":false,"completed_at":1770643803,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cb3b812cf3f5cb9-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:30:02 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '39' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=6n.bUeTommxAzUfk76yK7yZMUeeTdQDlxTHVOTrNpL4-1770643802.0510373-1.0.1.1-jSE1kdu_Q0EHTd5mJc_U1QAsqfGtzK2IDj9NM40Ew16O.XtEXUcnmcBYZFml_PtSkRqbYFcdtaCurtxlBTlbOqf_qOAG5ZZzSy_Z6hC.7tZrR_cWHgR2kFntpRLyfnUr; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:00:02 GMT + x-request-id: + - req_e2e17b66baea40b7be3dc0270ce2ff47 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0b5cc31d11cb33ec006989e2f1ff988191b71a637d72eee764","object":"response","created_at":1770644210,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0b5cc31d11cb33ec006989e2f1ff988191b71a637d72eee764","object":"response","created_at":1770644210,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"wW7rEzh4uPlN","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"AlhfP74CdEYBT","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"JSOPxkEkaj9yL2","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"osbbnTAxvYI","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"73UYK4gsAISweKD","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0b5cc31d11cb33ec006989e2f1ff988191b71a637d72eee764","object":"response","created_at":1770644210,"status":"completed","background":false,"completed_at":1770644210,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cb3c205192cff90-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:36:50 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '35' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=SxvgSb9pfjP7_LzD5BK7hnDYs.GYICQvd8xTtRyUE98-1770644209.4554598-1.0.1.1-1Vb3TgOGcUiaX0IKkJLJ4zJZoQmzvHZsLBSXViQ7d1r630C7IOqIhkQ7J697M3BbrxJy9zoJneFCNOm5u8CpiQPOeXxga5WqtqHDPd8aPktPR_0auOJtZDvxb.rw_xr6; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:06:50 GMT + x-request-id: + - req_fd80496512fa41499291851f45884824 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0e27e316613778d9006989e753ff4881948d1a10896cd7e2cc","object":"response","created_at":1770645332,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0e27e316613778d9006989e753ff4881948d1a10896cd7e2cc","object":"response","created_at":1770645332,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"cqSAlF5nnvrZ","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"P4ChvyTPhJdXd","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"BHG2Qtf08bL5fi","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"wvqQYdYlA40","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"!","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"19fJSTVkv5KhXto","output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" How","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"HVSG1HPyircm","output_index":0,"sequence_number":9} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" can","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"xOo47gZ8UvXu","output_index":0,"sequence_number":10} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" I","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"RsNTKjbVNRVqWF","output_index":0,"sequence_number":11} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" assist","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"PctOmlMOS","output_index":0,"sequence_number":12} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" you","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"dOQt98cmhjN4","output_index":0,"sequence_number":13} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" further","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"SgIGcc91","output_index":0,"sequence_number":14} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"?","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"PSPrwiNlZeKBPWO","output_index":0,"sequence_number":15} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"output_index":0,"sequence_number":16,"text":"This is a test! How can I assist you further?"} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test! How can I assist you further?"},"sequence_number":17} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test! How can I assist you further?"}],"role":"assistant"},"output_index":0,"sequence_number":18} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0e27e316613778d9006989e753ff4881948d1a10896cd7e2cc","object":"response","created_at":1770645332,"status":"completed","background":false,"completed_at":1770645332,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test! How can I assist you further?"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":13,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":25},"user":null,"metadata":{}},"sequence_number":19} + + headers: + CF-RAY: + - 9cb3dd6cbc5a61ce-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Mon, 09 Feb 2026 13:55:32 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '82' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=EMEvMqGApU3ozDxhzGl3101Ox2GWFYpMh3TqcoizxRw-1770645331.9510934-1.0.1.1-_ShFC4cokwSYkqTKad4N.uf23Lrt8LEjWfUidRgTx.v4jxb7w_VL76OnacuI9SiGLi3PW30yNS5M1e45FKXEIWUE6p11bJ25cZJzNdTGGudiuwIk2th6RlB.ryJl2tkX; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 + 14:25:32 GMT + x-request-id: + - req_a056e762fe5149fa99198231b94b4ed4 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index 6d1bcd2884..952aeed937 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -136,6 +136,129 @@ def test_responses_stream_existing_response( assert final_response is not None + spans = span_exporter.get_finished_spans() + assert len(spans) == span_count + 2 + + stream_and_retrieve_spans = spans[span_count:] + operation_names = { + span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) + for span in stream_and_retrieve_spans + } + retrieval_operation = getattr( + GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None + ) + retrieval_operation_name = ( + retrieval_operation.value + if retrieval_operation is not None + else "retrieval" + ) + assert operation_names == { + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + retrieval_operation_name, + } + stream_span = next( + span + for span in stream_and_retrieve_spans + if span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) + == GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value + ) + + input_tokens = ( + final_response.usage.input_tokens if final_response.usage else None + ) + output_tokens = ( + final_response.usage.output_tokens if final_response.usage else None + ) + + assert_all_attributes( + stream_span, + final_response.model, + final_response.id, + final_response.model, + input_tokens, + output_tokens, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + response_service_tier=final_response.service_tier, + ) + + +@skip_if_no_responses_api +@pytest.mark.vcr() +def test_responses_retrieve( + span_exporter, openai_client, instrument_with_content +): + create_response = openai_client.responses.create( + model="gpt-4o-mini", + input="Say this is a test", + stream=False, + ) + + span_count = len(span_exporter.get_finished_spans()) + + response = openai_client.responses.retrieve(create_response.id) + spans = span_exporter.get_finished_spans() + assert len(spans) == span_count + 1 + + input_tokens = response.usage.input_tokens if response.usage else None + output_tokens = response.usage.output_tokens if response.usage else None + retrieval_operation = getattr( + GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None + ) + operation_name = ( + retrieval_operation.value + if retrieval_operation is not None + else "retrieval" + ) + + assert_all_attributes( + spans[-1], + response.model, + response.id, + response.model, + input_tokens, + output_tokens, + operation_name=operation_name, + response_service_tier=response.service_tier, + ) + + +@skip_if_no_responses_api +@pytest.mark.vcr() +def test_responses_retrieve_stream_existing_response( + span_exporter, openai_client, instrument_with_content +): + response_id = None + starting_after = None + + with openai_client.responses.stream( + model="gpt-4o-mini", + input="Say this is a test", + background=True, + ) as stream: + for event in stream: + if event.type == "response.created": + response_id = event.response.id + starting_after = event.sequence_number + if response_id is not None and starting_after is not None: + break + + assert response_id is not None + assert starting_after is not None + span_count = len(span_exporter.get_finished_spans()) + + with openai_client.responses.retrieve( + response_id=response_id, + starting_after=starting_after, + stream=True, + ) as stream: + final_response = None + for event in stream: + if event.type == "response.completed": + final_response = event.response + break + + assert final_response is not None + spans = span_exporter.get_finished_spans() assert len(spans) == span_count + 1 @@ -145,6 +268,14 @@ def test_responses_stream_existing_response( output_tokens = ( final_response.usage.output_tokens if final_response.usage else None ) + retrieval_operation = getattr( + GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None + ) + operation_name = ( + retrieval_operation.value + if retrieval_operation is not None + else "retrieval" + ) assert_all_attributes( spans[-1], @@ -153,6 +284,6 @@ def test_responses_stream_existing_response( final_response.model, input_tokens, output_tokens, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + operation_name=operation_name, response_service_tier=final_response.service_tier, ) From 73df7d6223682c604c99cb6e71d05aafb162ee99 Mon Sep 17 00:00:00 2001 From: Teja Date: Mon, 9 Feb 2026 21:18:18 -0500 Subject: [PATCH 09/20] Add TODO for future migration of Responses instrumentation - Added a TODO comment in the patch.py file to consider migrating Responses instrumentation to TelemetryHandler once content capture and streaming hooks are available. - Included a reference link to the OpenAI responses.py file for context on the `retrieve` method. --- .../src/opentelemetry/instrumentation/openai_v2/patch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index 0889411fc4..c67cff15fa 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -44,6 +44,8 @@ set_span_attribute, ) +# TODO: Consider migrating Responses instrumentation to TelemetryHandler +# once content capture and streaming hooks are available. def chat_completions_create( tracer: Tracer, @@ -430,6 +432,7 @@ def responses_retrieve( capture_content: bool, ): """Wrap the `retrieve` method of the `Responses` class to trace it.""" + # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1417C9-L1417C17 retrieval_enum = getattr( GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None ) From 3c0c4bba808fb7ce7fa815f88a6d0d94d4d374bc Mon Sep 17 00:00:00 2001 From: Teja Date: Tue, 10 Feb 2026 06:58:48 -0500 Subject: [PATCH 10/20] Add responses instrumentation for OpenAI API - Introduced a new module `patch_responses.py` to handle tracing for the `Responses` class methods, including `create`, `stream`, and `retrieve`. - Updated the `__init__.py` file to import the new responses patching functions. - Enhanced test coverage with new YAML cassettes for various response scenarios, including standard and streaming responses. - Removed outdated response tracing logic from `patch.py` to streamline the instrumentation process. --- .../instrumentation/openai_v2/__init__.py | 2 + .../instrumentation/openai_v2/patch.py | 501 ----------------- .../openai_v2/patch_responses.py | 530 ++++++++++++++++++ .../cassettes/test_responses_create.yaml | 170 ++++++ .../cassettes/test_responses_retrieve.yaml | 321 +++++++++++ ...ses_retrieve_stream_existing_response.yaml | 245 ++++++++ ...st_responses_stream_existing_response.yaml | 248 ++++++++ .../test_responses_stream_new_response.yaml | 124 ++++ 8 files changed, 1640 insertions(+), 501 deletions(-) create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index 89def46b89..02c6155db5 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -59,6 +59,8 @@ async_embeddings_create, chat_completions_create, embeddings_create, +) +from .patch_responses import ( responses_create, responses_retrieve, responses_stream, diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index c67cff15fa..b9205eadab 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -27,12 +27,8 @@ from opentelemetry.semconv._incubating.attributes import ( server_attributes as ServerAttributes, ) -from opentelemetry.semconv.attributes import ( - error_attributes as ErrorAttributes, -) from opentelemetry.trace import Span, SpanKind, Tracer from opentelemetry.trace.propagation import set_span_in_context -from opentelemetry.trace.status import Status, StatusCode from .instruments import Instruments from .utils import ( @@ -44,9 +40,6 @@ set_span_attribute, ) -# TODO: Consider migrating Responses instrumentation to TelemetryHandler -# once content capture and streaming hooks are available. - def chat_completions_create( tracer: Tracer, logger: Logger, @@ -285,243 +278,6 @@ async def traced_method(wrapped, instance, args, kwargs): return traced_method -def responses_create( - tracer: Tracer, - logger: Logger, - instruments: Instruments, - capture_content: bool, -): - """Wrap the `create` method of the `Responses` class to trace it.""" - # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L828 - # TODO: Consider migrating Responses instrumentation to TelemetryHandler - # once content capture and streaming hooks are available. - - def traced_method(wrapped, instance, args, kwargs): - span_attributes = get_llm_request_attributes( - kwargs, - instance, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" - streaming = is_streaming(kwargs) - - with tracer.start_as_current_span( - name=span_name, - kind=SpanKind.CLIENT, - attributes=span_attributes, - end_on_exit=False, - ) as span: - start = default_timer() - result = None - error_type = None - try: - result = wrapped(*args, **kwargs) - if hasattr(result, "parse"): - # result is of type LegacyAPIResponse, call parse to get the actual response - parsed_result = result.parse() - else: - parsed_result = result - - if streaming: - return ResponseStreamWrapper( - parsed_result, - span, - logger, - capture_content, - record_metrics=True, - instruments=instruments, - request_attributes=span_attributes, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - start_time=start, - ) - - if span.is_recording(): - _set_responses_response_attributes( - span, parsed_result, capture_content - ) - - span.end() - return result - - except Exception as error: - error_type = type(error).__qualname__ - handle_span_exception(span, error) - raise - finally: - if not streaming or result is None: - duration = max((default_timer() - start), 0) - _record_metrics( - instruments, - duration, - result, - span_attributes, - error_type, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - - return traced_method - - -def responses_stream( - tracer: Tracer, - logger: Logger, - instruments: Instruments, - capture_content: bool, -): - """Wrap the `stream` method of the `Responses` class to trace it.""" - # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L966 - - def traced_method(wrapped, instance, args, kwargs): - # If this is creating a new response, the create() wrapper will handle tracing. - # This is done to avoid duplicate span creation. https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1036 - if "response_id" not in kwargs and "starting_after" not in kwargs: - return wrapped(*args, **kwargs) - - span_attributes = get_llm_request_attributes( - {}, - instance, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" - - with tracer.start_as_current_span( - name=span_name, - kind=SpanKind.CLIENT, - attributes=span_attributes, - end_on_exit=False, - ) as span: - error_type = None - try: - manager = wrapped(*args, **kwargs) - return ResponseStreamManagerWrapper( - manager, - lambda stream: ResponseStreamWrapper( - stream, - span, - logger, - capture_content, - record_metrics=True, - instruments=instruments, - request_attributes=span_attributes, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - start_time=default_timer(), - ), - ) - except Exception as error: - error_type = type(error).__qualname__ - handle_span_exception(span, error) - raise - finally: - if error_type is not None: - _record_metrics( - instruments, - 0, - None, - span_attributes, - error_type, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - - return traced_method - - -def responses_retrieve( - tracer: Tracer, - logger: Logger, - instruments: Instruments, - capture_content: bool, -): - """Wrap the `retrieve` method of the `Responses` class to trace it.""" - # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1417C9-L1417C17 - retrieval_enum = getattr( - GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None - ) - operation_name = retrieval_enum.value if retrieval_enum else "retrieval" - - def traced_method(wrapped, instance, args, kwargs): - span_attributes = get_llm_request_attributes( - {}, - instance, - operation_name, - ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" - streaming = is_streaming(kwargs) - - with tracer.start_as_current_span( - name=span_name, - kind=SpanKind.CLIENT, - attributes=span_attributes, - end_on_exit=False, - ) as span: - start = default_timer() - result = None - error_type = None - try: - result = wrapped(*args, **kwargs) - if hasattr(result, "parse"): - parsed_result = result.parse() - else: - parsed_result = result - - if streaming: - return ResponseStreamWrapper( - parsed_result, - span, - logger, - capture_content, - record_metrics=True, - instruments=instruments, - request_attributes=span_attributes, - operation_name=operation_name, - start_time=start, - ) - - if ( - GenAIAttributes.GEN_AI_REQUEST_MODEL - not in span_attributes - and getattr(parsed_result, "model", None) - ): - span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( - parsed_result.model - ) - if span.is_recording(): - set_span_attribute( - span, - GenAIAttributes.GEN_AI_REQUEST_MODEL, - parsed_result.model, - ) - if hasattr(span, "update_name"): - span.update_name( - f"{operation_name} {parsed_result.model}" - ) - - if span.is_recording(): - _set_responses_response_attributes( - span, parsed_result, capture_content - ) - - span.end() - return result - - except Exception as error: - error_type = type(error).__qualname__ - handle_span_exception(span, error) - raise - finally: - if not streaming or result is None: - duration = max((default_timer() - start), 0) - _record_metrics( - instruments, - duration, - result, - span_attributes, - error_type, - operation_name, - ) - - return traced_method - - def _get_embeddings_span_name(span_attributes): """Get span name for embeddings operations.""" return f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" @@ -688,48 +444,6 @@ def _set_embeddings_response_attributes( # Don't set output tokens for embeddings as all tokens are input tokens -def _set_responses_response_attributes( - span: Span, - result: Any, - capture_content: bool, -): - if getattr(result, "model", None): - set_span_attribute( - span, GenAIAttributes.GEN_AI_RESPONSE_MODEL, result.model - ) - - if getattr(result, "id", None): - set_span_attribute(span, GenAIAttributes.GEN_AI_RESPONSE_ID, result.id) - - if getattr(result, "service_tier", None): - set_span_attribute( - span, - GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, - result.service_tier, - ) - - if getattr(result, "usage", None): - input_tokens = getattr(result.usage, "input_tokens", None) - if input_tokens is None: - input_tokens = getattr(result.usage, "prompt_tokens", None) - if input_tokens is not None: - set_span_attribute( - span, - GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, - input_tokens, - ) - - output_tokens = getattr(result.usage, "output_tokens", None) - if output_tokens is None: - output_tokens = getattr(result.usage, "completion_tokens", None) - if output_tokens is not None: - set_span_attribute( - span, - GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, - output_tokens, - ) - - class ToolCallBuffer: def __init__(self, index, tool_call_id, function_name): self.index = index @@ -1003,218 +717,3 @@ def parse(self): """Called when using with_raw_response with stream=True""" return self - -class _ResponseProxy: - def __init__(self, response, finalize): - self._response = response - self._finalize = finalize - - def close(self): - try: - self._response.close() - finally: - self._finalize(None, None) - - def __getattr__(self, name): - return getattr(self._response, name) - - -class ResponseStreamWrapper: - def __init__( - self, - stream: Any, - span: Span, - logger: Logger, - capture_content: bool, - *, - record_metrics: bool, - instruments: Instruments, - request_attributes: dict, - operation_name: str, - start_time: Optional[float] = None, - ): - self.stream = stream - self.span = span - self.logger = logger - self.capture_content = capture_content - self.record_metrics = record_metrics - self.instruments = instruments - self.request_attributes = request_attributes - self.operation_name = operation_name - self.start_time = ( - start_time if start_time is not None else default_timer() - ) - self._span_ended = False - self._span_name_updated = False - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - try: - if exc_type is not None: - self._handle_exception(exc_val) - finally: - self.close() - return False # Propagate the exception - - def close(self): - if hasattr(self.stream, "close"): - self.stream.close() - self._finalize(None, None) - - def __iter__(self): - return self - - def __next__(self): - try: - event = next(self.stream) - self.process_event(event) - return event - except StopIteration: - self._finalize(None, None) - raise - except Exception as error: - self._handle_exception(error) - raise - - def get_final_response(self): - if not hasattr(self.stream, "get_final_response"): - raise AttributeError("get_final_response is not available") - self.until_done() - return self.stream.get_final_response() - - def until_done(self): - for _ in self: - pass - return self - - def parse(self): - """Called when using with_raw_response with stream=True""" - return self - - def __getattr__(self, name): - return getattr(self.stream, name) - - @property - def response(self): - response = getattr(self.stream, "response", None) - if response is None: - return None - return _ResponseProxy(response, self._finalize) - - def _handle_exception(self, error): - if self._span_ended: - return - handle_span_exception(self.span, error) - self._span_ended = True - self._record_metrics(None, type(error).__qualname__) - - def _mark_span_error(self, error_type: str, message: str): - self.span.set_status(Status(StatusCode.ERROR, message)) - if self.span.is_recording() and error_type: - self.span.set_attribute(ErrorAttributes.ERROR_TYPE, error_type) - - def _record_metrics(self, result, error_type: Optional[str]): - if not self.record_metrics: - return - duration = max((default_timer() - self.start_time), 0) - _record_metrics( - self.instruments, - duration, - result, - self.request_attributes, - error_type, - self.operation_name, - ) - - def _finalize( - self, - result, - error_type: Optional[str], - error_message: Optional[str] = None, - ): - if self._span_ended: - return - if result and self.span.is_recording(): - _set_responses_response_attributes( - self.span, result, self.capture_content - ) - if error_type: - self._mark_span_error(error_type, error_message or error_type) - self.span.end() - self._span_ended = True - self._record_metrics(result, error_type) - - def _maybe_update_request_model(self, response): - if ( - response - and GenAIAttributes.GEN_AI_REQUEST_MODEL - not in self.request_attributes - and getattr(response, "model", None) - ): - self.request_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( - response.model - ) - if self.span.is_recording(): - set_span_attribute( - self.span, - GenAIAttributes.GEN_AI_REQUEST_MODEL, - response.model, - ) - if not self._span_name_updated and hasattr( - self.span, "update_name" - ): - self.span.update_name( - f"{self.operation_name} {response.model}" - ) - self._span_name_updated = True - - def process_event(self, event): - event_type = getattr(event, "type", None) - if event_type in {"response.created", "response.completed"}: - response = getattr(event, "response", None) - self._maybe_update_request_model(response) - if response and self.span.is_recording(): - _set_responses_response_attributes( - self.span, response, self.capture_content - ) - if event_type == "response.completed": - self._finalize(response, None) - return - - if event_type in {"response.failed", "response.incomplete"}: - response = getattr(event, "response", None) - self._maybe_update_request_model(response) - if response and self.span.is_recording(): - _set_responses_response_attributes( - self.span, response, self.capture_content - ) - self._finalize(response, event_type) - return - - if event_type == "error": - error_type = getattr(event, "code", None) or "response.error" - message = getattr(event, "message", None) or error_type - self._finalize(None, error_type, message) - return - - -class ResponseStreamManagerWrapper: - def __init__(self, manager, wrapper_factory): - self._manager = manager - self._wrapper_factory = wrapper_factory - self._stream = None - - def __enter__(self): - stream = self._manager.__enter__() - self._stream = self._wrapper_factory(stream) - return self._stream - - def __exit__(self, exc_type, exc_val, exc_tb): - if self._stream is not None: - return self._stream.__exit__(exc_type, exc_val, exc_tb) - return self._manager.__exit__(exc_type, exc_val, exc_tb) - - def __getattr__(self, name): - return getattr(self._manager, name) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py new file mode 100644 index 0000000000..5c7e68abc5 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -0,0 +1,530 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from timeit import default_timer +from typing import Any, Optional + +from opentelemetry._logs import Logger +from opentelemetry.semconv._incubating.attributes import ( + gen_ai_attributes as GenAIAttributes, +) +from opentelemetry.semconv.attributes import ( + error_attributes as ErrorAttributes, +) +from opentelemetry.trace import Span, SpanKind, Tracer +from opentelemetry.trace.status import Status, StatusCode + +from .instruments import Instruments +from .patch import _record_metrics +from .utils import ( + get_llm_request_attributes, + handle_span_exception, + is_streaming, + set_span_attribute, +) + + +def responses_create( + tracer: Tracer, + logger: Logger, + instruments: Instruments, + capture_content: bool, +): + """Wrap the `create` method of the `Responses` class to trace it.""" + # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L828 + # TODO: Consider migrating Responses instrumentation to TelemetryHandler + # once content capture and streaming hooks are available. + + def traced_method(wrapped, instance, args, kwargs): + span_attributes = get_llm_request_attributes( + kwargs, + instance, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" + streaming = is_streaming(kwargs) + + with tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + end_on_exit=False, + ) as span: + start = default_timer() + result = None + error_type = None + try: + result = wrapped(*args, **kwargs) + if hasattr(result, "parse"): + # result is of type LegacyAPIResponse, call parse to get the actual response + parsed_result = result.parse() + else: + parsed_result = result + + if streaming: + return ResponseStreamWrapper( + parsed_result, + span, + logger, + capture_content, + record_metrics=True, + instruments=instruments, + request_attributes=span_attributes, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + start_time=start, + ) + + if span.is_recording(): + _set_responses_response_attributes( + span, parsed_result, capture_content + ) + + span.end() + return result + + except Exception as error: + error_type = type(error).__qualname__ + handle_span_exception(span, error) + raise + finally: + if not streaming or result is None: + duration = max((default_timer() - start), 0) + _record_metrics( + instruments, + duration, + result, + span_attributes, + error_type, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + + return traced_method + + +def responses_stream( + tracer: Tracer, + logger: Logger, + instruments: Instruments, + capture_content: bool, +): + """Wrap the `stream` method of the `Responses` class to trace it.""" + # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L966 + + def traced_method(wrapped, instance, args, kwargs): + # If this is creating a new response, the create() wrapper will handle tracing. + # This is done to avoid duplicate span creation. https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1036 + if "response_id" not in kwargs and "starting_after" not in kwargs: + return wrapped(*args, **kwargs) + + span_attributes = get_llm_request_attributes( + {}, + instance, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" + + with tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + end_on_exit=False, + ) as span: + error_type = None + try: + manager = wrapped(*args, **kwargs) + return ResponseStreamManagerWrapper( + manager, + lambda stream: ResponseStreamWrapper( + stream, + span, + logger, + capture_content, + record_metrics=True, + instruments=instruments, + request_attributes=span_attributes, + operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + start_time=default_timer(), + ), + ) + except Exception as error: + error_type = type(error).__qualname__ + handle_span_exception(span, error) + raise + finally: + if error_type is not None: + _record_metrics( + instruments, + 0, + None, + span_attributes, + error_type, + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + ) + + return traced_method + + +def responses_retrieve( + tracer: Tracer, + logger: Logger, + instruments: Instruments, + capture_content: bool, +): + """Wrap the `retrieve` method of the `Responses` class to trace it.""" + # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1417C9-L1417C17 + retrieval_enum = getattr( + GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None + ) + operation_name = retrieval_enum.value if retrieval_enum else "retrieval" + + def traced_method(wrapped, instance, args, kwargs): + span_attributes = get_llm_request_attributes( + {}, + instance, + operation_name, + ) + span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" + streaming = is_streaming(kwargs) + + with tracer.start_as_current_span( + name=span_name, + kind=SpanKind.CLIENT, + attributes=span_attributes, + end_on_exit=False, + ) as span: + start = default_timer() + result = None + error_type = None + try: + result = wrapped(*args, **kwargs) + if hasattr(result, "parse"): + parsed_result = result.parse() + else: + parsed_result = result + + if streaming: + return ResponseStreamWrapper( + parsed_result, + span, + logger, + capture_content, + record_metrics=True, + instruments=instruments, + request_attributes=span_attributes, + operation_name=operation_name, + start_time=start, + ) + + if ( + GenAIAttributes.GEN_AI_REQUEST_MODEL + not in span_attributes + and getattr(parsed_result, "model", None) + ): + span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( + parsed_result.model + ) + if span.is_recording(): + set_span_attribute( + span, + GenAIAttributes.GEN_AI_REQUEST_MODEL, + parsed_result.model, + ) + if hasattr(span, "update_name"): + span.update_name( + f"{operation_name} {parsed_result.model}" + ) + + if span.is_recording(): + _set_responses_response_attributes( + span, parsed_result, capture_content + ) + + span.end() + return result + + except Exception as error: + error_type = type(error).__qualname__ + handle_span_exception(span, error) + raise + finally: + if not streaming or result is None: + duration = max((default_timer() - start), 0) + _record_metrics( + instruments, + duration, + result, + span_attributes, + error_type, + operation_name, + ) + + return traced_method + + +def _set_responses_response_attributes( + span: Span, + result: Any, + capture_content: bool, +): + if getattr(result, "model", None): + set_span_attribute( + span, GenAIAttributes.GEN_AI_RESPONSE_MODEL, result.model + ) + + if getattr(result, "id", None): + set_span_attribute(span, GenAIAttributes.GEN_AI_RESPONSE_ID, result.id) + + if getattr(result, "service_tier", None): + set_span_attribute( + span, + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, + result.service_tier, + ) + + if getattr(result, "usage", None): + input_tokens = getattr(result.usage, "input_tokens", None) + if input_tokens is None: + input_tokens = getattr(result.usage, "prompt_tokens", None) + if input_tokens is not None: + set_span_attribute( + span, + GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, + input_tokens, + ) + + output_tokens = getattr(result.usage, "output_tokens", None) + if output_tokens is None: + output_tokens = getattr(result.usage, "completion_tokens", None) + if output_tokens is not None: + set_span_attribute( + span, + GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, + output_tokens, + ) + + +class _ResponseProxy: + def __init__(self, response, finalize): + self._response = response + self._finalize = finalize + + def close(self): + try: + self._response.close() + finally: + self._finalize(None, None) + + def __getattr__(self, name): + return getattr(self._response, name) + + +class ResponseStreamWrapper: + def __init__( + self, + stream: Any, + span: Span, + logger: Logger, + capture_content: bool, + *, + record_metrics: bool, + instruments: Instruments, + request_attributes: dict, + operation_name: str, + start_time: Optional[float] = None, + ): + self.stream = stream + self.span = span + self.logger = logger + self.capture_content = capture_content + self.record_metrics = record_metrics + self.instruments = instruments + self.request_attributes = request_attributes + self.operation_name = operation_name + self.start_time = ( + start_time if start_time is not None else default_timer() + ) + self._span_ended = False + self._span_name_updated = False + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + try: + if exc_type is not None: + self._handle_exception(exc_val) + finally: + self.close() + return False # Propagate the exception + + def close(self): + if hasattr(self.stream, "close"): + self.stream.close() + self._finalize(None, None) + + def __iter__(self): + return self + + def __next__(self): + try: + event = next(self.stream) + self.process_event(event) + return event + except StopIteration: + self._finalize(None, None) + raise + except Exception as error: + self._handle_exception(error) + raise + + def get_final_response(self): + if not hasattr(self.stream, "get_final_response"): + raise AttributeError("get_final_response is not available") + self.until_done() + return self.stream.get_final_response() + + def until_done(self): + for _ in self: + pass + return self + + def parse(self): + """Called when using with_raw_response with stream=True""" + return self + + def __getattr__(self, name): + return getattr(self.stream, name) + + @property + def response(self): + response = getattr(self.stream, "response", None) + if response is None: + return None + return _ResponseProxy(response, self._finalize) + + def _handle_exception(self, error): + if self._span_ended: + return + handle_span_exception(self.span, error) + self._span_ended = True + self._record_metrics(None, type(error).__qualname__) + + def _mark_span_error(self, error_type: str, message: str): + self.span.set_status(Status(StatusCode.ERROR, message)) + if self.span.is_recording() and error_type: + self.span.set_attribute(ErrorAttributes.ERROR_TYPE, error_type) + + def _record_metrics(self, result, error_type: Optional[str]): + if not self.record_metrics: + return + duration = max((default_timer() - self.start_time), 0) + _record_metrics( + self.instruments, + duration, + result, + self.request_attributes, + error_type, + self.operation_name, + ) + + def _finalize( + self, + result, + error_type: Optional[str], + error_message: Optional[str] = None, + ): + if self._span_ended: + return + if result and self.span.is_recording(): + _set_responses_response_attributes( + self.span, result, self.capture_content + ) + if error_type: + self._mark_span_error(error_type, error_message or error_type) + self.span.end() + self._span_ended = True + self._record_metrics(result, error_type) + + def _maybe_update_request_model(self, response): + if ( + response + and GenAIAttributes.GEN_AI_REQUEST_MODEL + not in self.request_attributes + and getattr(response, "model", None) + ): + self.request_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( + response.model + ) + if self.span.is_recording(): + set_span_attribute( + self.span, + GenAIAttributes.GEN_AI_REQUEST_MODEL, + response.model, + ) + if not self._span_name_updated and hasattr( + self.span, "update_name" + ): + self.span.update_name( + f"{self.operation_name} {response.model}" + ) + self._span_name_updated = True + + def process_event(self, event): + event_type = getattr(event, "type", None) + if event_type in {"response.created", "response.completed"}: + response = getattr(event, "response", None) + self._maybe_update_request_model(response) + if response and self.span.is_recording(): + _set_responses_response_attributes( + self.span, response, self.capture_content + ) + if event_type == "response.completed": + self._finalize(response, None) + return + + if event_type in {"response.failed", "response.incomplete"}: + response = getattr(event, "response", None) + self._maybe_update_request_model(response) + if response and self.span.is_recording(): + _set_responses_response_attributes( + self.span, response, self.capture_content + ) + self._finalize(response, event_type) + return + + if event_type == "error": + error_type = getattr(event, "code", None) or "response.error" + message = getattr(event, "message", None) or error_type + self._finalize(None, error_type, message) + return + + +class ResponseStreamManagerWrapper: + def __init__(self, manager, wrapper_factory): + self._manager = manager + self._wrapper_factory = wrapper_factory + self._stream = None + + def __enter__(self): + stream = self._manager.__enter__() + self._stream = self._wrapper_factory(stream) + return self._stream + + def __exit__(self, exc_type, exc_val, exc_tb): + if self._stream is not None: + return self._stream.__exit__(exc_type, exc_val, exc_tb) + return self._manager.__exit__(exc_type, exc_val, exc_tb) + + def __getattr__(self, name): + return getattr(self._manager, name) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index 5a7fb485a2..6cba5118e2 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -1007,4 +1007,174 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_05fa94544fb0f75100698b1d2527e88191a9fe1bbfca2345df", + "object": "response", + "created_at": 1770724645, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770724646, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_05fa94544fb0f75100698b1d260e748191bb826f6373cfe419", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cbb6dc468052ef2-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 10 Feb 2026 11:57:26 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1087' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=tpbqst2i_VMPcUNqMEpGV.xIWu1CPOJpIx46Hdh7e38-1770724644.5486097-1.0.1.1-D7GXopbFON4n_kYzKpvY_GxU_0.uvvf9eg9_tnC5T4jgFdKidfLIWoGwvimadwax4EeQbKlsDExtQ5Mbe_uEEirQngDyuVvkQC2KWkuM2AkkBUwK4i0orC4KqiA.sxkE; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:26 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_5150044644f64aceb311a713aa1f57da + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml index 1684a08511..6cdc3eeb79 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -962,4 +962,325 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0c3284301a98507d00698b1d2fee78819585a54ab7cb4ca1cf", + "object": "response", + "created_at": 1770724655, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770724656, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0c3284301a98507d00698b1d3072488195929365fb2a18bd60", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cbb6e085b68ace5-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 10 Feb 2026 11:57:36 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '696' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=TuAyEaVGaFOE0v28mbVz.YDVQR4gTssBFxkBXSEGgwg-1770724655.4158082-1.0.1.1-hWU21Od64_vwnXko37bYTL7nFSANoJoKTbQqlktpXnH.f2b3lCxdcZb3DinNb0b.jCjCOVxOCfzwYQSoim7Ph9sHg9MIoc0K6E3u7Ai4jm4PUYlTPz8YDkqWU0XgNzwD; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:36 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 24.195s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_a1afc694bdbe4abc8dad9d0b518b622e + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0c3284301a98507d00698b1d2fee78819585a54ab7cb4ca1cf + response: + body: + string: |- + { + "id": "resp_0c3284301a98507d00698b1d2fee78819585a54ab7cb4ca1cf", + "object": "response", + "created_at": 1770724655, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770724656, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0c3284301a98507d00698b1d3072488195929365fb2a18bd60", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cbb6e109ab38e3e-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 10 Feb 2026 11:57:36 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '97' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=NJqChYMXKESdvrlT4gGeqp9LGdQf9bqdKnR8GPy15bo-1770724656.7379186-1.0.1.1-XLn2HwXV0UoPNiMCiiofdxFkPcnN3e_H4QRnOpvCOBKSOdkeym9jFs4D3HCvTGOnnzelkuxH.vQra7iZjOM4fpQ0N0nXUM5djdHhWjzwQ84nRWGTDkVCN8u5Tbid6bmH; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:36 GMT + x-request-id: + - req_13fa14166fb34dc9ac5aaf89de61bb8a + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml index d88e4d5138..cfc9639040 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -776,4 +776,249 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","object":"response","created_at":1770724657,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","object":"response","created_at":1770724657,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770724659}} + + headers: + CF-RAY: + - 9cbb6e126d5743bb-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 11:57:38 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '870' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=73GgqjDJtwrxHZkQNdY.j8uPBX6v1bFdcxMESHV5VnI-1770724657.0283952-1.0.1.1-DBkaIhE.nvXWnUJfzgITUIT4dldkO0ryA_rJlcsPyviz3LULo_2ky0gc6aRWdS7tlAFRgM50B9UtBik7hYhLadC454BE10npVAKTcBrf_jPECjZTqpeFdJzp5GAkqs81; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:38 GMT + x-request-id: + - req_cd9484d1df84442fae1d093401cc18e6 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770724659}} + + headers: + CF-RAY: + - 9cbb6e387ef2269c-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 11:57:43 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '556' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=J6CSiGn__wDTCSAu.goDh9yrdPDBZPgqtNrtFhUrLY8-1770724663.118438-1.0.1.1-w0M_Bt6GmHNfI1oSgYsyKnBtlGU_sXcs2vdjYsmePlZk5lVmtWn62O6d6wZKdddMRppmASB52ajqiTytyLzjlq_MJC.wZ_CSqzEIWA2E2Cr1.2lQrqtD7jS4LQTYqJEo; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:43 GMT + x-request-id: + - req_7034a315d367454789a2973729c06cf2 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index a727109348..6a0c53d172 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -1223,4 +1223,252 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","object":"response","created_at":1770724647,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","object":"response","created_at":1770724647,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770724650}} + + headers: + CF-RAY: + - 9cbb6dd5eeba4267-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 11:57:29 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '1103' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=QEb8WPA3cvb0EyzeVGJ_5FhHzF35Keqz27xzZfJfN0g-1770724647.3456447-1.0.1.1-rzzCsAYqJPkmF5D1nW2m17.qLasyXugQ1KGBAFuGFGw0pXGYllhyUjru00mWvErGG4CL_bB6Hj_t.f8e2k5YGgYeFcP9Bz4rWkBqegV7Mc1cDiVY.gotJ8CVj4vLGGLx; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:29 GMT + x-request-id: + - req_9944683557f4482b9dd241cc0b6bb4b5 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770724650}} + + headers: + CF-RAY: + - 9cbb6df8df886e26-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 11:57:33 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '367' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=kaukUDQcjos_fLPGxRM1gLQM_ddbPuRwpZMCa.KtfDA-1770724652.936016-1.0.1.1-K7hojVdc34k36tRG9d2yXU2YP41SMtDh.80aw_K2orkVxhB9KcpjSQS9LgEaLO1dmC.2sL1lMvHyNBaU8lRCQDXbomy9siqGEZ0lw90dQ.PzhLil5JBFJ3IZaWFYrVrC; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:33 GMT + x-request-id: + - req_d31888fcc2a14f7499a843922def1132 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index ece81a86c4..abc4be2f6d 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -752,4 +752,128 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_03d8362571afaf6600698b1d269088819e964846d7a94d4459","object":"response","created_at":1770724646,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_03d8362571afaf6600698b1d269088819e964846d7a94d4459","object":"response","created_at":1770724646,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"ukWSxSSC5P1b","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"dIwESfdoawPRE","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"5AT2L4AtHTBVtf","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"erRAywRdoqe","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"h28snF5bYEc7qBr","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_03d8362571afaf6600698b1d269088819e964846d7a94d4459","object":"response","created_at":1770724646,"status":"completed","background":false,"completed_at":1770724646,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cbb6dd0d86cad1b-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 11:57:26 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '46' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=3PQoqRs2iRdzPljmFRS2fR0r1lP3Ypcwj8V350PwUi8-1770724646.5367904-1.0.1.1-gcb.LHTKRBTPXipRo9U1E1rv2EC.I1cyRzJFPb1SUMCie8IMisMYXECXcBCvWLmx6r9O_0KDYACRxxVpMwnQIRCtTmR54KVfv85EBVNR_in2eZiuZLukb1SZkCdAUPez; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:27:26 GMT + x-request-id: + - req_ee66a9a78761457f8ddf6bc4e85847e8 + status: + code: 200 + message: OK version: 1 From c15627fa5128c3235a2d7e64048cfa6ebfa3fc8b Mon Sep 17 00:00:00 2001 From: Teja Date: Tue, 10 Feb 2026 07:32:19 -0500 Subject: [PATCH 11/20] Refactor metrics recording and improve response handling in OpenAI instrumentation - Moved the `_record_metrics` function to the `utils.py` file for better organization and accessibility. - Updated the `patch.py` file to import the `_record_metrics` function from `utils.py`, streamlining the code structure. - Enhanced the `responses_retrieve` method to simplify span attribute checks and improve readability. - Added new test cases and YAML cassettes to cover various response scenarios, including streaming and standard responses. --- .../instrumentation/openai_v2/patch.py | 94 +---- .../openai_v2/patch_responses.py | 5 +- .../instrumentation/openai_v2/utils.py | 93 ++++- .../cassettes/test_responses_create.yaml | 170 ++++++++++ .../cassettes/test_responses_retrieve.yaml | 321 ++++++++++++++++++ ...ses_retrieve_stream_existing_response.yaml | 245 +++++++++++++ ...st_responses_stream_existing_response.yaml | 248 ++++++++++++++ .../test_responses_stream_new_response.yaml | 124 +++++++ .../tests/test_responses.py | 20 +- 9 files changed, 1210 insertions(+), 110 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py index b9205eadab..24d813502e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py @@ -24,14 +24,12 @@ from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, ) -from opentelemetry.semconv._incubating.attributes import ( - server_attributes as ServerAttributes, -) from opentelemetry.trace import Span, SpanKind, Tracer from opentelemetry.trace.propagation import set_span_in_context from .instruments import Instruments from .utils import ( + _record_metrics, choice_to_event, get_llm_request_attributes, handle_span_exception, @@ -40,6 +38,7 @@ set_span_attribute, ) + def chat_completions_create( tracer: Tracer, logger: Logger, @@ -283,94 +282,6 @@ def _get_embeddings_span_name(span_attributes): return f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" -def _record_metrics( # pylint: disable=too-many-branches - instruments: Instruments, - duration: float, - result, - request_attributes: dict, - error_type: Optional[str], - operation_name: str, -): - common_attributes = { - GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name, - GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.OPENAI.value, - } - if request_model := request_attributes.get( - GenAIAttributes.GEN_AI_REQUEST_MODEL - ): - common_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = request_model - - if "gen_ai.embeddings.dimension.count" in request_attributes: - common_attributes["gen_ai.embeddings.dimension.count"] = ( - request_attributes["gen_ai.embeddings.dimension.count"] - ) - - if error_type: - common_attributes["error.type"] = error_type - - if result and getattr(result, "model", None): - common_attributes[GenAIAttributes.GEN_AI_RESPONSE_MODEL] = result.model - - if result and getattr(result, "service_tier", None): - common_attributes[ - GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER - ] = result.service_tier - - if result and getattr(result, "system_fingerprint", None): - common_attributes["gen_ai.openai.response.system_fingerprint"] = ( - result.system_fingerprint - ) - - if ServerAttributes.SERVER_ADDRESS in request_attributes: - common_attributes[ServerAttributes.SERVER_ADDRESS] = ( - request_attributes[ServerAttributes.SERVER_ADDRESS] - ) - - if ServerAttributes.SERVER_PORT in request_attributes: - common_attributes[ServerAttributes.SERVER_PORT] = request_attributes[ - ServerAttributes.SERVER_PORT - ] - - instruments.operation_duration_histogram.record( - duration, - attributes=common_attributes, - ) - - if result and getattr(result, "usage", None): - usage = result.usage - input_tokens = getattr(usage, "prompt_tokens", None) - if input_tokens is None: - input_tokens = getattr(usage, "input_tokens", None) - output_tokens = getattr(usage, "completion_tokens", None) - if output_tokens is None: - output_tokens = getattr(usage, "output_tokens", None) - - # Always record input tokens - input_attributes = { - **common_attributes, - GenAIAttributes.GEN_AI_TOKEN_TYPE: GenAIAttributes.GenAiTokenTypeValues.INPUT.value, - } - if input_tokens is not None: - instruments.token_usage_histogram.record( - input_tokens, - attributes=input_attributes, - ) - - # For embeddings, don't record output tokens as all tokens are input tokens - if ( - operation_name - != GenAIAttributes.GenAiOperationNameValues.EMBEDDINGS.value - ): - output_attributes = { - **common_attributes, - GenAIAttributes.GEN_AI_TOKEN_TYPE: GenAIAttributes.GenAiTokenTypeValues.COMPLETION.value, - } - if output_tokens is not None: - instruments.token_usage_histogram.record( - output_tokens, attributes=output_attributes - ) - - def _set_response_attributes( span, result, logger: Logger, capture_content: bool ): @@ -716,4 +627,3 @@ def process_chunk(self, chunk): def parse(self): """Called when using with_raw_response with stream=True""" return self - diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index 5c7e68abc5..fbf2d57bce 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -26,8 +26,8 @@ from opentelemetry.trace.status import Status, StatusCode from .instruments import Instruments -from .patch import _record_metrics from .utils import ( + _record_metrics, get_llm_request_attributes, handle_span_exception, is_streaming, @@ -227,8 +227,7 @@ def traced_method(wrapped, instance, args, kwargs): ) if ( - GenAIAttributes.GEN_AI_REQUEST_MODEL - not in span_attributes + GenAIAttributes.GEN_AI_REQUEST_MODEL not in span_attributes and getattr(parsed_result, "model", None) ): span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index 5b60d1737c..36e8284606 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -15,7 +15,7 @@ from __future__ import annotations from os import environ -from typing import Mapping +from typing import TYPE_CHECKING, Mapping, Optional from urllib.parse import urlparse from httpx import URL @@ -37,6 +37,9 @@ "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT" ) +if TYPE_CHECKING: + from .instruments import Instruments + def is_content_enabled() -> bool: capture_content = environ.get( @@ -288,6 +291,94 @@ def get_llm_request_attributes( return {k: v for k, v in attributes.items() if value_is_set(v)} +def _record_metrics( # pylint: disable=too-many-branches + instruments: Instruments, + duration: float, + result, + request_attributes: dict, + error_type: Optional[str], + operation_name: str, +): + common_attributes = { + GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name, + GenAIAttributes.GEN_AI_SYSTEM: GenAIAttributes.GenAiSystemValues.OPENAI.value, + } + if request_model := request_attributes.get( + GenAIAttributes.GEN_AI_REQUEST_MODEL + ): + common_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = request_model + + if "gen_ai.embeddings.dimension.count" in request_attributes: + common_attributes["gen_ai.embeddings.dimension.count"] = ( + request_attributes["gen_ai.embeddings.dimension.count"] + ) + + if error_type: + common_attributes["error.type"] = error_type + + if result and getattr(result, "model", None): + common_attributes[GenAIAttributes.GEN_AI_RESPONSE_MODEL] = result.model + + if result and getattr(result, "service_tier", None): + common_attributes[ + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER + ] = result.service_tier + + if result and getattr(result, "system_fingerprint", None): + common_attributes["gen_ai.openai.response.system_fingerprint"] = ( + result.system_fingerprint + ) + + if ServerAttributes.SERVER_ADDRESS in request_attributes: + common_attributes[ServerAttributes.SERVER_ADDRESS] = ( + request_attributes[ServerAttributes.SERVER_ADDRESS] + ) + + if ServerAttributes.SERVER_PORT in request_attributes: + common_attributes[ServerAttributes.SERVER_PORT] = request_attributes[ + ServerAttributes.SERVER_PORT + ] + + instruments.operation_duration_histogram.record( + duration, + attributes=common_attributes, + ) + + if result and getattr(result, "usage", None): + usage = result.usage + input_tokens = getattr(usage, "prompt_tokens", None) + if input_tokens is None: + input_tokens = getattr(usage, "input_tokens", None) + output_tokens = getattr(usage, "completion_tokens", None) + if output_tokens is None: + output_tokens = getattr(usage, "output_tokens", None) + + # Always record input tokens + input_attributes = { + **common_attributes, + GenAIAttributes.GEN_AI_TOKEN_TYPE: GenAIAttributes.GenAiTokenTypeValues.INPUT.value, + } + if input_tokens is not None: + instruments.token_usage_histogram.record( + input_tokens, + attributes=input_attributes, + ) + + # For embeddings, don't record output tokens as all tokens are input tokens + if ( + operation_name + != GenAIAttributes.GenAiOperationNameValues.EMBEDDINGS.value + ): + output_attributes = { + **common_attributes, + GenAIAttributes.GEN_AI_TOKEN_TYPE: GenAIAttributes.GenAiTokenTypeValues.COMPLETION.value, + } + if output_tokens is not None: + instruments.token_usage_histogram.record( + output_tokens, attributes=output_attributes + ) + + def handle_span_exception(span, error): span.set_status(Status(StatusCode.ERROR, str(error))) if span.is_recording(): diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index 6cba5118e2..693bb5403e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -1177,4 +1177,174 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0684d8081461c9d700698b23a1790c8193b605c8d53232be76", + "object": "response", + "created_at": 1770726305, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770726306, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0684d8081461c9d700698b23a201388193a43b6ec8f66a84ec", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cbb964c1a653eb4-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 10 Feb 2026 12:25:06 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '920' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=c8GlYQgsWUlM7dXhHXiKxD8OPT7IIY9hwRtrOdDiRVI-1770726304.6518757-1.0.1.1-ravVEb0k_BTqgnqMj.QkBrgdKm4kAHXTWNucwGiZjYBXjdriNB4oq76ucihPMchNdYC3qAxSpAtMlqsYt_.tpxqe4vQKYo.mwpLhorw7AwtYQn41sQd.G18XcagHspJ7; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:06 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_da3da8daaa404e4981cc39c6945b74b0 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml index 6cdc3eeb79..9a186a9122 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -1283,4 +1283,325 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_08530deab88e1a0900698b23abfd908197a4f0e4b5d352d3bc", + "object": "response", + "created_at": 1770726316, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770726316, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_08530deab88e1a0900698b23ac92088197b59276f3fb6ccb6e", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cbb968f6cedf965-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 10 Feb 2026 12:25:16 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '746' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=cOj3sUuVLHvJJAXuFXxvxgZ5gSWfPQ2CoJ7QcTCWbyY-1770726315.4227011-1.0.1.1-Eb2ZQjNeEKoDngnEvLPFJnbJMXY80wLHxqccumusa1AXoHZb.r36G4rR72Sk48ZZmxZTqn_MU_v8rWhT0SlPXEmBvyUA9gJBvRaTk4tm2TwlXWIX5QVLBLaTFn0TBLKR; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:16 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 23.986s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_10e1e270547842bf9fa12a2d36df0979 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_08530deab88e1a0900698b23abfd908197a4f0e4b5d352d3bc + response: + body: + string: |- + { + "id": "resp_08530deab88e1a0900698b23abfd908197a4f0e4b5d352d3bc", + "object": "response", + "created_at": 1770726316, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770726316, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_08530deab88e1a0900698b23ac92088197b59276f3fb6ccb6e", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cbb96987b3dcb2e-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 10 Feb 2026 12:25:17 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '172' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ZXTIu3EqoUn7O6DdNQtPKRpfORkUxRmo_y2U6kSqoMU-1770726316.8734188-1.0.1.1-WWf3lCY4fufsJAuenl8HDZpJ2aeyiuRtIkB5ZhjK_1UY17Pbjyr9MDuMe7UgkZTMjsBlKyzxc53atQB2k0RgUfhl.Qk7j2ZW5Sg1QPkmTMs80kORHzBKRzDnpBzf8XYE; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:17 GMT + x-request-id: + - req_791c713b254145b2b49105573899f7b3 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml index cfc9639040..8d18406adf 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -1021,4 +1021,249 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","object":"response","created_at":1770726317,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","object":"response","created_at":1770726317,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770726319}} + + headers: + CF-RAY: + - 9cbb969b98b9d911-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 12:25:18 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '828' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Zllv4baEWlppA9zRPxcANEtJyJ8MaRO4TU3BO7ip4qM-1770726317.3726966-1.0.1.1-ywfDQ67zkuAB11t9gTlMSPXMKgERvHmq8lD3b_j2SyaIM5NxitxPwrz_0e987YKg14vTXOJZrZVS_vGrf4xVOGldQkqSwly3UNKMDkHDs_r6MYa1s0Sy1evmRIy2.4Yq; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:18 GMT + x-request-id: + - req_b83a1bd31c374a90a77531db3d3239cc + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770726319}} + + headers: + CF-RAY: + - 9cbb96b998074ada-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 12:25:22 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '243' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=xFBrroiAhYJhhmtPrQ8uxwelYOLJvUkqtWyHmjoYk3c-1770726322.171218-1.0.1.1-VBEULlr.3R_F0Sryz.FoUviQ8fICGuz4kZt84d911UUYw3UfLdcxehp11LbprMXihzqB8A1if9Klsv4bTLDmC3wzv_KQg8fMiopfb7AwQ05USUlDehUphNDw_RtEqp5S; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:22 GMT + x-request-id: + - req_2e4e48611adf479daa704eacbb07ea47 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index 6a0c53d172..03464d9aff 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -1471,4 +1471,252 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","object":"response","created_at":1770726307,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","object":"response","created_at":1770726307,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770726310}} + + headers: + CF-RAY: + - 9cbb965f5dd952c6-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 12:25:08 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '812' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=mW4o1QeHA8caz2IE8OR.dGdXC60qsfBLLKzp47MkTvk-1770726307.732058-1.0.1.1-ooLP73BzFlrqQOnISvnNHqdWYpqNwrSnUUEs6OwuuGRK5jBFl5OoVtejG9QBxNjc7BpDFCSxe8daB4B5i6fOTrmN5AcyISLU2FI3UD5sRYWtp_djjVzQBwnIq4PPQ8ru; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:08 GMT + x-request-id: + - req_94840e2dd7b5463289eacb2763259721 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770726310}} + + headers: + CF-RAY: + - 9cbb96815c16ad1b-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 12:25:13 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '383' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=zNHMwERvNAOse1YYHOJndbhqu4betfKC6LgL7T_sJNQ-1770726313.1742525-1.0.1.1-6zZ7YZlzfzlE0OQrejafUQo0hCgbjJyeBUgeBCqn6tJ2Ziw9fhClxeFKv30rZbp7R_hR3b9xo4z2Dtj4w8fUBJgyzSjR6MZIR2oTuvhaeAi2F0M7ubfnJccJuVkdr17X; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:13 GMT + x-request-id: + - req_ce73677429df44f581ed70930b54a494 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index abc4be2f6d..47d767b41e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -876,4 +876,128 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_097434ae4051689200698b23a2a32c81a0bea8ed92ce821cd9","object":"response","created_at":1770726306,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_097434ae4051689200698b23a2a32c81a0bea8ed92ce821cd9","object":"response","created_at":1770726306,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"EraXvNfv3JTC","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"wKX4aJFRefrFl","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"le58JaBV1nSBWt","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"kcum1dN31DN","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"Z8yotDPRZOKTgGY","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_097434ae4051689200698b23a2a32c81a0bea8ed92ce821cd9","object":"response","created_at":1770726306,"status":"completed","background":false,"completed_at":1770726307,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cbb96584c264243-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Tue, 10 Feb 2026 12:25:06 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '58' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=uMeMUqRdupJl1sFolk3sqFiqOg_jUTWHfF.IKbQgzTc-1770726306.6050355-1.0.1.1-Kv5WQ_j9NRnHq9A52nDzX.Me.TS_vBTuKMzPcTZlzrv2sCZoAV2O_j550uoxjebsLjwG65EzzAm2VtfTa6ZaBBld1kEbUYv4RTluFCfep0g2qjcfVbH3sw_gM.CHNpTr; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 + 12:55:06 GMT + x-request-id: + - req_7b2e832d0adb4290af1353e80c34b93f + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index 952aeed937..3c9b77d9f0 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -140,10 +140,6 @@ def test_responses_stream_existing_response( assert len(spans) == span_count + 2 stream_and_retrieve_spans = spans[span_count:] - operation_names = { - span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) - for span in stream_and_retrieve_spans - } retrieval_operation = getattr( GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None ) @@ -152,7 +148,10 @@ def test_responses_stream_existing_response( if retrieval_operation is not None else "retrieval" ) - assert operation_names == { + assert { + span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) + for span in stream_and_retrieve_spans + } == { GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, retrieval_operation_name, } @@ -163,20 +162,13 @@ def test_responses_stream_existing_response( == GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value ) - input_tokens = ( - final_response.usage.input_tokens if final_response.usage else None - ) - output_tokens = ( - final_response.usage.output_tokens if final_response.usage else None - ) - assert_all_attributes( stream_span, final_response.model, final_response.id, final_response.model, - input_tokens, - output_tokens, + final_response.usage.input_tokens if final_response.usage else None, + final_response.usage.output_tokens if final_response.usage else None, operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, response_service_tier=final_response.service_tier, ) From 3f69b56b61e0b0c9061c7f9d7ba1bf4645d07bfe Mon Sep 17 00:00:00 2001 From: Teja Date: Wed, 11 Feb 2026 23:59:18 -0500 Subject: [PATCH 12/20] Enhance OpenAI instrumentation with new response handling and telemetry support - Added `opentelemetry-util-genai` as a dependency for improved telemetry handling. - Refactored response handling in `patch_responses.py` to utilize `TelemetryHandler` for tracing. - Updated `responses_create` and `responses_retrieve` methods to integrate new telemetry features. - Simplified imports and removed unused code in `__init__.py`. - Added extensive test cases and YAML cassettes for various response scenarios, including streaming and standard responses. - Adjusted requirements files to include the new utility package for testing. --- .../pyproject.toml | 3 +- .../instrumentation/openai_v2/__init__.py | 33 +- .../openai_v2/patch_responses.py | 527 +++----- .../cassettes/test_responses_create.yaml | 605 ++++++++++ .../cassettes/test_responses_retrieve.yaml | 1058 +++++++++++++++++ ...ses_retrieve_stream_existing_response.yaml | 831 +++++++++++++ ...st_responses_stream_existing_response.yaml | 840 +++++++++++++ .../test_responses_stream_new_response.yaml | 467 ++++++++ .../tests/requirements.latest.txt | 1 + .../tests/requirements.oldest.txt | 1 + .../tests/test_responses.py | 18 +- 11 files changed, 3997 insertions(+), 387 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml index 6190dd2175..1da3355b94 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml @@ -27,7 +27,8 @@ classifiers = [ dependencies = [ "opentelemetry-api ~= 1.37", "opentelemetry-instrumentation ~= 0.58b0", - "opentelemetry-semantic-conventions ~= 0.58b0" + "opentelemetry-semantic-conventions ~= 0.58b0", + "opentelemetry-util-genai >= 0.2b0, <0.3b0", ] [project.optional-dependencies] diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index 02c6155db5..2194e78ab6 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -60,11 +60,7 @@ chat_completions_create, embeddings_create, ) -from .patch_responses import ( - responses_create, - responses_retrieve, - responses_stream, -) +from .patch_responses import responses_create, responses_retrieve class OpenAIInstrumentor(BaseInstrumentor): @@ -136,31 +132,29 @@ def _instrument(self, **kwargs): # Responses API is only available in openai>=1.66.0 # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 try: - wrap_function_wrapper( - module="openai.resources.responses.responses", - name="Responses.create", - wrapper=responses_create( - tracer, logger, instruments, is_content_enabled() - ), + from opentelemetry.util.genai.handler import ( # pylint: disable=import-outside-toplevel + TelemetryHandler, + ) + + handler = TelemetryHandler( + tracer_provider=tracer_provider, + meter_provider=meter_provider, + logger_provider=logger_provider, ) wrap_function_wrapper( module="openai.resources.responses.responses", - name="Responses.stream", - wrapper=responses_stream( - tracer, logger, instruments, is_content_enabled() - ), + name="Responses.create", + wrapper=responses_create(handler, is_content_enabled()), ) wrap_function_wrapper( module="openai.resources.responses.responses", name="Responses.retrieve", - wrapper=responses_retrieve( - tracer, logger, instruments, is_content_enabled() - ), + wrapper=responses_retrieve(handler, is_content_enabled()), ) except (AttributeError, ModuleNotFoundError): - # Responses API not available in this version of openai + # Responses API or TelemetryHandler not available pass def _uninstrument(self, **kwargs): @@ -175,7 +169,6 @@ def _uninstrument(self, **kwargs): # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 try: unwrap(openai.resources.responses.responses.Responses, "create") - unwrap(openai.resources.responses.responses.Responses, "stream") unwrap(openai.resources.responses.responses.Responses, "retrieve") except (AttributeError, ModuleNotFoundError): # Responses API not available in this version of openai diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index fbf2d57bce..93e13f0cf9 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -12,173 +12,94 @@ # See the License for the specific language governing permissions and # limitations under the License. -from timeit import default_timer -from typing import Any, Optional +from typing import TYPE_CHECKING, Any -from opentelemetry._logs import Logger from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, ) -from opentelemetry.semconv.attributes import ( - error_attributes as ErrorAttributes, -) -from opentelemetry.trace import Span, SpanKind, Tracer -from opentelemetry.trace.status import Status, StatusCode -from .instruments import Instruments +if TYPE_CHECKING: + from opentelemetry.util.genai.handler import TelemetryHandler + from opentelemetry.util.genai.types import LLMInvocation + from .utils import ( - _record_metrics, get_llm_request_attributes, - handle_span_exception, is_streaming, - set_span_attribute, ) +OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value + def responses_create( - tracer: Tracer, - logger: Logger, - instruments: Instruments, + handler: "TelemetryHandler", capture_content: bool, ): """Wrap the `create` method of the `Responses` class to trace it.""" # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L828 - # TODO: Consider migrating Responses instrumentation to TelemetryHandler - # once content capture and streaming hooks are available. def traced_method(wrapped, instance, args, kwargs): + from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel + Error, + LLMInvocation, + ) + + operation_name = ( + GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value + ) span_attributes = get_llm_request_attributes( kwargs, instance, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + operation_name, + ) + request_model = str( + span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL) + or "unknown" ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL]}" streaming = is_streaming(kwargs) + invocation = handler.start_llm( + LLMInvocation( + request_model=request_model, + operation_name=operation_name, + provider=OPENAI, + attributes=span_attributes.copy(), + metric_attributes={ + GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name + }, + ) + ) - with tracer.start_as_current_span( - name=span_name, - kind=SpanKind.CLIENT, - attributes=span_attributes, - end_on_exit=False, - ) as span: - start = default_timer() - result = None - error_type = None - try: - result = wrapped(*args, **kwargs) - if hasattr(result, "parse"): - # result is of type LegacyAPIResponse, call parse to get the actual response - parsed_result = result.parse() - else: - parsed_result = result - - if streaming: - return ResponseStreamWrapper( - parsed_result, - span, - logger, - capture_content, - record_metrics=True, - instruments=instruments, - request_attributes=span_attributes, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - start_time=start, - ) - - if span.is_recording(): - _set_responses_response_attributes( - span, parsed_result, capture_content - ) - - span.end() - return result - - except Exception as error: - error_type = type(error).__qualname__ - handle_span_exception(span, error) - raise - finally: - if not streaming or result is None: - duration = max((default_timer() - start), 0) - _record_metrics( - instruments, - duration, - result, - span_attributes, - error_type, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - - return traced_method - - -def responses_stream( - tracer: Tracer, - logger: Logger, - instruments: Instruments, - capture_content: bool, -): - """Wrap the `stream` method of the `Responses` class to trace it.""" - # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L966 + try: + result = wrapped(*args, **kwargs) + if hasattr(result, "parse"): + parsed_result = result.parse() + else: + parsed_result = result + + if streaming: + return ResponseStreamWrapper( + parsed_result, + handler, + invocation, + capture_content, + ) - def traced_method(wrapped, instance, args, kwargs): - # If this is creating a new response, the create() wrapper will handle tracing. - # This is done to avoid duplicate span creation. https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1036 - if "response_id" not in kwargs and "starting_after" not in kwargs: - return wrapped(*args, **kwargs) + _set_invocation_response_attributes( + invocation, parsed_result, capture_content + ) + handler.stop_llm(invocation) + return result - span_attributes = get_llm_request_attributes( - {}, - instance, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" - - with tracer.start_as_current_span( - name=span_name, - kind=SpanKind.CLIENT, - attributes=span_attributes, - end_on_exit=False, - ) as span: - error_type = None - try: - manager = wrapped(*args, **kwargs) - return ResponseStreamManagerWrapper( - manager, - lambda stream: ResponseStreamWrapper( - stream, - span, - logger, - capture_content, - record_metrics=True, - instruments=instruments, - request_attributes=span_attributes, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - start_time=default_timer(), - ), - ) - except Exception as error: - error_type = type(error).__qualname__ - handle_span_exception(span, error) - raise - finally: - if error_type is not None: - _record_metrics( - instruments, - 0, - None, - span_attributes, - error_type, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, - ) + except Exception as error: + handler.fail_llm( + invocation, Error(message=str(error), type=type(error)) + ) + raise return traced_method def responses_retrieve( - tracer: Tracer, - logger: Logger, - instruments: Instruments, + handler: "TelemetryHandler", capture_content: bool, ): """Wrap the `retrieve` method of the `Responses` class to trace it.""" @@ -189,128 +110,100 @@ def responses_retrieve( operation_name = retrieval_enum.value if retrieval_enum else "retrieval" def traced_method(wrapped, instance, args, kwargs): + from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel + Error, + LLMInvocation, + ) + span_attributes = get_llm_request_attributes( {}, instance, operation_name, ) - span_name = f"{span_attributes[GenAIAttributes.GEN_AI_OPERATION_NAME]} {span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL, 'unknown')}" + request_model = str( + span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL) + or "unknown" + ) streaming = is_streaming(kwargs) - with tracer.start_as_current_span( - name=span_name, - kind=SpanKind.CLIENT, - attributes=span_attributes, - end_on_exit=False, - ) as span: - start = default_timer() - result = None - error_type = None - try: - result = wrapped(*args, **kwargs) - if hasattr(result, "parse"): - parsed_result = result.parse() - else: - parsed_result = result - - if streaming: - return ResponseStreamWrapper( - parsed_result, - span, - logger, - capture_content, - record_metrics=True, - instruments=instruments, - request_attributes=span_attributes, - operation_name=operation_name, - start_time=start, - ) - - if ( - GenAIAttributes.GEN_AI_REQUEST_MODEL not in span_attributes - and getattr(parsed_result, "model", None) - ): - span_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( - parsed_result.model - ) - if span.is_recording(): - set_span_attribute( - span, - GenAIAttributes.GEN_AI_REQUEST_MODEL, - parsed_result.model, - ) - if hasattr(span, "update_name"): - span.update_name( - f"{operation_name} {parsed_result.model}" - ) - - if span.is_recording(): - _set_responses_response_attributes( - span, parsed_result, capture_content - ) - - span.end() - return result - - except Exception as error: - error_type = type(error).__qualname__ - handle_span_exception(span, error) - raise - finally: - if not streaming or result is None: - duration = max((default_timer() - start), 0) - _record_metrics( - instruments, - duration, - result, - span_attributes, - error_type, - operation_name, - ) + invocation = handler.start_llm( + LLMInvocation( + request_model=request_model, + operation_name=operation_name, + provider=OPENAI, + attributes=span_attributes.copy(), + metric_attributes={ + GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name + }, + ) + ) + + try: + result = wrapped(*args, **kwargs) + if hasattr(result, "parse"): + parsed_result = result.parse() + else: + parsed_result = result + + if streaming: + return ResponseStreamWrapper( + parsed_result, + handler, + invocation, + capture_content, + ) + + _set_invocation_response_attributes( + invocation, parsed_result, capture_content + ) + handler.stop_llm(invocation) + return result + + except Exception as error: + handler.fail_llm( + invocation, Error(message=str(error), type=type(error)) + ) + raise return traced_method -def _set_responses_response_attributes( - span: Span, +def _set_invocation_response_attributes( + invocation: "LLMInvocation", result: Any, capture_content: bool, ): + del capture_content + if result is None: + return + + if getattr(result, "model", None) and ( + not invocation.request_model + or invocation.request_model == "unknown" + ): + invocation.request_model = result.model + if getattr(result, "model", None): - set_span_attribute( - span, GenAIAttributes.GEN_AI_RESPONSE_MODEL, result.model - ) + invocation.response_model_name = result.model if getattr(result, "id", None): - set_span_attribute(span, GenAIAttributes.GEN_AI_RESPONSE_ID, result.id) + invocation.response_id = result.id if getattr(result, "service_tier", None): - set_span_attribute( - span, - GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, - result.service_tier, - ) + invocation.attributes[ + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER + ] = result.service_tier if getattr(result, "usage", None): input_tokens = getattr(result.usage, "input_tokens", None) if input_tokens is None: input_tokens = getattr(result.usage, "prompt_tokens", None) - if input_tokens is not None: - set_span_attribute( - span, - GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, - input_tokens, - ) + invocation.input_tokens = input_tokens output_tokens = getattr(result.usage, "output_tokens", None) if output_tokens is None: output_tokens = getattr(result.usage, "completion_tokens", None) - if output_tokens is not None: - set_span_attribute( - span, - GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, - output_tokens, - ) + invocation.output_tokens = output_tokens class _ResponseProxy: @@ -322,39 +215,27 @@ def close(self): try: self._response.close() finally: - self._finalize(None, None) + self._finalize(None) def __getattr__(self, name): return getattr(self._response, name) class ResponseStreamWrapper: + """Wrapper for OpenAI Responses API streams using TelemetryHandler.""" + def __init__( self, stream: Any, - span: Span, - logger: Logger, + handler: "TelemetryHandler", + invocation: "LLMInvocation", capture_content: bool, - *, - record_metrics: bool, - instruments: Instruments, - request_attributes: dict, - operation_name: str, - start_time: Optional[float] = None, ): self.stream = stream - self.span = span - self.logger = logger + self.handler = handler + self.invocation = invocation self.capture_content = capture_content - self.record_metrics = record_metrics - self.instruments = instruments - self.request_attributes = request_attributes - self.operation_name = operation_name - self.start_time = ( - start_time if start_time is not None else default_timer() - ) - self._span_ended = False - self._span_name_updated = False + self._finalized = False def __enter__(self): return self @@ -362,15 +243,15 @@ def __enter__(self): def __exit__(self, exc_type, exc_val, exc_tb): try: if exc_type is not None: - self._handle_exception(exc_val) + self._fail(str(exc_val), type(exc_val) if exc_val else Exception) finally: self.close() - return False # Propagate the exception + return False def close(self): if hasattr(self.stream, "close"): self.stream.close() - self._finalize(None, None) + self._stop(None) def __iter__(self): return self @@ -381,10 +262,10 @@ def __next__(self): self.process_event(event) return event except StopIteration: - self._finalize(None, None) + self._stop(None) raise except Exception as error: - self._handle_exception(error) + self._fail(str(error), type(error)) raise def get_final_response(self): @@ -410,120 +291,58 @@ def response(self): response = getattr(self.stream, "response", None) if response is None: return None - return _ResponseProxy(response, self._finalize) - - def _handle_exception(self, error): - if self._span_ended: - return - handle_span_exception(self.span, error) - self._span_ended = True - self._record_metrics(None, type(error).__qualname__) - - def _mark_span_error(self, error_type: str, message: str): - self.span.set_status(Status(StatusCode.ERROR, message)) - if self.span.is_recording() and error_type: - self.span.set_attribute(ErrorAttributes.ERROR_TYPE, error_type) + return _ResponseProxy(response, lambda *_: self._stop(None)) - def _record_metrics(self, result, error_type: Optional[str]): - if not self.record_metrics: + def _stop(self, result: Any): + if self._finalized: return - duration = max((default_timer() - self.start_time), 0) - _record_metrics( - self.instruments, - duration, + _set_invocation_response_attributes( + self.invocation, result, - self.request_attributes, - error_type, - self.operation_name, + self.capture_content, ) + self.handler.stop_llm(self.invocation) + self._finalized = True - def _finalize( - self, - result, - error_type: Optional[str], - error_message: Optional[str] = None, - ): - if self._span_ended: + def _fail(self, message: str, error_type: type[BaseException]): + if self._finalized: return - if result and self.span.is_recording(): - _set_responses_response_attributes( - self.span, result, self.capture_content - ) - if error_type: - self._mark_span_error(error_type, error_message or error_type) - self.span.end() - self._span_ended = True - self._record_metrics(result, error_type) - - def _maybe_update_request_model(self, response): - if ( - response - and GenAIAttributes.GEN_AI_REQUEST_MODEL - not in self.request_attributes - and getattr(response, "model", None) - ): - self.request_attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] = ( - response.model - ) - if self.span.is_recording(): - set_span_attribute( - self.span, - GenAIAttributes.GEN_AI_REQUEST_MODEL, - response.model, - ) - if not self._span_name_updated and hasattr( - self.span, "update_name" - ): - self.span.update_name( - f"{self.operation_name} {response.model}" - ) - self._span_name_updated = True + from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel + Error, + ) + + self.handler.fail_llm( + self.invocation, Error(message=message, type=error_type) + ) + self._finalized = True def process_event(self, event): event_type = getattr(event, "type", None) - if event_type in {"response.created", "response.completed"}: - response = getattr(event, "response", None) - self._maybe_update_request_model(response) - if response and self.span.is_recording(): - _set_responses_response_attributes( - self.span, response, self.capture_content - ) - if event_type == "response.completed": - self._finalize(response, None) + response = getattr(event, "response", None) + + if response and ( + not self.invocation.request_model + or self.invocation.request_model == "unknown" + ): + model = getattr(response, "model", None) + if model: + self.invocation.request_model = model + + if event_type == "response.completed": + self._stop(response) return if event_type in {"response.failed", "response.incomplete"}: - response = getattr(event, "response", None) - self._maybe_update_request_model(response) - if response and self.span.is_recording(): - _set_responses_response_attributes( - self.span, response, self.capture_content - ) - self._finalize(response, event_type) + _set_invocation_response_attributes( + self.invocation, + response, + self.capture_content, + ) + self._fail(event_type, RuntimeError) return if event_type == "error": error_type = getattr(event, "code", None) or "response.error" message = getattr(event, "message", None) or error_type - self._finalize(None, error_type, message) + self._fail(message, RuntimeError) return - - -class ResponseStreamManagerWrapper: - def __init__(self, manager, wrapper_factory): - self._manager = manager - self._wrapper_factory = wrapper_factory - self._stream = None - - def __enter__(self): - stream = self._manager.__enter__() - self._stream = self._wrapper_factory(stream) - return self._stream - - def __exit__(self, exc_type, exc_val, exc_tb): - if self._stream is not None: - return self._stream.__exit__(exc_type, exc_val, exc_tb) - return self._manager.__exit__(exc_type, exc_val, exc_tb) - - def __getattr__(self, name): - return getattr(self._manager, name) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index 693bb5403e..e21fea1874 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -1347,4 +1347,609 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_08d671ab98e6b7d800698d4cf970ac819cbc43184a3e3b6fb2", + "object": "response", + "created_at": 1770867961, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770867962, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_08d671ab98e6b7d800698d4cfa04f0819cbead98e1ab843fea", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc918b6ddd8d481-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 03:46:02 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '720' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=jhyCr0.CLvXLfVnt.FNtHeA3.7VP38czYAcykw19hrk-1770867961.4132617-1.0.1.1-5iqVtG.KtdaoU4fum2qrI3i5IDAfRSMOxLf4d20RXr8WR_ymUKJL5gLrOjVMKLxTNUwFLfSQ9xR34K2xpcwGV2jBkOvfFclA0QUXnthNlYELyhJfCXmJHwiNz31Aobg5; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:02 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_1a587d2d779b4fc69008bd53562c9f4f + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_07bc67aa5352aaf800698d4ff0e0b881a1b7c39058e7ff881c", + "object": "response", + "created_at": 1770868720, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770868721, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_07bc67aa5352aaf800698d4ff1674481a1a61e8d6717d64c40", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc92b415e29db40-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 03:58:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '688' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ifZ52bt5H0wCqQ7KkP86zwUftyqSRtSUcUuPMK22TyY-1770868720.851776-1.0.1.1-HXcMonzDPmZq9mqqsy7aozrznqq9DKZpw_1BA7NdkVD6TnBzlqw9_BbNlO8QSYOYIAXJVSehHjiFLh_GOpX3zjuBT3PPcGDfmVpyPrQZy8zfJ027SgXSewVPTpmtbjkG; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:41 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_bbde805431a148c392640a6abc93efe5 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9312969f47b0b-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:02:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '17' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=A1rYA8d4AFiFQwlXYOgSUufZ1hfKtz.Tsg5oM80ub9s-1770868962.7852468-1.0.1.1-xWLT4CAuW7PbiTja0EtnHy4zFsV1BhMvQ_gYG7vdfPGvG8fwAR6dvy8QPMoA_PjNw_g11HQ_Jad0J.0Jf3x6rAqz8dfKmdQVXhg_NU2yUSF6EsyDKeiKBoubMueYVJiH; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:32:42 GMT + - _cfuvid=URv6mwaE0_NT3FCVH3lVytzg4bpA_VqC03rHSxLTx4Q-1770868962.7852468-1.0.1.1-g6hM5ABd.LbGU33hcDnwKwZgT5KPCqYhP1L3giL3vSg; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_362605ce1ed64052b084361298bbc284 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0fb74957081fdb0b00698d5164ba6c819785b68fc76f1517ad", + "object": "response", + "created_at": 1770869092, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770869093, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0fb74957081fdb0b00698d51652c908197a514612adcac8a57", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test. How can I assist you today?" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 13, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 25 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc934554d6e1512-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:04:53 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1571' + openai-organization: test_openai_org_id + openai-processing-ms: + - '904' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=SD62VIBPrWCGTDOHfjSrAp4EYq7MGj2PvSm9Mzf59Q4-1770869092.682529-1.0.1.1-AbaMKYSTrLUfnnSx.uscSOJfMIg8OBVuJPCe5yHEA4UGceY6wKprVcjmZcLoa1.cEKOVcwz44zXrOI7NmuzH5w8Gdo5xJnv6BuBARCD0vVQkgmNQe.mlFHIx9Q0f9Htz; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:34:53 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_07d567b4f2084f96aab66988162b1256 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml index 9a186a9122..843ca86cdd 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -1604,4 +1604,1062 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_05541a1cca0df86400698d4d04306c81a182d62fd2a90159be", + "object": "response", + "created_at": 1770867972, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770867972, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_05541a1cca0df86400698d4d04a74c81a19430fb29a4fb651d", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc918f9fbae4357-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 03:46:12 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '623' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=NUE.r1nIUIbb3OHZJZK2.eurdXWZ5NhiLi8aNeseaHk-1770867972.155458-1.0.1.1-0CI9ZVeb7KM8NNnO89RZ2TWo7D2Cl4GVxqyAAhSIEIWbEpnwYCPrsVGrY72hZdbMzZDWlJvVF_INvcrDityC2yjEf_33Mctky8L1TsihQHn3ClKSkpAvRi7kZKZvsLy7; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:12 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 23.791s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_f62ac7676c64448683e41b881dac1de4 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_05541a1cca0df86400698d4d04306c81a182d62fd2a90159be + response: + body: + string: |- + { + "id": "resp_05541a1cca0df86400698d4d04306c81a182d62fd2a90159be", + "object": "response", + "created_at": 1770867972, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770867972, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_05541a1cca0df86400698d4d04a74c81a19430fb29a4fb651d", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc918fea905a3fe-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 03:46:12 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '53' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=xiYV2aBh_hTr3WY5nSxptlKfrLBuB9LVnA71ZW5cwU0-1770867972.9099538-1.0.1.1-LmQtB2VpNQKVRcXjJp9R3blqFDprYYHBQRhBBOtGfTWT7TniM2Nzh6S6ZxAH9XBKikuW7AnqRIa0euZ7uXQS0WWjGUOmZTshIsHrrjs2TyeAGywq4uUjmmz8zMWiW0or; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:12 GMT + x-request-id: + - req_4c533ef234fe4323aba63d5b6c4da8eb + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_02ba1cf8e4de28d200698d4ffb95548196b22979bff89d74e6", + "object": "response", + "created_at": 1770868731, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770868732, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_02ba1cf8e4de28d200698d4ffc1f04819699411b076256f147", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc92b841d59439a-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 03:58:52 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '745' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=4gDU3X47J6w47jkxohQuFsc2glCl61IQVnC0WvVAXMM-1770868731.5373325-1.0.1.1-sD5e7CYqcLtuRC68GI82rchCcFc7b6NhWEgzc1_mfpXErij0vNNcnvHKpBqeg7mtq6I0GXk1nupYVBSaNN84tCfM5Vq20mIlXpBetexyiqjPN2a3ziilLUdf12oTGmQH; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:52 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 23.869s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_fe55d1ce62c548aabf7720e4f6cd0452 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_02ba1cf8e4de28d200698d4ffb95548196b22979bff89d74e6 + response: + body: + string: |- + { + "id": "resp_02ba1cf8e4de28d200698d4ffb95548196b22979bff89d74e6", + "object": "response", + "created_at": 1770868731, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770868732, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_02ba1cf8e4de28d200698d4ffc1f04819699411b076256f147", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc92b8a4fba1914-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 03:58:52 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '156' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=0nV_GkpQYObow.MLqbF5ppMqakzJ9MWYQFe8MltKpAY-1770868732.5213642-1.0.1.1-gCXVSwrBYAVihQMUCHedMPODrjZKeYaneaQ3xWEbHByeJEh6qoJEmYd2yNDYVxeyBPE9hiWNwEnBeEpVzHu.I5kcDrliUdFoVuebYMRmpL5eMf8zo29YeLU49vkDkP3I; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:52 GMT + x-request-id: + - req_371b1f41cc354855b25409d3f4e71603 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc93135cf6d426d-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:02:44 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '17' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=b1l39w5k3dF0mns1xOjENvWYS8l25hdgMPDLc5MKQeg-1770868964.762243-1.0.1.1-mAsPqGbz8nMeVjOhjEEMaxAo_JoG1cW8atFjqevJeYRg.KOkU4T8ppDmP2MHyqJNIT5kDG_02gwJB69quO.KUUeQxAhcfKEwmSJzzecej0eyd8QBYYv8wm.wMIeOPKJm; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:32:44 GMT + - _cfuvid=Se8jaVnVLjNVDvayi.JpyGL5h0nHibibazWpl1nQSqM-1770868964.762243-1.0.1.1-M431.rVI73_Lbk2nJnlYn1FFNa4dsVPV23psfYxEAm8; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_b669ccea0bba49e493ad1e0817e44a17 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0013af385fbc4b9a00698d516ebc20819c9efa3e81c1411605", + "object": "response", + "created_at": 1770869102, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770869103, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0013af385fbc4b9a00698d516f2650819c904c9ee9803bd108", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc93493ea647285-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:05:03 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '608' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=.vQAhDsxwX1Tz_kE2xa5rHYx5yBsXbpWrjVvOAJjNcs-1770869102.7068415-1.0.1.1-Eg1TznzHwqAEM2YexqMx_4L8lSak.SwMmrBim_3hvLgkcoBIwrk4YF.FqVX6UrOMS1eL60wD04Kq9uuxG3lEEeJboxXqeFrNevmJ8jxMyvQx6P1iKeInQ3lf0RhLb085; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:35:03 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 24.667s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_c972081d9a2d4ee58cf1d23082eae7d5 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0013af385fbc4b9a00698d516ebc20819c9efa3e81c1411605 + response: + body: + string: |- + { + "id": "resp_0013af385fbc4b9a00698d516ebc20819c9efa3e81c1411605", + "object": "response", + "created_at": 1770869102, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770869103, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0013af385fbc4b9a00698d516f2650819c904c9ee9803bd108", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc934987e8d0f47-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:05:03 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '205' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=lwPGifuWWOtpEAVJw4Fq6hUiNCPibYlvw8k1pauglUo-1770869103.4377072-1.0.1.1-7VgkV29BhJVQW8u8XMMzR71DlyfsZoWhsQHM9j5z8qo2dKNpFTeQ2RSrDCUJS5j08xUfX0rXW0u012yxKOdHUhAgLDo.Aqwz2fm3ZK.OY8zDy064I6axUjlo6Jh9ypPN; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:35:03 GMT + x-request-id: + - req_5dd0015773af4f13b0f3e88a1fae6458 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml index 8d18406adf..aabc2a0ed6 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -1266,4 +1266,835 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","object":"response","created_at":1770867973,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","object":"response","created_at":1770867973,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867976}} + + headers: + CF-RAY: + - 9cc919008b70427f-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:46:14 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '882' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=EkAill4Lzj8Lv1LbFAW0ytL4hg9B9DuUrhxQ3.UXaXE-1770867973.2023118-1.0.1.1-jjZLkAHT_kqE7Crd.6WA.UD8MjILiIICQpTpfksFqXRyH5dIUkfrhVy9EwytsinI5y8d5ov37LGm7aCk8iWI15QLaxXrlzBD2aUX9jJEomRy59MIxc0mL5m8sR.aJc7z; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:14 GMT + x-request-id: + - req_8a532ef2b07a474398ec418868d22d84 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867976}} + + headers: + CF-RAY: + - 9cc919268ea74815-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:46:19 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '575' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=tfTnUUMulj7boML.T3AWUvOf0fAPP9Of1wVwP.DXPOw-1770867979.2823195-1.0.1.1-n6Ww5kW7WGymYAQZP.YRLDBiuCFV8qLCe2L5j91dLvhgep3btIcwUZxAEgIpGEjKAv_VI0CyWONKBRu5vixXOt8a0qbRbW8pPpFpZu2lj9doXYUPxfup6A9tyNdbLBEN; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:19 GMT + x-request-id: + - req_d5df33e4b904424cbf71805fb6623642 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","object":"response","created_at":1770868732,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","object":"response","created_at":1770868732,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770868737}} + + headers: + CF-RAY: + - 9cc92b8c8a81ae12-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:58:53 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '948' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=S6inzg3tp65d9arT43vi7bcbtzlcXg3IzX9padquF_o-1770868732.8857043-1.0.1.1-8K2nonvw.Y1ccHgR6BfAhEhSNT7xp.0Jv3E.jxGGOK8zi.bqV2EldonZGHnkKuffYRc8ABPNaUdaVddIVihCg334hUoYA0SIzF.bG8U0OUbt4W4zYeSj.QneyVK6vX57; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:53 GMT + x-request-id: + - req_5b901113c5fd4871b346ec49394c2f22 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770868737}} + + headers: + CF-RAY: + - 9cc92bb97f017a02-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:59:00 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '590' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=fL3Fsxk98j4FgsmIL1HiPJEHshFEtzisIwi1gzSFEGQ-1770868740.078156-1.0.1.1-Se3QEV_E9KG9EIQjc1h3LmV4P4s_2qFcUtM0_gBRKqcu6n1Hl2ljAOb5JQyjVRBloh2YY4vEDs88__Qixj1RgoBvS0L.I15RzYu6GHeyM7WikBCFpzQnd9WlKMfveHGX; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:29:00 GMT + x-request-id: + - req_0fe5da8bd1c047519942a57f61daa72a + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc93137ecb33d64-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:02:45 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '22' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=8.9kOe1mJT3itzHUAte1fq94l_Zmlgtp9zU6yqQJGK0-1770868965.1036782-1.0.1.1-OllVCCNLXsOr4fxU1tYP8GLcxl7PhUBtghNSpxOr4ZOzDGUFcnvdmH9NBibwlpeQcYttNQaWHYeD2wvfXgURUkNJIjSIw0MqQBZ1mlgcdlrKccivwXvEVXWTWBxUL6BB; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:32:45 GMT + - _cfuvid=NvGyqu6KryDhyBi0NfG1W2Yrvow8lNLWO5BNlDFYDL0-1770868965.1036782-1.0.1.1-NCfEj2gObb1aa_onIud0DjrfJX6nMwiuqA.aBPKVix0; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_d5695e1eb4c7490eb4672efcf49cea23 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","object":"response","created_at":1770869103,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","object":"response","created_at":1770869103,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869105}} + + headers: + CF-RAY: + - 9cc9349b68327a99-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 04:05:04 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '860' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=MxgzwQjnEPWDnYf0Skune2weBbdEuSJgLFFkf5PxFYE-1770869103.9061773-1.0.1.1-qhYSnH2YYIRVwkV6rUXyWob9WvksjxGHeCFfhpjhoH0Flj4Pr6T7YLuT55b5sOiqDeVLRxwHKXT6lY2a_Lr2LZbsBtfvEy.73ntE061HhBNQu_Q5miawwqpgDqyaVgJk; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:35:04 GMT + x-request-id: + - req_f011176916674d5aa8419537732be3de + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869105}} + + headers: + CF-RAY: + - 9cc934b8bd2442bc-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 04:05:09 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '555' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=bh1kq.Q2sm9Y5Ax.NtTQEn2Mx7RsLl2Seok6lUlwKt8-1770869108.5924356-1.0.1.1-znkHTpBveNkhQ_gY_SsYpmiyaZZfIKu9qJximbahBo3v__aNLj3HjcqevSpVNin.s8rtr045V9jJLHgRYbTZWzPxb39njfHriVicb8fTah_OJojuneTm73XWGj6l3ya9; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:35:09 GMT + x-request-id: + - req_8865c8d841064aa896baee290211471c + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index 03464d9aff..876103c930 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -1719,4 +1719,844 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","object":"response","created_at":1770867964,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","object":"response","created_at":1770867964,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867966}} + + headers: + CF-RAY: + - 9cc918c42ff20c23-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:46:04 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '705' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=hHMNOWHo644IWEIG1UG1mLCF4MSPa394V3CENTmqSDc-1770867963.547861-1.0.1.1-hOPW3Ir6a2l8jUIuSXmxL_Wjn9Du3cFZkwqbvp06JL4.Lc9LBwST.mfYe_e3_xlcAYA0CH7GMk3GwCzz35t.tOdKF6sya4psWfC8CqbSmupZA75b301Jr25yo5t_6_fD; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:04 GMT + x-request-id: + - req_6f11ef0c44644b91a229757a581e49f0 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867966}} + + headers: + CF-RAY: + - 9cc918e94e257327-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:46:09 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '461' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=8EJcpwKJqn3Oo1ThW.X6IDbZbSWAiBqfu2gW.c_r7G4-1770867969.490054-1.0.1.1-54S9E5zktvTQ8yzVphIJB2x1eFOjV3s7b6a3Nliu0zz0SWVcPAFCq55CCvLqoQMaF2IQv793I7aLc5rntEnrNmDSnKZdwIPpUZgiof1WL6WJRvp44.KwE9L20mvPV0dS; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:09 GMT + x-request-id: + - req_ef90fb883284473ab8506549cc595da3 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","object":"response","created_at":1770868722,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","object":"response","created_at":1770868722,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770868725}} + + headers: + CF-RAY: + - 9cc92b4e093d2633-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:58:43 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '887' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=teq1DElI45Gh4uJXv2Zh1oe8pEPp1drOXGOeXo.aWNw-1770868722.8885946-1.0.1.1-TuuFiPg4cw.ZoYwDUUp8KBCrGi.Baj3fV_u1MDJzPCUddvkRY7jJAUhTGrerYBBWgL8bxbsPdprVpE09.JcpUlAV5sSvuwXk8ffMJqGH7szOWVKNs3YALxYiVn1VWwB1; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:43 GMT + x-request-id: + - req_bdd57a0aea33459db4c4ac32078b3b32 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770868725}} + + headers: + CF-RAY: + - 9cc92b738b99c3f3-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:58:49 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '512' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=jFvZqbvfZV_x8HqXEHPVzSra2swNP6HwIBipN4t_7UE-1770868728.882983-1.0.1.1-yiS9EjgQEH4rJeUBHkIvZiJlLA24lX21OsVT5zySA0YTAK57npNMK9rjNruv8Wmf2QGOJ3doabyuQk4NyJhuOyGr8pd1Pdv_q7vZKcOl_6P1uxHqwK2Ufejf7_QGeELM; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:49 GMT + x-request-id: + - req_a737f120bc134517a2bb47d3ac4204e4 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc931335b42c674-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:02:44 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '21' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=cN6HXXe09u4no3T0rObH8_OxeqmJxiQcPUbj1ezHo7g-1770868964.372188-1.0.1.1-Bkj7Z93thGzqZC3dHM8NhCIiMwEZVlfHfOjIt2OTRCdpDhqgDJqQf8SpSrMDkzBqrJbEmqqS8OZLGzwYPUwkGUHYPflUypEyKnaSHfSzKXKQ77kEARMURqDwLQG7UYCL; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:32:44 GMT + - _cfuvid=GsMYUkDzTk4hSN1MCu_iwj6KMwDJ2.i4jEkH1f9u9hY-1770868964.372188-1.0.1.1-PVRU5DH6bob6DFVzsKThM7EzX6V6sE0Sw_xGKN977XI; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_5046f2b79335432cad001c773a0a1679 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","object":"response","created_at":1770869095,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","object":"response","created_at":1770869095,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869097}} + + headers: + CF-RAY: + - 9cc93464cc323f3b-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 04:04:55 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '751' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=lnOqjz_NdrPw56zGUXT1ONU1FoLy3dZsbtHNOwoTE_Q-1770869095.1610901-1.0.1.1-D3abIBlAAXr.z0oUIlajbmlnZh8nmdaUqd9yBYQo5SmzIneAlGrdGsUN6ruGF6ceQ54OgRCj22nKF_zjtb2WfW1U2bDrylXe90OH1kywHpULlXiqxa4HcGj3GXowETma; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:34:55 GMT + x-request-id: + - req_fca581118c2c41fe89dfc6cfc3c54a66 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869097}} + + headers: + CF-RAY: + - 9cc934868a8497d2-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 04:05:00 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '338' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=qscB_G3Lcys_gMNnvnYi5TDCFd1X3WlyEuzm0XSHi1A-1770869100.5632508-1.0.1.1-BA0VdYJilIy24H8Jprhlsn1FHX48s7ipHyO0K67ylH9mFFEzX.dK5apn_NUe6877xm7PQpxJT7kd6TXbSDLgZms5vG.jvFYt14MkkN5jhufjerZaf_jLEsaB5PxzZ8YG; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:35:00 GMT + x-request-id: + - req_2a2fc75ed57b42f6a4e4451bb49f0384 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index 47d767b41e..53a2b838cc 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -1000,4 +1000,471 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_06255fe8727259cc00698d4cfa7c608197b17558a06e6b2be0","object":"response","created_at":1770867962,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_06255fe8727259cc00698d4cfa7c608197b17558a06e6b2be0","object":"response","created_at":1770867962,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"8iYxwtFtjRKK","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"6oz4SRoxoS3a0","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"PzijEf00s761LR","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"eSD8uz8AXBI","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"06YMcDBckV0iCgd","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_06255fe8727259cc00698d4cfa7c608197b17558a06e6b2be0","object":"response","created_at":1770867962,"status":"completed","background":false,"completed_at":1770867963,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cc918bd4a970ab9-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:46:02 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '65' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=8pkFzP3eHObkLs08oqs8n8lAZGYl8DBWEiHHvRlrd.I-1770867962.44136-1.0.1.1-vyF34L00PIKO8k6UmHEy6tflDtgJvFsCtxuwYtlkDTtRBtcqMp5g__yIwC9tWSxHeCHxkv2RkdfiA.IAyC8qCm5CJ3M7kuV8EZhyuVXNbwIBbA3YkFNCnKLk9pz48U_v; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:16:02 GMT + x-request-id: + - req_79666ac6d4bb4277a1a1a87b45904673 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0b79093d54332ed400698d4ff1e390819486e6134fd9a50a67","object":"response","created_at":1770868721,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0b79093d54332ed400698d4ff1e390819486e6134fd9a50a67","object":"response","created_at":1770868721,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"DY3FiwfxIUnm","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"fxTGZIpsyU1j1","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"xHZXEHW15pIhyv","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"xxcOTf0yIIK","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"7oQhAbP76wmzTQh","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0b79093d54332ed400698d4ff1e390819486e6134fd9a50a67","object":"response","created_at":1770868721,"status":"completed","background":false,"completed_at":1770868722,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cc92b477ec6de96-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 03:58:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '150' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=2LauqUm4Qyh6qhR__ZrkJk6X3B8gWs3iqQHZB6kOGB0-1770868721.8325293-1.0.1.1-TjIWnbd1WkhGqi7Oo5oc.PcgnBUSDH4OxSqQiaRkXUq04OqmP6ZJVvgjVeaSjhPDftHhKTpgjHEkjKQia8inwhvt8cHaYQ49YcAVdRUA2qos4Ef2Bn8oomaY4f6MyZ66; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:28:42 GMT + x-request-id: + - req_cfcaed1ec69e4545997f5f2063a93faa + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9312b8a5a1a38-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 04:02:44 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '37' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=dDAYLZoNyURI67ucUyfBauZrO8itX7GKzlbp50d3OBw-1770868963.1219938-1.0.1.1-kKDfr24jqtjDOGBl_zHuZKk_u7pexslp5FEjAgvBiypFiXILexI6kKX4aUj1Wi39ogYFXJPKjJsaCVctekI0SaIMdJr8WpTPACzq4c4pGaA3b86HIRz4d_CHZxPxmjbP; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:32:44 GMT + - _cfuvid=C9jQarVe_H7QET71.9mG6JxfTHzsqofOESS7MhiRVTU-1770868963.1219938-1.0.1.1-gHIac5B3..g6oFWAYDKhC0HtPQMdUEcPCc.77LOem4w; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_b5c464e057eb4e0f92138861cb4631d4 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_067728eebf486ac800698d5165eaec819fa5e24aa7d6e7318d","object":"response","created_at":1770869093,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_067728eebf486ac800698d5165eaec819fa5e24aa7d6e7318d","object":"response","created_at":1770869093,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"6jSVePP2ajm8","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"v0LwdCkxbYFVv","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"WMgOsZBxtLgyWh","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"JHVJAL4eQZF","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"RY9fj5dgls1vjci","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_067728eebf486ac800698d5165eaec819fa5e24aa7d6e7318d","object":"response","created_at":1770869093,"status":"completed","background":false,"completed_at":1770869094,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cc9345ccda126df-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 04:04:53 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '37' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=DlWrD6_ozIOhQCzVfnfoh9udPIKWhuNEpQTSkCiY2gA-1770869093.889876-1.0.1.1-ZsVBDROTo0sOTS4esDjdqUIxGHVTSDpsxawcAsY8o5BEvksroz28S1u69uAXvc1b2PWBydnfEbxRdXXpLA2zEXK7X0CQ448KS27dwNdan8r41u2NJIFTCTtTeNFH4Wa8; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 04:34:53 GMT + x-request-id: + - req_26ed73960a244ad7a4f611b3e0c78746 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.latest.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.latest.txt index 2e29be5222..d8be3b03c4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.latest.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.latest.txt @@ -51,4 +51,5 @@ wrapt==1.16.0 # test with the latest version of opentelemetry-api, sdk, and semantic conventions -e opentelemetry-instrumentation +-e util/opentelemetry-util-genai -e instrumentation-genai/opentelemetry-instrumentation-openai-v2 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.oldest.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.oldest.txt index 979b7a5bae..00ba7b9ee4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.oldest.txt +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.oldest.txt @@ -32,4 +32,5 @@ opentelemetry-api==1.37 # when updating, also update in pyproject.toml opentelemetry-sdk==1.37 # when updating, also update in pyproject.toml opentelemetry-semantic-conventions==0.58b0 # when updating, also update in pyproject.toml +-e util/opentelemetry-util-genai -e instrumentation-genai/opentelemetry-instrumentation-openai-v2 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index 3c9b77d9f0..b5f406dc07 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -137,9 +137,9 @@ def test_responses_stream_existing_response( assert final_response is not None spans = span_exporter.get_finished_spans() - assert len(spans) == span_count + 2 + assert len(spans) == span_count + 1 - stream_and_retrieve_spans = spans[span_count:] + retrieve_spans = spans[span_count:] retrieval_operation = getattr( GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None ) @@ -150,26 +150,20 @@ def test_responses_stream_existing_response( ) assert { span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) - for span in stream_and_retrieve_spans + for span in retrieve_spans } == { - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, retrieval_operation_name, } - stream_span = next( - span - for span in stream_and_retrieve_spans - if span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) - == GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value - ) + retrieve_span = retrieve_spans[0] assert_all_attributes( - stream_span, + retrieve_span, final_response.model, final_response.id, final_response.model, final_response.usage.input_tokens if final_response.usage else None, final_response.usage.output_tokens if final_response.usage else None, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + operation_name=retrieval_operation_name, response_service_tier=final_response.service_tier, ) From 9eeac242131c5ef485cfdf3d57bc3cd19ddbf848 Mon Sep 17 00:00:00 2001 From: Teja Date: Thu, 12 Feb 2026 00:35:31 -0500 Subject: [PATCH 13/20] Refactor OpenAI instrumentation to enhance content capture and telemetry features - Updated `responses_create` and `responses_retrieve` methods to streamline content capture logic. - Introduced helper functions for extracting input and output messages, and system instructions. - Enhanced telemetry support by integrating content capture based on experimental mode settings. - Added new test cases to validate content capture functionality in various scenarios, including streaming and standard responses. - Created YAML cassettes for testing response handling and content capture behavior. - Simplified imports and removed unused code in `__init__.py` and `patch_responses.py`. --- .../instrumentation/openai_v2/__init__.py | 4 +- .../openai_v2/patch_responses.py | 182 ++++- .../instrumentation/openai_v2/utils.py | 3 +- .../cassettes/test_responses_create.yaml | 340 ++++++++++ ...est_responses_create_captures_content.yaml | 267 ++++++++ ...es_create_captures_system_instruction.yaml | 269 ++++++++ ...reate_no_content_in_experimental_mode.yaml | 267 ++++++++ .../cassettes/test_responses_retrieve.yaml | 642 ++++++++++++++++++ ...ses_retrieve_stream_existing_response.yaml | 490 +++++++++++++ ...est_responses_stream_captures_content.yaml | 221 ++++++ ...st_responses_stream_existing_response.yaml | 496 ++++++++++++++ .../test_responses_stream_new_response.yaml | 269 ++++++++ ...tream_no_content_in_experimental_mode.yaml | 221 ++++++ .../tests/conftest.py | 58 ++ .../tests/test_responses.py | 170 ++++- 15 files changed, 3884 insertions(+), 15 deletions(-) create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index 2194e78ab6..ae4fce8be0 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -145,13 +145,13 @@ def _instrument(self, **kwargs): wrap_function_wrapper( module="openai.resources.responses.responses", name="Responses.create", - wrapper=responses_create(handler, is_content_enabled()), + wrapper=responses_create(handler), ) wrap_function_wrapper( module="openai.resources.responses.responses", name="Responses.retrieve", - wrapper=responses_retrieve(handler, is_content_enabled()), + wrapper=responses_retrieve(handler), ) except (AttributeError, ModuleNotFoundError): # Responses API or TelemetryHandler not available diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index 93e13f0cf9..68f3c66df6 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging from typing import TYPE_CHECKING, Any from opentelemetry.semconv._incubating.attributes import ( @@ -27,9 +28,153 @@ is_streaming, ) +_logger = logging.getLogger(__name__) + OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value +# --------------------------------------------------------------------------- +# Content capture helpers +# --------------------------------------------------------------------------- + + +def _should_capture_content() -> bool: + """Return True when content conversion should be performed. + + Mirrors the Anthropic instrumentation pattern: only extract content when + experimental mode is active and a content-capturing mode is set. + """ + from opentelemetry.util.genai.utils import ( # pylint: disable=import-outside-toplevel + ContentCapturingMode, + get_content_capturing_mode, + is_experimental_mode, + should_emit_event, + ) + + if not is_experimental_mode(): + return False + mode = get_content_capturing_mode() + if mode == ContentCapturingMode.NO_CONTENT: + return False + if mode == ContentCapturingMode.EVENT_ONLY and not should_emit_event(): + return False + return True + + +def _extract_system_instruction(kwargs: dict): + """Extract system instruction from the ``instructions`` parameter.""" + from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel + Text, + ) + + instructions = kwargs.get("instructions") + if instructions is None: + return [] + if isinstance(instructions, str): + return [Text(content=instructions)] + return [] + + +def _extract_input_messages(kwargs: dict): + """Extract input messages from Responses API kwargs. + + The Responses API ``input`` parameter can be: + - A string (simple text input) + - A list of message items (with role and content) + """ + from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel + InputMessage, + Text, + ) + + raw_input = kwargs.get("input") + if raw_input is None: + return [] + + if isinstance(raw_input, str): + return [InputMessage(role="user", parts=[Text(content=raw_input)])] + + messages = [] + if isinstance(raw_input, list): + for item in raw_input: + role = getattr(item, "role", None) or ( + item.get("role") if isinstance(item, dict) else None + ) + if not role: + continue + content = getattr(item, "content", None) or ( + item.get("content") if isinstance(item, dict) else None + ) + if isinstance(content, str): + messages.append( + InputMessage(role=role, parts=[Text(content=content)]) + ) + elif isinstance(content, list): + parts = [] + for part in content: + text = getattr(part, "text", None) or ( + part.get("text") if isinstance(part, dict) else None + ) + if text: + parts.append(Text(content=text)) + if parts: + messages.append(InputMessage(role=role, parts=parts)) + return messages + + +def _extract_output_messages(result: Any): + """Extract output messages from a Responses API result. + + The response ``output`` field is a list of output items. Items with + type ``"message"`` contain content blocks (output_text, refusal, etc.). + """ + from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel + OutputMessage, + Text, + ) + + if result is None: + return [] + + output_items = getattr(result, "output", None) + if not output_items: + return [] + + messages = [] + for item in output_items: + item_type = getattr(item, "type", None) + if item_type != "message": + continue + + role = getattr(item, "role", "assistant") + status = getattr(item, "status", None) + finish_reason = "stop" if status == "completed" else (status or "stop") + + content_blocks = getattr(item, "content", []) + parts = [] + for block in content_blocks: + block_type = getattr(block, "type", None) + if block_type == "output_text": + text = getattr(block, "text", None) + if text: + parts.append(Text(content=text)) + elif block_type == "refusal": + refusal = getattr(block, "refusal", None) + if refusal: + parts.append(Text(content=refusal)) + + messages.append( + OutputMessage(role=role, parts=parts, finish_reason=finish_reason) + ) + + return messages + + +# --------------------------------------------------------------------------- +# Patch functions +# --------------------------------------------------------------------------- + + def responses_create( handler: "TelemetryHandler", capture_content: bool, @@ -44,7 +189,7 @@ def traced_method(wrapped, instance, args, kwargs): ) operation_name = ( - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value + GenAIAttributes.GenAiOperationNameValues.CHAT.value ) span_attributes = get_llm_request_attributes( kwargs, @@ -56,11 +201,19 @@ def traced_method(wrapped, instance, args, kwargs): or "unknown" ) streaming = is_streaming(kwargs) + + capture_content = _should_capture_content() invocation = handler.start_llm( LLMInvocation( request_model=request_model, operation_name=operation_name, provider=OPENAI, + input_messages=_extract_input_messages(kwargs) + if capture_content + else [], + system_instruction=_extract_system_instruction(kwargs) + if capture_content + else [], attributes=span_attributes.copy(), metric_attributes={ GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name @@ -126,6 +279,7 @@ def traced_method(wrapped, instance, args, kwargs): ) streaming = is_streaming(kwargs) + capture_content = _should_capture_content() invocation = handler.start_llm( LLMInvocation( request_model=request_model, @@ -168,12 +322,16 @@ def traced_method(wrapped, instance, args, kwargs): return traced_method +# --------------------------------------------------------------------------- +# Response attribute extraction +# --------------------------------------------------------------------------- + + def _set_invocation_response_attributes( invocation: "LLMInvocation", result: Any, capture_content: bool, ): - del capture_content if result is None: return @@ -205,6 +363,16 @@ def _set_invocation_response_attributes( output_tokens = getattr(result.usage, "completion_tokens", None) invocation.output_tokens = output_tokens + if capture_content: + output_messages = _extract_output_messages(result) + if output_messages: + invocation.output_messages = output_messages + + +# --------------------------------------------------------------------------- +# Stream wrappers +# --------------------------------------------------------------------------- + class _ResponseProxy: def __init__(self, response, finalize): @@ -234,7 +402,7 @@ def __init__( self.stream = stream self.handler = handler self.invocation = invocation - self.capture_content = capture_content + self._capture_content = capture_content self._finalized = False def __enter__(self): @@ -297,9 +465,7 @@ def _stop(self, result: Any): if self._finalized: return _set_invocation_response_attributes( - self.invocation, - result, - self.capture_content, + self.invocation, result, self._capture_content ) self.handler.stop_llm(self.invocation) self._finalized = True @@ -334,9 +500,7 @@ def process_event(self, event): if event_type in {"response.failed", "response.incomplete"}: _set_invocation_response_attributes( - self.invocation, - response, - self.capture_content, + self.invocation, response, self._capture_content ) self._fail(event_type, RuntimeError) return diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index 36e8284606..008358905b 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -205,10 +205,9 @@ def get_llm_request_attributes( GenAIAttributes.GEN_AI_REQUEST_MODEL: kwargs.get("model"), } - # Add chat-like attributes for chat and generate-content operations + # Add chat-like attributes for chat operations if operation_name in ( GenAIAttributes.GenAiOperationNameValues.CHAT.value, - GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, ): attributes.update( { diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index e21fea1874..1680a76195 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -1952,4 +1952,344 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_06dc6cdba7e9968700698d614a849c819ebc87217646f52938", + "object": "response", + "created_at": 1770873162, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770873163, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_06dc6cdba7e9968700698d614b12d8819eb0ad438ac0c471d4", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc997af7873eeee-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:12:43 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '704' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=H2ddfDrktaHHAFOcMtS2nHYYhLqqKDkre9arPEKoFCI-1770873162.1530507-1.0.1.1-R7g7wdKCg6qKwihgmag2SFzAMK7KFT_y1j1..th76Yg0d7QW8baNg2LGBP2o6geeoI1ASNTyLE1MzY3ZkNR9bcsW96wxk4CoZzfSIjAKTT1CR3uzPQwXOEr9FXz8a3fF; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:43 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_e509f507077649599bff6fda12d9237d + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_05027429832591a700698d6660c5c4819da38b79b9e05ca4ff", + "object": "response", + "created_at": 1770874464, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770874465, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_05027429832591a700698d66613da8819da853060aed5a68ad", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test! How can I assist you further?" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 13, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 25 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc9b77ca82d5f83-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:34:25 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1573' + openai-organization: test_openai_org_id + openai-processing-ms: + - '885' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=UR_NYL6QZHL3fLsSiup7F9IQuZ2yy5ZuPpkOjeh.KMg-1770874464.7465413-1.0.1.1-Ju1T.6uRbDYAy4aMhnuWXG3h.R50zR37hMwpzIPUEoX8.XqPSKO2F6PxQo6N_o7BMLg.5MMlWt.pcf8IPUJyoUQgERHT6dKimEaZIDxh1NazI29Vz6698BLpbdNsHtnh; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:25 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_809fd2d79531447b9c2f5491920ceda6 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml new file mode 100644 index 0000000000..af302c0870 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml @@ -0,0 +1,267 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9b6d9de897c9a-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:33:58 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '25' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=NQmt3rscpkkDtkPgh5kFmBT.X.dvbshbJ5SFdGXndAE-1770874438.694763-1.0.1.1-zlhE6_Ivcj8uJmrmeTo9j83oHX2.qQ5CYyQpXtAfk84mquJjYHOZp1vQtEbpl8tThCVxWumPA2IgGufX1ATzcctai5ubASAfMS8yWWmGdguSBxH0mAarz7W3rV3JPls2; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:03:58 GMT + - _cfuvid=bel0IWQ5MIzmX9eNBr094yb88H2sp8sHtSHtKVwKqSk-1770874438.694763-1.0.1.1-8pvU7q1aoS_iVFcMo90Np_i8EO1_uZWF8pWNc46F0MQ; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_19e2e8de40d649c19429d51778481133 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_02b7cb119bfee61000698d6674e450819cba84676dbe0a3682", + "object": "response", + "created_at": 1770874484, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770874485, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_02b7cb119bfee61000698d66751eec819cb3c34e13ffab3483", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc9b7fa58b10f39-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:34:45 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '409' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=1nwbeDYnksQcDcdG5v6tdiuqM2Prmye60lOR9K0FS4U-1770874484.8604217-1.0.1.1-NvWUGq_THbvaz1Xhvrihz_jJSGOCNb0EKRajy0dC7JF3HCzBITxATJUiGyKA7NQts2LOl45qGJFOQR.SAYysmJGRpYPB0ZjECMbBJbMI8aG57QyjDGxIUs1XX0iNOoOW; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:45 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9996' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 31.914s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_f3f094031a879fc186ebb21db24ab611 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml new file mode 100644 index 0000000000..d97f0a286f --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml @@ -0,0 +1,269 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "instructions": "You are a helpful assistant.", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9b6decada7aea-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:33:59 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '14' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=jzbRZIlC7BJVmQ1sbyzK7yCpRpKdQyGteA60kYdVwac-1770874439.4811592-1.0.1.1-d5MKUaccTFaMrgeXDhlX1jKgzqCEEHsuQLyW9_.74tHbzXzL8j4Zn9FQjyCC59WXnfz7EMP.aMfUp7EoaubPYF4msTJe_qpSTqjJr6IfhhTGhBasHlNkCMQ13hs0YxVv; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:03:59 GMT + - _cfuvid=k4P6ukPntd1BZdvpZuyT_XPCDoONDD05k4IKWZsy.Aw-1770874439.4811592-1.0.1.1-TmwN7GVVY1vDpiEzl48l0KbmVJ2SETnnDxy2lEp89Ko; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_dd08ef939edd4fd0b23b0705828bc70c + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "instructions": "You are a helpful assistant.", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0d868124323d633600698d66779e48819588bed1c8f7f84cd8", + "object": "response", + "created_at": 1770874487, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770874488, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": "You are a helpful assistant.", + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0d868124323d633600698d667811ec8195977363305a7d2b3c", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test! How can I assist you today?" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 22, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 13, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 35 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc9b80b4bf141f5-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:34:48 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1597' + openai-organization: test_openai_org_id + openai-processing-ms: + - '738' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=2qZG1qgW5.QrpPy1RskQhB9kW.tUFFMjHArgznhpsv0-1770874487.5680182-1.0.1.1-7F0vD0NCkTKIK4MIsBGfv52mQFf0Iu6P5lU7AvRf39e_dBStIzVXgFmDcCvUspbZod3tbIWbprxYG_5ZPnr.Lm0FhyaoZgvfSaknYCvr0SDHAqL8V2ngfMxuwxvbgpfw; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:48 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9994' + x-ratelimit-remaining-tokens: + - '199959' + x-ratelimit-reset-requests: + - 46.247s + x-ratelimit-reset-tokens: + - 12ms + x-request-id: + - req_91b6987423b3457c82e85b88b8d5fe99 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml new file mode 100644 index 0000000000..a2f0d6bcf0 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml @@ -0,0 +1,267 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9b6dd380f8a15-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:33:59 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '21' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=LTNbrsMVohV7VdxzGbOxapvmSyBzs._B1Vc_Gy6_m_U-1770874439.2376857-1.0.1.1-JskG08Z2TGjfsBIpZPZEj20Y9IgUwzYlN7tuWDMBwwq42UhgQmT.MPdwdzO9UnWXMPHppaDftE7UPo_IxS37UpbHlZttpV0WyGsEK15_pGYHaFQkW.kWPKLa7iSvgt8y; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:03:59 GMT + - _cfuvid=0mSBkfDzql.xvKrYRhLVWtHSdpVo70N6vJzfMPAtYD8-1770874439.2376857-1.0.1.1-4DrnZiJjHt15kPuK8GYO24IJJ3FCiqBA3mq4JPfZP34; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_6c88b07f579c4a38a9ae00dccec51b4f + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_057803e6aa46c69f00698d6676bb2481a0b1b002964ef08a98", + "object": "response", + "created_at": 1770874486, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770874487, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_057803e6aa46c69f00698d6677395881a080b789886495cbf7", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc9b803d8107b0e-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:34:47 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '672' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=rCp8v5iZG.Dw2rt12wCmmTsN6BOqR4NG0rq7cLIlPGI-1770874486.3764565-1.0.1.1-3RuNpZXFrAV3ODsx.biDFRpKtuUzEWKSOyYrBuJnSql5tfz7bI4lvVcfqaLLrL4rPAT7wfUwOXU5XwgjQUnFnmaR5i6N.mLZySdn1auw1znpeKxTOAjOodJOIl3z7l0M; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:47 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9995' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 38.497s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_0c3113b870274b83ac59930d3b552399 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml index 843ca86cdd..bf72329865 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -2662,4 +2662,646 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0ed507649da2297900698d615689a081a0beed10e2f5495916", + "object": "response", + "created_at": 1770873174, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770873175, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0ed507649da2297900698d6157165881a091c674abba1e522f", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc997faaa8955d7-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:12:55 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '721' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=g83cpC.1W2sVHl7I.ZoT9f_ZASMmJeyRsZT1yl5X9w8-1770873174.1824052-1.0.1.1-rC9wI8tW7_lLD7Uju08Ok1t8QCIqmlEtIlggH2PP5MDdhzWCOFZhxmRi3uzeCFiVMc6uA4Luom_iUo6Z4Fd_wNcnUtXToAtVzyZVwiKfkMhHoAm_kzc0lS1I9kfZyA7j; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:55 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 22.529s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_9c5bc85acaec4bb7afd5e68b758dd161 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0ed507649da2297900698d615689a081a0beed10e2f5495916 + response: + body: + string: |- + { + "id": "resp_0ed507649da2297900698d615689a081a0beed10e2f5495916", + "object": "response", + "created_at": 1770873174, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770873175, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0ed507649da2297900698d6157165881a091c674abba1e522f", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc99801ec3ff793-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:12:55 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '99' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=eo5Nw0vgVSExYK_wH4L4V5rwd8Zen32.svM8wxCdKu4-1770873175.3448126-1.0.1.1-x.Ai2A9m8YQjnpghs3pOfkyEjIptYBmguIqqX17qe12ExZfNNc3299hX718TWgeFM6r2Cq9fAVlMQWDZpU3fhqHhIH7m9np1iCBKnqhI__C8FILJ0dFooHV0H8fxwlPb; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:55 GMT + x-request-id: + - req_614f858fb78b443eaa38f971cdc49fb2 + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0aaf63cedc07b88700698d666bd9708191aae956d17805ece4", + "object": "response", + "created_at": 1770874475, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770874476, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0aaf63cedc07b88700698d666c41e081919bc63c4bafd35c91", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc9b7c1dc245590-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:34:36 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '589' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Vh9GtQxHEuZIGoijNgUmgXY4g7IXAg7gTQj2UyD2UwQ-1770874475.818553-1.0.1.1-zf4MKL7Qa1RPt.jk89ksDJ0A4YxsIGzAe77DNOQV35.Td_9YSWfJ.ImKCNdU.R_l2DiI3gvlPqa7hUG5EzH68nljPC.WRD2AHX5NnhYJL5d8HtXlHxBvG6jShBkJ69dp; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:36 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 23.696s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_a9f7bfadbdd24f24abb60a6392b84317 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0aaf63cedc07b88700698d666bd9708191aae956d17805ece4 + response: + body: + string: |- + { + "id": "resp_0aaf63cedc07b88700698d666bd9708191aae956d17805ece4", + "object": "response", + "created_at": 1770874475, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1770874476, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0aaf63cedc07b88700698d666c41e081919bc63c4bafd35c91", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9cc9b7c64ed2be83-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:34:36 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '184' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=iMp.GZhC8HFr_NEy04KOqul0vFsj9vnxxKvO7nNTY0k-1770874476.525253-1.0.1.1-otqoEF.2hI2Zf0SCLJmf0iWLnqETHrAfNmf206ZyMBNIaPi2oDyLxGijG8EvoaVVD9gjw7KLffET51cWAKY05xJNnMOAoj933n_GWB8IBOPqE5MBegcKyewTNSouFnY5; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:36 GMT + x-request-id: + - req_22b3ee6d6d1649ce84b5c75f82e59e85 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml index aabc2a0ed6..73a3051471 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -2097,4 +2097,494 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","object":"response","created_at":1770873176,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","object":"response","created_at":1770873176,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873179}} + + headers: + CF-RAY: + - 9cc99804ee933d64-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:12:58 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '1938' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=4a8xhSXI9dgyfcn3xwuKk8.YETAJ1knmiA21kd3cL2w-1770873175.8226812-1.0.1.1-_fyCXe2QwphpGHTH4TC13wx23020RXNTejvUIYuV7KxlYApgo_g3do3CHAEb1hTBaBleIUsSHfhRY4H7O2KrGeNbVl7NczZNIuii1uVzF_GnCEh1Ds5RrWbSdNDzPxUT; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:58 GMT + x-request-id: + - req_b8cd5bfa6fa445b1a66959596929183c + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873179}} + + headers: + CF-RAY: + - 9cc9982c9ebc8c54-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:13:03 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '575' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ut6Qo8iQFlMSIaEMNVIs247kbhiCD3ftdzdtU9a2_Ok-1770873182.1714065-1.0.1.1-w5pTpGFhsXJrV1z80ATvQp7x9B09YCZsvBis32KahuWAzm68BLIrWIyvb4dZ72mbne9bP1aODtopI_.nzzthAqbhQiw_r1a_hB4cUcH3q5me58rxPpNaVRnYoZfRrBEU; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:43:03 GMT + x-request-id: + - req_6ff2a97c91d143829d15a1683004e73f + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","object":"response","created_at":1770874477,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","object":"response","created_at":1770874477,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874479}} + + headers: + CF-RAY: + - 9cc9b7c99a25c47f-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:37 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '831' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=HpLHRk0mjoUpWmR2gGadOHLHC5g_wwjS1zPKhrVafyQ-1770874477.0602748-1.0.1.1-DBkV6ETnJDZYH9chw4VpR.UItSjKwcv1K6LEzVzSBhdOxsZnFdGtCKcGkrQQmUhcI0DGHezt6k2MqfVuCKqvNgBJF3i.ZrYiBMSw6Moxn2XTCqObrlLNXtjiE2TnxNU3; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:37 GMT + x-request-id: + - req_291a3c9866604ad5ad504456baa1e496 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874479}} + + headers: + CF-RAY: + - 9cc9b7eb1c6472b3-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '454' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Wxk7VcAUTzEiU0mQnX04WHXgEc7u82cOvB2x67iju.I-1770874482.41478-1.0.1.1-NN.GxgXrOKnmPLWFbmdfIrGKmry3rFvdSnR3h9255LybL2Gb6QMZHT.aa8aFJ_KilLk6UWZaer73SxAQNtzTYeHfG4fF0un3RsUDUFd88qS1il.pIaRaxqZ7uB4cYPpu; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:42 GMT + x-request-id: + - req_d10dae68749c43c0b2f97f18e961bace + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml new file mode 100644 index 0000000000..f1c9a79d76 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml @@ -0,0 +1,221 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9b6dbcf5a60c8-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:33:59 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '15' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=IyTi2I1KIrzh2fNOybM77kkOJYEBBqHvumJWJliOJ8A-1770874439.0050933-1.0.1.1-lZT7nYS0VZV3cl_.ca_Tn.PgpoaNF5ePb5XvXmV.4uNP18Xd_co3zN.ZbAuXsrSeTnQRn1ryGOrfSRE1HtPfAk_Pjr2wLpacAhQzuigNjGvK7oHD7ZehL8NZIAkHehNf; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:03:59 GMT + - _cfuvid=pJ.v1USBUzdVlzd_ryMV_2l5f8zpZVPcaz905Xd114c-1770874439.0050933-1.0.1.1-5FECYk2dMUc5jtovok1m1vuwKD2p5nx9NVzuVRMCR4o; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_7c359249eb794f0fba932093ff56f1d9 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_023331c4d261975e00698d66758fb08196a4cec970581db62e","object":"response","created_at":1770874485,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_023331c4d261975e00698d66758fb08196a4cec970581db62e","object":"response","created_at":1770874485,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"WpwyubRIKCN5","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"upSQ8wQ5SFRia","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"cGaqpPElurOFaY","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"skYF8GzPxb1","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"1N1RvxQpitwSLOe","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_023331c4d261975e00698d66758fb08196a4cec970581db62e","object":"response","created_at":1770874485,"status":"completed","background":false,"completed_at":1770874486,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cc9b7fdea982560-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:45 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '166' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Scle_.x1vPOukv2IsWSm8TyYnjW8W4O_nxbLYyiv0a4-1770874485.4274735-1.0.1.1-U9J23pBpsudIBj4tBHoWavwDudQIlM5q26TZbR.DwoIisj9FfWyGAkXZmZzPeSjZAi_oTxLgxDqnU_dGLFO8ZkzvLXDxHsq4py632ASNkl4CI8S9fBOaF_jbfo39NWwM; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:45 GMT + x-request-id: + - req_83585ceb8c1c4e369b0cdbe54fd110b3 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index 876103c930..b5ead1ec69 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -2559,4 +2559,500 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","object":"response","created_at":1770873166,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","object":"response","created_at":1770873166,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873168}} + + headers: + CF-RAY: + - 9cc997c0bc027288-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:12:47 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '1203' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ULGjZuKUGBpGgQO0HAUCxQjLlMccWHrXJY8KZBQ_jNA-1770873164.912948-1.0.1.1-GXiJ57yQzyHwIxYufD7QYCNhpzgSsgzL69oxV_tl9tIVHpzudeHwCkitTcLpO2pUREvNIXrw1CouJ0TWKp48vlEFPct91rRuRWSUSAlL1h_NuyTG.yac_Wsz30LcxHUK; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:47 GMT + x-request-id: + - req_e842a237b2be4676825258772a5792ad + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873168}} + + headers: + CF-RAY: + - 9cc997ec3ab64352-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:12:52 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '432' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=vHVxC95u1KkjbJDmqEw1bm7iJTi3yHQVGacydr22Q.w-1770873171.872945-1.0.1.1-ePBhPyQb4cku4XjDjg_m5WtqyoM5Lut_IS52dul05zDvfMziK.CbYLndRdCMvIGa.pWyTtfi8qh9D1.Wd8uxS.rAOrsA_5q1ahVyQ0_pP.6tv2VkO7bzGyPiD8wja8fF; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:52 GMT + x-request-id: + - req_88667072691f47efacfd24fdc4ddf269 + status: + code: 200 + message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","object":"response","created_at":1770874467,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","object":"response","created_at":1770874467,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874469}} + + headers: + CF-RAY: + - 9cc9b78d1fdf3eb4-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:28 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '827' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=SJM9y5sfi6QeBC4958.TNSbWXusZMIWtgKYRman1L_0-1770874467.372517-1.0.1.1-xvNXbBBbzmukmPdjQ4KtmjmPDA9MlOtTCOwT.RkgFzItKeZSRnBTrhQDAfmMwLMkM4.acVLipW1cSWY7.JCE1DrAmgGZwchcUF5JE0PfBbpO1B4RzLwJqKK713Dd4Cfm; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:28 GMT + x-request-id: + - req_ceff0538ad4b48b3b9b18b0bc374edc7 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874469}} + + headers: + CF-RAY: + - 9cc9b7b40a49acf1-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:34 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '450' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=R3P14LW_M8tqdmPB.gLKj7DymNRd0tRxHjfgUYUdM8E-1770874473.6103997-1.0.1.1-aBuasfVI5rAtjxc3ND6.s.RwWBNYI5CB9595ZX3FF04XxFWGEbCgZrpojhjAcnl_vDGAmlyRfewdkFV9IDDXquoevlu9V1zTT.qQFl.taXhClB3jz3d4WTxgGn0ppW7c; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:34 GMT + x-request-id: + - req_8f3764c1a8f544a78b35f0a62cfab538 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index 53a2b838cc..2227a8958e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -1467,4 +1467,273 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_076fb2e5e2775a8300698d614bd5048192ace3ae8713f7cefc","object":"response","created_at":1770873163,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_076fb2e5e2775a8300698d614bd5048192ace3ae8713f7cefc","object":"response","created_at":1770873163,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"dpo98iy4Hq5s","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"VcJ6ui0KD2jZP","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"lqdDcKKTQZtj6Y","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"c0T17Mu0EUw","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"EGHDOLpmFtLftV0","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_076fb2e5e2775a8300698d614bd5048192ace3ae8713f7cefc","object":"response","created_at":1770873163,"status":"completed","background":false,"completed_at":1770873164,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cc997b7ca5542a3-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:12:43 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '36' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=DuKfrz1jLO.hM33IQMFa.6lwBEPT9phIPiVNsYhTljA-1770873163.4853525-1.0.1.1-b_SsnlTSZOW2YpYeYcf9Ts4GcSGR3xXt2VmrO07fw93Df8DZJwxYX4SHGag00u9i5EteFs0yXcGL2_LyXVlSy8MS2e_apsIpZwHAIW52iCimShzJ3RH1ok_HiA7dEjN5; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 05:42:43 GMT + x-request-id: + - req_8e0c275ee90641538e3ec9afaab9996f + status: + code: 200 + message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0a6a9b5ed843293900698d666247e88196ad4901f775451198","object":"response","created_at":1770874466,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0a6a9b5ed843293900698d666247e88196ad4901f775451198","object":"response","created_at":1770874466,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"u29F3EMxDpK9","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"Bep4erKn9tLgp","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"Z2KmQanJABCKKc","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"NtSNiAFkqQq","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"zTGS4YHjT5NOjfS","output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" How","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"lPC48oFQRsQN","output_index":0,"sequence_number":9} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" can","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"rDo5WpXdN7Ym","output_index":0,"sequence_number":10} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" I","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"XsYvGbz3w8je6Y","output_index":0,"sequence_number":11} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" assist","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"oDl7BSPaD","output_index":0,"sequence_number":12} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" you","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"en8qiMjkJzEf","output_index":0,"sequence_number":13} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" further","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"U7ODr5iC","output_index":0,"sequence_number":14} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"?","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"zWwN7Bg13rfaPsa","output_index":0,"sequence_number":15} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"output_index":0,"sequence_number":16,"text":"This is a test. How can I assist you further?"} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test. How can I assist you further?"},"sequence_number":17} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test. How can I assist you further?"}],"role":"assistant"},"output_index":0,"sequence_number":18} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0a6a9b5ed843293900698d666247e88196ad4901f775451198","object":"response","created_at":1770874466,"status":"completed","background":false,"completed_at":1770874466,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test. How can I assist you further?"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":13,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":25},"user":null,"metadata":{}},"sequence_number":19} + + headers: + CF-RAY: + - 9cc9b7847a9d421f-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:26 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '64' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=e6QPWJPKYbz2SmJTisgi3Y3D20mOH53mcOUf4BSeD.0-1770874465.9913394-1.0.1.1-qmOwnrIGDnEKahiaR_Mq9Xt38SYizugcww1fIvfJvB35DLKsHJOtowHkxrk2ImkEP736Yr_rIT8f_AJH.vE_v6zbwPyvUmRwfCYgaaymgd.VRWuc9E2o6ErHDUIBIW71; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:26 GMT + x-request-id: + - req_976c70b7ebf34904a3e2a37a0fe333a6 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml new file mode 100644 index 0000000000..5acd56fcbe --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml @@ -0,0 +1,221 @@ +interactions: +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9cc9b6e01e3a269c-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Thu, 12 Feb 2026 05:33:59 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '22' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=ayG_0CyZVLq9lbzFQvwvzg_80OkXQK7N1eVJFdc7O40-1770874439.6956916-1.0.1.1-LodUqPFwER5h93320fkWLkOrBHslILGMEh1lvQXaNs7QVsZlsApbArqikFWGDZC6zH1TQKI6A5Lsne3hE2wj0ApIRXF9nnPZ3BBteg07xdCt6TQ62oXJ8lDBJlTuUbH8; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:03:59 GMT + - _cfuvid=z9WCwadVt3EqFLoZzpcD.SIaKhXdlqff0LUgTidimCA-1770874439.6956916-1.0.1.1-PkuBOf8YPgTnA98xTY2I1To2UexeflYOEEZIb35ZLXE; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_823863ac300c4eafb13f66f754d69cd4 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0dc625f081ef87b700698d66788d9c819ea9a334efeb38545d","object":"response","created_at":1770874488,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0dc625f081ef87b700698d66788d9c819ea9a334efeb38545d","object":"response","created_at":1770874488,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"mZga96nQvMn5","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"9mgw5B2L8poAV","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"nqpSBYWrzykMnN","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"s3amrGjf08N","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"evuJKRaRhIfi0Dv","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0dc625f081ef87b700698d66788d9c819ea9a334efeb38545d","object":"response","created_at":1770874488,"status":"completed","background":false,"completed_at":1770874488,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9cc9b8113e308c5d-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Thu, 12 Feb 2026 05:34:48 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '44' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=GWEApy6PVNN6oliIhk7jYYmau_g1GAhbk8J_dzoGirc-1770874488.5203753-1.0.1.1-ZpOW_.QbDU3jFM5NL4QduhwxP2sVHj_lVTjpQL2jyQ0_zxU5aWJvm6ecLuaPRxP32c0MoFDDLxoZePdEOd0nZgZD9Th3u3svG7vGxqDchFt5Ed0kcqJbuyQgH9izHpNv; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 + 06:04:48 GMT + x-request-id: + - req_82c37c8b542e4f5fa08328c092d0a151 + status: + code: 200 + message: OK +version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py index af626d7990..16f9d76167 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/conftest.py @@ -7,6 +7,10 @@ import yaml from openai import AsyncOpenAI, OpenAI +from opentelemetry.instrumentation._semconv import ( + OTEL_SEMCONV_STABILITY_OPT_IN, + _OpenTelemetrySemanticConventionStability, +) from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor from opentelemetry.instrumentation.openai_v2.utils import ( OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, @@ -170,6 +174,60 @@ def instrument_with_content_unsampled( instrumentor.uninstrument() +@pytest.fixture(scope="function") +def instrument_with_experimental_content( + tracer_provider, logger_provider, meter_provider +): + # Reset global state for experimental mode + _OpenTelemetrySemanticConventionStability._initialized = False + os.environ.update( + {OTEL_SEMCONV_STABILITY_OPT_IN: "gen_ai_latest_experimental"} + ) + os.environ.update( + {OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT: "SPAN_AND_EVENT"} + ) + + instrumentor = OpenAIInstrumentor() + instrumentor.instrument( + tracer_provider=tracer_provider, + logger_provider=logger_provider, + meter_provider=meter_provider, + ) + + yield instrumentor + os.environ.pop(OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, None) + os.environ.pop(OTEL_SEMCONV_STABILITY_OPT_IN, None) + _OpenTelemetrySemanticConventionStability._initialized = False + instrumentor.uninstrument() + + +@pytest.fixture(scope="function") +def instrument_with_experimental_no_content( + tracer_provider, logger_provider, meter_provider +): + # Reset global state for experimental mode + _OpenTelemetrySemanticConventionStability._initialized = False + os.environ.update( + {OTEL_SEMCONV_STABILITY_OPT_IN: "gen_ai_latest_experimental"} + ) + os.environ.update( + {OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT: "NO_CONTENT"} + ) + + instrumentor = OpenAIInstrumentor() + instrumentor.instrument( + tracer_provider=tracer_provider, + logger_provider=logger_provider, + meter_provider=meter_provider, + ) + + yield instrumentor + os.environ.pop(OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, None) + os.environ.pop(OTEL_SEMCONV_STABILITY_OPT_IN, None) + _OpenTelemetrySemanticConventionStability._initialized = False + instrumentor.uninstrument() + + class LiteralBlockScalar(str): """Formats the string as a literal block scalar, preserving whitespace and without interpreting escape characters""" diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index b5f406dc07..b6ac6f4f21 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json + import openai import pytest from packaging.version import Version @@ -22,6 +24,16 @@ from .test_utils import assert_all_attributes + +def _load_span_messages(span, attribute): + """Load and parse JSON message content from a span attribute.""" + value = span.attributes.get(attribute) + assert value is not None, f"Expected attribute {attribute} to be present" + assert isinstance(value, str), f"Expected {attribute} to be a JSON string" + parsed = json.loads(value) + assert isinstance(parsed, list), f"Expected {attribute} to be a JSON list" + return parsed + # The Responses API was introduced in openai>=1.66.0 # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 OPENAI_VERSION = Version(openai.__version__) @@ -56,7 +68,7 @@ def test_responses_create( response.model, input_tokens, output_tokens, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + operation_name=GenAIAttributes.GenAiOperationNameValues.CHAT.value, response_service_tier=response.service_tier, ) @@ -95,7 +107,7 @@ def test_responses_stream_new_response( final_response.model, input_tokens, output_tokens, - operation_name=GenAIAttributes.GenAiOperationNameValues.GENERATE_CONTENT.value, + operation_name=GenAIAttributes.GenAiOperationNameValues.CHAT.value, response_service_tier=final_response.service_tier, ) @@ -273,3 +285,157 @@ def test_responses_retrieve_stream_existing_response( operation_name=operation_name, response_service_tier=final_response.service_tier, ) + + +# ============================================================================= +# Content capture tests (experimental mode) +# ============================================================================= + + +@skip_if_no_responses_api +@pytest.mark.vcr("test_responses_create.yaml") +def test_responses_create_captures_content( + span_exporter, openai_client, instrument_with_experimental_content +): + """Test that input and output content is captured in span attributes.""" + openai_client.responses.create( + model="gpt-4o-mini", + input="Say this is a test", + stream=False, + ) + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + span = spans[0] + + input_messages = _load_span_messages( + span, GenAIAttributes.GEN_AI_INPUT_MESSAGES + ) + output_messages = _load_span_messages( + span, GenAIAttributes.GEN_AI_OUTPUT_MESSAGES + ) + + # Input: string input should become a user message with text part + assert len(input_messages) == 1 + assert input_messages[0]["role"] == "user" + assert input_messages[0]["parts"][0]["type"] == "text" + assert "test" in input_messages[0]["parts"][0]["content"] + + # Output: should have an assistant message with text part + assert len(output_messages) >= 1 + assert output_messages[0]["role"] == "assistant" + assert output_messages[0]["parts"][0]["type"] == "text" + assert len(output_messages[0]["parts"][0]["content"]) > 0 + + +@skip_if_no_responses_api +@pytest.mark.vcr("test_responses_stream_new_response.yaml") +def test_responses_stream_captures_content( + span_exporter, openai_client, instrument_with_experimental_content +): + """Test that streaming responses capture content in span attributes.""" + with openai_client.responses.stream( + model="gpt-4o-mini", + input="Say this is a test", + ) as stream: + for event in stream: + if event.type == "response.completed": + break + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + span = spans[0] + + input_messages = _load_span_messages( + span, GenAIAttributes.GEN_AI_INPUT_MESSAGES + ) + output_messages = _load_span_messages( + span, GenAIAttributes.GEN_AI_OUTPUT_MESSAGES + ) + + assert input_messages[0]["role"] == "user" + assert output_messages[0]["role"] == "assistant" + assert output_messages[0]["parts"] + assert output_messages[0]["parts"][0]["type"] == "text" + + +@skip_if_no_responses_api +@pytest.mark.vcr("test_responses_create.yaml") +def test_responses_create_no_content_in_experimental_mode( + span_exporter, openai_client, instrument_with_experimental_no_content +): + """Test that NO_CONTENT mode does not capture messages in span attributes.""" + openai_client.responses.create( + model="gpt-4o-mini", + input="Say this is a test", + stream=False, + ) + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + span = spans[0] + + # Content should NOT be in span attributes under NO_CONTENT + assert GenAIAttributes.GEN_AI_INPUT_MESSAGES not in span.attributes + assert GenAIAttributes.GEN_AI_OUTPUT_MESSAGES not in span.attributes + + # Basic span attributes should still be present + assert span.attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] == "gpt-4o-mini" + assert GenAIAttributes.GEN_AI_RESPONSE_MODEL in span.attributes + assert GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS in span.attributes + assert GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS in span.attributes + + +@skip_if_no_responses_api +@pytest.mark.vcr("test_responses_create.yaml") +def test_responses_create_captures_system_instruction( + span_exporter, openai_client, instrument_with_experimental_content +): + """Test that system instructions are captured in span attributes.""" + openai_client.responses.create( + model="gpt-4o-mini", + input="Say this is a test", + instructions="You are a helpful assistant.", + stream=False, + ) + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + span = spans[0] + + system_instructions = span.attributes.get( + GenAIAttributes.GEN_AI_SYSTEM_INSTRUCTIONS + ) + assert system_instructions is not None + parsed = json.loads(system_instructions) + assert isinstance(parsed, list) + assert len(parsed) >= 1 + assert parsed[0]["type"] == "text" + assert "helpful assistant" in parsed[0]["content"] + + +@skip_if_no_responses_api +@pytest.mark.vcr("test_responses_stream_new_response.yaml") +def test_responses_stream_no_content_in_experimental_mode( + span_exporter, openai_client, instrument_with_experimental_no_content +): + """Test that streaming with NO_CONTENT mode does not capture messages.""" + with openai_client.responses.stream( + model="gpt-4o-mini", + input="Say this is a test", + ) as stream: + for event in stream: + if event.type == "response.completed": + break + + spans = span_exporter.get_finished_spans() + assert len(spans) == 1 + span = spans[0] + + # Content should NOT be in span attributes + assert GenAIAttributes.GEN_AI_INPUT_MESSAGES not in span.attributes + assert GenAIAttributes.GEN_AI_OUTPUT_MESSAGES not in span.attributes + + # Basic span attributes should still be present + assert GenAIAttributes.GEN_AI_RESPONSE_MODEL in span.attributes + assert GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS in span.attributes From e2604b61bfac6850b6d913a83910e464761ce6df Mon Sep 17 00:00:00 2001 From: Teja Date: Fri, 13 Feb 2026 21:46:12 -0500 Subject: [PATCH 14/20] Remove example files for OpenAI Responses API instrumentation. --- .../examples/responses/.env | 22 ---------- .../examples/responses/README.rst | 44 ------------------- .../examples/responses/main.py | 39 ---------------- .../examples/responses/requirements.txt | 6 --- 4 files changed, 111 deletions(-) delete mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env delete mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst delete mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py delete mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env deleted file mode 100644 index 8f2dd62b91..0000000000 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/.env +++ /dev/null @@ -1,22 +0,0 @@ -# Update this with your real OpenAI API key -OPENAI_API_KEY=sk-YOUR_API_KEY - -# Uncomment to use Ollama instead of OpenAI -# OPENAI_BASE_URL=http://localhost:11434/v1 -# OPENAI_API_KEY=unused -# CHAT_MODEL=qwen2.5:0.5b - -# Uncomment and change to your OTLP endpoint -# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 -# OTEL_EXPORTER_OTLP_PROTOCOL=grpc - -OTEL_SERVICE_NAME=opentelemetry-python-openai - -# Change to 'false' to disable collection of python logging logs -OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true - -# Uncomment if your OTLP endpoint doesn't support logs -# OTEL_LOGS_EXPORTER=console - -# Change to 'false' to hide prompt and completion content -OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst deleted file mode 100644 index 6d2e03995d..0000000000 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/README.rst +++ /dev/null @@ -1,44 +0,0 @@ -OpenTelemetry OpenAI Responses API Instrumentation Example -========================================================== - -This is an example of how to instrument OpenAI Responses API calls with zero code changes, -using ``opentelemetry-instrument``. - -When ``main.py`` is run, it exports traces and metrics to an OTLP -compatible endpoint. Traces include details such as the model used, -response ID, token usage, and duration. Metrics capture token usage and -performance data. - -Note: ``.env`` file configures additional environment variables: - -- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures OpenTelemetry SDK to export logs and events. -- ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures OpenAI instrumentation to capture content on events. -- ``OTEL_LOGS_EXPORTER=otlp`` to specify exporter type. - -Setup ------ - -Minimally, update the ``.env`` file with your ``OPENAI_API_KEY``. An -OTLP compatible endpoint should be listening for traces and logs on -http://localhost:4317. If not, update ``OTEL_EXPORTER_OTLP_ENDPOINT`` as well. - -Next, set up a virtual environment like this: - -:: - - python3 -m venv .venv - source .venv/bin/activate - pip install "python-dotenv[cli]" - pip install -r requirements.txt - -Run ---- - -Run the example like this: - -:: - - dotenv run -- opentelemetry-instrument python main.py - -You should see response output printed while traces and metrics export to your -configured observability tool. diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py deleted file mode 100644 index 69d3bf4100..0000000000 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/main.py +++ /dev/null @@ -1,39 +0,0 @@ -# pylint: disable=no-member -# The responses API is only available in openai>=1.66.0 -# https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 -import os - -from openai import OpenAI - - -def main(): - client = OpenAI() - model = os.getenv("RESPONSES_MODEL", "gpt-4o-mini") - - response = client.responses.create( - model=model, - input="Write a short poem about OpenTelemetry.", - ) - - print("Responses.create") - print(f"Model: {response.model}") - print(f"Response ID: {response.id}") - print(f"Output text: {response.output_text}") - - print("\nResponses.stream") - with client.responses.stream( - model=model, - input="Write a short poem about OpenTelemetry.", - background=True, - ) as stream: - for event in stream: - if event.type == "response.output_text.delta": - print(event.delta, end="", flush=True) - if event.type == "response.completed": - print("\n") - print(f"Stream response ID: {event.response.id}") - break - - -if __name__ == "__main__": - main() diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt deleted file mode 100644 index aff4f2e81e..0000000000 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/responses/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -openai~=1.66.0 - -opentelemetry-sdk~=1.36.0 -opentelemetry-exporter-otlp-proto-grpc~=1.36.0 -opentelemetry-distro~=0.57b0 -opentelemetry-instrumentation-openai-v2~=2.2b0 From 8f4679ea2b1a4c2c251a31e982afa7e81a1ae497 Mon Sep 17 00:00:00 2001 From: Teja Date: Sun, 15 Feb 2026 14:57:14 -0500 Subject: [PATCH 15/20] Refactor OpenAI instrumentation to improve content capture and response handling. --- .../instrumentation/openai_v2/__init__.py | 13 +- .../openai_v2/patch_responses.py | 33 -- .../instrumentation/openai_v2/utils.py | 16 +- .../cassettes/test_responses_create.yaml | 265 +++++++++++ ...est_responses_create_captures_content.yaml | 265 +++++++++++ ...es_create_captures_system_instruction.yaml | 267 ++++++++++++ ...reate_no_content_in_experimental_mode.yaml | 265 +++++++++++ .../cassettes/test_responses_retrieve.yaml | 412 ++++++++++++++++++ ...ses_retrieve_stream_existing_response.yaml | 337 ++++++++++++++ ...est_responses_stream_captures_content.yaml | 219 ++++++++++ ...st_responses_stream_existing_response.yaml | 340 +++++++++++++++ .../test_responses_stream_new_response.yaml | 219 ++++++++++ ...tream_no_content_in_experimental_mode.yaml | 219 ++++++++++ .../src/opentelemetry/util/genai/utils.py | 12 + .../tests/test_events_options.py | 43 ++ 15 files changed, 2881 insertions(+), 44 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index ae4fce8be0..bb1e9a36a5 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -95,12 +95,13 @@ def _instrument(self, **kwargs): ) instruments = Instruments(self._meter) + capture_content = is_content_enabled() wrap_function_wrapper( module="openai.resources.chat.completions", name="Completions.create", wrapper=chat_completions_create( - tracer, logger, instruments, is_content_enabled() + tracer, logger, instruments, capture_content ), ) @@ -108,7 +109,7 @@ def _instrument(self, **kwargs): module="openai.resources.chat.completions", name="AsyncCompletions.create", wrapper=async_chat_completions_create( - tracer, logger, instruments, is_content_enabled() + tracer, logger, instruments, capture_content ), ) @@ -117,7 +118,7 @@ def _instrument(self, **kwargs): module="openai.resources.embeddings", name="Embeddings.create", wrapper=embeddings_create( - tracer, instruments, is_content_enabled() + tracer, instruments, capture_content ), ) @@ -125,7 +126,7 @@ def _instrument(self, **kwargs): module="openai.resources.embeddings", name="AsyncEmbeddings.create", wrapper=async_embeddings_create( - tracer, instruments, is_content_enabled() + tracer, instruments, capture_content ), ) @@ -145,13 +146,13 @@ def _instrument(self, **kwargs): wrap_function_wrapper( module="openai.resources.responses.responses", name="Responses.create", - wrapper=responses_create(handler), + wrapper=responses_create(handler, capture_content), ) wrap_function_wrapper( module="openai.resources.responses.responses", name="Responses.retrieve", - wrapper=responses_retrieve(handler), + wrapper=responses_retrieve(handler, capture_content), ) except (AttributeError, ModuleNotFoundError): # Responses API or TelemetryHandler not available diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index 68f3c66df6..31c126861c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging from typing import TYPE_CHECKING, Any from opentelemetry.semconv._incubating.attributes import ( @@ -28,39 +27,9 @@ is_streaming, ) -_logger = logging.getLogger(__name__) - OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value -# --------------------------------------------------------------------------- -# Content capture helpers -# --------------------------------------------------------------------------- - - -def _should_capture_content() -> bool: - """Return True when content conversion should be performed. - - Mirrors the Anthropic instrumentation pattern: only extract content when - experimental mode is active and a content-capturing mode is set. - """ - from opentelemetry.util.genai.utils import ( # pylint: disable=import-outside-toplevel - ContentCapturingMode, - get_content_capturing_mode, - is_experimental_mode, - should_emit_event, - ) - - if not is_experimental_mode(): - return False - mode = get_content_capturing_mode() - if mode == ContentCapturingMode.NO_CONTENT: - return False - if mode == ContentCapturingMode.EVENT_ONLY and not should_emit_event(): - return False - return True - - def _extract_system_instruction(kwargs: dict): """Extract system instruction from the ``instructions`` parameter.""" from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel @@ -202,7 +171,6 @@ def traced_method(wrapped, instance, args, kwargs): ) streaming = is_streaming(kwargs) - capture_content = _should_capture_content() invocation = handler.start_llm( LLMInvocation( request_model=request_model, @@ -279,7 +247,6 @@ def traced_method(wrapped, instance, args, kwargs): ) streaming = is_streaming(kwargs) - capture_content = _should_capture_content() invocation = handler.start_llm( LLMInvocation( request_model=request_model, diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index 008358905b..671498abda 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -14,7 +14,7 @@ from __future__ import annotations -from os import environ +import os from typing import TYPE_CHECKING, Mapping, Optional from urllib.parse import urlparse @@ -42,11 +42,17 @@ def is_content_enabled() -> bool: - capture_content = environ.get( - OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, "false" - ) + try: + from opentelemetry.util.genai.utils import ( # pylint: disable=import-outside-toplevel + should_capture_content, + ) - return capture_content.lower() == "true" + return should_capture_content() + except ModuleNotFoundError: + capture_content = os.environ.get( + OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, "false" + ) + return capture_content.lower() == "true" def extract_tool_calls(item, capture_content): diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index 1680a76195..430e2441f9 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -2292,4 +2292,269 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce52651baac7291-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:40 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '17' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=jjhTsEYvu0ZxKQQVZmNBf4k86LIGNkHv4.dPXE_SYMw-1771162119.9576197-1.0.1.1-vyg2v0jqjzy5h.1EHu1SP7P_OzpLNlN4YPo_V7GeVmkl8TCv2DyJkHY_an65Q9X2HgDWWw2AiCncKZQmbS5fCoI3gAyLlCbc6ndEcuLOG6Ct5qZkiTqeLyMIMYHWVnzB; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:40 GMT + - _cfuvid=lu0Ewn2CUYhMm1AvMTXg922CoEldsiKXbEoENEx0mSE-1771162119.9576197-1.0.1.1-KKg1jRrcSdiTACnEsaSC3Re6t.rfZMi8ZWfVhpMQLtU; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_ae019b5912d14856af76e32a5be47f26 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0ba73fa7a946049a006991ca2959a88195921a1eb1d78e0bc1", + "object": "response", + "created_at": 1771162153, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1771162154, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0ba73fa7a946049a006991ca2a5fec8195a0f8a257b2bc2eab", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9ce5271f0c30785b-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:29:14 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1176' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=IHyl6o.Uizu4jSVyzImzL8jVdZTbIIYZMrXvGt0zXZQ-1771162152.8053372-1.0.1.1-c4sbKi5fF5FoxXHUVkKN.lTn4TYbX6OZLCEqt3WhR5LC1.9FZHllB39aGjgRJT9t2Co2WdUCpMlKN9i.7AbODp9XoT8JDOhOzn0W._KeRJrW4uB63hRBrjnKEbU6dbSl; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:14 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9999' + x-ratelimit-remaining-tokens: + - '199968' + x-ratelimit-reset-requests: + - 8.64s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_47f31107c5f34232b6fc8780dba3f102 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml index af302c0870..7789c4e409 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml @@ -264,4 +264,269 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce5265d79968068-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '26' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=5hnHdmOWkzpSL5phN8zyh9LvGDhHOlKXr3k7jnvlwR8-1771162121.8365912-1.0.1.1-dz30CGxzBWW1ykG0pFKKHN3xzj48YgNM4ZJ5PTuw..nOEY57xtcj7b4nh4z3IKJL7MrNQfy33qd2IB0.VNBhOU1wViWFnpbb7Dn5LApTG6bU3IjD0qkeY9ph7.sJeWvZ; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:41 GMT + - _cfuvid=UeddeX4o.nX6eUUMvv9hD5XzliAIgX29jEbf8DwYH2k-1771162121.8365912-1.0.1.1-SB4_Uh89SpUM33bMkFjs3WYn32gFa3V.CLy6mUMESF0; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_85fd1729702543cc9348417ef7ec16eb + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0ae0e912ac510612006991ca415c18819698e41632722c4887", + "object": "response", + "created_at": 1771162177, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1771162178, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0ae0e912ac510612006991ca426b68819684e3027af40f466f", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9ce527b44f143d08-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:29:38 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1257' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=AYdPtUzf8fw7wF08NIgZfhE3jROjSnNxErk4twDMHlc-1771162176.6882827-1.0.1.1-WLZf.P6Vg.P8sCz4tCtYWXpcuTMGhvd4WDbQO2Vtc9FgXQvR_Zlm9w.lHew0M91NQMbbeQEIhwCVs3DTt_noQRTYCkW6_8KZWhO5EAL.P3gm3BOe9lgFM77e6L8FhdkL; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:38 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9996' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 28.024s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_abb4114ba099488a81bcfe9383043b06 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml index d97f0a286f..1b357263c6 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml @@ -266,4 +266,271 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "instructions": "You are a helpful assistant.", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce52661ee4f57b0-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '25' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=dKbAIF.653aGG4qXviEIPaKxjUb9djsJ8oHcUTUbzT0-1771162122.545856-1.0.1.1-gXRh1nXAEaXIF3Yr_ObpmJ35Fn67CmiOijMwM.ppTSwocZblvYsfYaK2iQwpY9e9lsQZ8gvUBoHy5j7awH8hpulXoNVJeLNBMya9CimmHG0Jn1CCUCWiMWFqsSkSqPFX; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:42 GMT + - _cfuvid=8I5pca93UEe51dEAE7EQ.OKc.jHn4l0Uv1W72Jxvt5g-1771162122.545856-1.0.1.1-BLd7noGPX26Stgw4ckJ9rYtHXbhNCIMYGSDMJlzdCuI; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_5d69d2bcf41f4e41a58a7a04c152fc60 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "instructions": "You are a helpful assistant.", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_0349adc29a03975e006991ca452f108193965dc4ec77ed3425", + "object": "response", + "created_at": 1771162181, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1771162181, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": "You are a helpful assistant.", + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_0349adc29a03975e006991ca45705481938e0aa01dae0f46bb", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 22, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 28 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9ce527d02b688110-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:29:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1568' + openai-organization: test_openai_org_id + openai-processing-ms: + - '414' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=.n8AVJkA1d0eTjhC3v1TK2.I7x2G_5EE1TMRoVHSGTE-1771162181.1443655-1.0.1.1-xi9TkeVZr.xCGmq3JLmDCqat4P3CrdT333nbnWxtj346QFo0OQSLSxarMkrzKD4v4W_Y3LhsBXVKnnRtvfSEyh0h0nesafj6dXID.YwcyauWkx_.uWi_4QQsdTU_ACrr; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:41 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9994' + x-ratelimit-remaining-tokens: + - '199959' + x-ratelimit-reset-requests: + - 50.715s + x-ratelimit-reset-tokens: + - 12ms + x-request-id: + - req_7eb62b5571114c5c9e5960f98fb332f0 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml index a2f0d6bcf0..121b460ed0 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml @@ -264,4 +264,269 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce526607cfc4f0b-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '14' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Q5rZhXo12u4tRWk9uzqsVNW3z1H_SgFy1eEqBzzy9g0-1771162122.3170002-1.0.1.1-krleFUHu.lcC6wtnlX5qZaZZM1H.FmBextvl2tnTL4kpmwb48aDO6EsDRyqJPsm9woiQ4YpV6VQ0qx5O4cgrV2u0lmAFvTHl1J8HvVVWK_RI47QJ9a3XbVoTDM5ADF3z; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:42 GMT + - _cfuvid=uUsP7wN5XlrDTiGExZGcldiDVrrKoFSbwXctLKeloG4-1771162122.3170002-1.0.1.1-lUGBFV2LO1fr2kgAFmvssfcNJtOhIh3_Y55LNp_CRNY; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_410f21c3e79548f0840ff5d54d6ee800 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_03d3da6a97a892ed006991ca4464f08192ac667eaa9aab12a2", + "object": "response", + "created_at": 1771162180, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1771162180, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_03d3da6a97a892ed006991ca44c5b88192a4ec5e584e09a073", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test." + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 6, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 18 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9ce527cb4d183eb4-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:29:40 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1542' + openai-organization: test_openai_org_id + openai-processing-ms: + - '515' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=suzov_6noWRuorWPsGa9pcKxNd4d3GdPGyntE.7vov0-1771162180.3620577-1.0.1.1-nDHu0L5DkBwhqUOAxW1nofzau75tGTZ7vVPxHZPTbBrh6Px7llcdonAaoSUMXe0QJSudXau1qrRFSDdf7hif7dlfvcVm6qvR40R4_.x834LD1dlgZTInrp00XVacyHIf; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:40 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9995' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 34.932s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_5b96b9b8032f4ae890fcf1620c411307 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml index bf72329865..c2f069025f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -3304,4 +3304,416 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce526590829436f-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '19' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=uKDiQCls6zS6DVJdlcUSglgYePzswJkYrO_vXeWyj.I-1771162121.1216908-1.0.1.1-jeBr12034SrM62t2hckWcCQ1K7yL1GTUNQrlOE_R6tQJbMwXAPF5x4rJrmSdojWYhV4n4d.fd5Iguo42O0gjPoxW0L0pq83FwiLQIUIPySBO.UQu9O7pU8o9UAUXweqZ; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:41 GMT + - _cfuvid=3KgJfjFq9EgL2xj9XRSXIfwDESdzxFDO_5.4tRthTyc-1771162121.1216908-1.0.1.1-CJJKuPceEYmjlGHq4UI.Q35WWfEv8AXltLoydTyd0SY; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_291dac0fdc1b49d9818481039704ad7d + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": false + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '72' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "id": "resp_039b62fdcf88a203006991ca3621648192bb67ccd047e4f204", + "object": "response", + "created_at": 1771162166, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1771162167, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_039b62fdcf88a203006991ca371b54819296c87ce191eb2b12", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test. How can I assist you further?" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 13, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 25 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9ce5276deef10f88-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:29:27 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1573' + openai-organization: test_openai_org_id + openai-processing-ms: + - '1208' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=HPyhV2Pl81ZRccip_dx6IqhZVmKf0w1Xct65EQRJSVY-1771162165.4286332-1.0.1.1-JtSgg5_.2N2w3GmD0oPv.nM.N6Fly.oASLuCMxfSxnMRTIGWl4RkqE1lRZWImgGv8UTzylZPbfcvUsNuNkPClUERguHSqN1NW8IrrndA5.eLIM1lzk5eWCMJKNCSYwPw; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:27 GMT + x-ratelimit-limit-requests: + - '10000' + x-ratelimit-limit-tokens: + - '200000' + x-ratelimit-remaining-requests: + - '9997' + x-ratelimit-remaining-tokens: + - '199969' + x-ratelimit-reset-requests: + - 22.599s + x-ratelimit-reset-tokens: + - 9ms + x-request-id: + - req_0db9de349e334c09b9fcedcd355e4db9 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_039b62fdcf88a203006991ca3621648192bb67ccd047e4f204 + response: + body: + string: |- + { + "id": "resp_039b62fdcf88a203006991ca3621648192bb67ccd047e4f204", + "object": "response", + "created_at": 1771162166, + "status": "completed", + "background": false, + "billing": { + "payer": "developer" + }, + "completed_at": 1771162167, + "error": null, + "frequency_penalty": 0.0, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "max_tool_calls": null, + "model": "gpt-4o-mini-2024-07-18", + "output": [ + { + "id": "msg_039b62fdcf88a203006991ca371b54819296c87ce191eb2b12", + "type": "message", + "status": "completed", + "content": [ + { + "type": "output_text", + "annotations": [], + "logprobs": [], + "text": "This is a test. How can I assist you further?" + } + ], + "role": "assistant" + } + ], + "parallel_tool_calls": true, + "presence_penalty": 0.0, + "previous_response_id": null, + "prompt_cache_key": null, + "prompt_cache_retention": null, + "reasoning": { + "effort": null, + "summary": null + }, + "safety_identifier": null, + "service_tier": "default", + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + }, + "verbosity": "medium" + }, + "tool_choice": "auto", + "tools": [], + "top_logprobs": 0, + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 12, + "input_tokens_details": { + "cached_tokens": 0 + }, + "output_tokens": 13, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 25 + }, + "user": null, + "metadata": {} + } + headers: + CF-RAY: + - 9ce5277ab81eb89f-EWR + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:29:27 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + content-length: + - '1573' + openai-organization: test_openai_org_id + openai-processing-ms: + - '52' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_266594b6582945d2b5613e3548c983d5 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml index 73a3051471..4b276da03b 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -2587,4 +2587,341 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce5265b8c5dcb3a-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '15' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=nFrghf2nf4sYMaFwcBUEY0hPTWPgf8p0HaE2rdhH7Zc-1771162121.521758-1.0.1.1-GJeHWEkHM3eJNcN4HQCNCH0794uvJImm6kczMwqzmCFeRM6HLFqneRIa02eQRSbiVb6p4_xzHH12Mxo8QsYON6BLLHGAit6prxrTsiHXG5OG7ZwZH1gbbULEk.2Jw7xA; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:41 GMT + - _cfuvid=KdjwgG6mzBZKXeSho6MOTeWM8mAm2CGtfvbG1dq1XWQ-1771162121.521758-1.0.1.1-ZQSnI09riML3W8ZnHjgvIdr_9TCTWQmRJ5_wVx.oFPE; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_a7601f19d8274ed2a7916775c77fcdb5 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","object":"response","created_at":1771162168,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","object":"response","created_at":1771162168,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1771162170}} + + headers: + CF-RAY: + - 9ce5277cae072fef-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:29 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '827' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=xSqwQVa6411qipgIrQXbxWuDYVoDQdlLE56vYMWVJYI-1771162167.782927-1.0.1.1-udMNo_gqmbbWYTsjRkPs7Pe9IPbMFvTVD_WOdJt9E_m7VCNliULZfT0aPZZ_jzOH7LrtxMjwEMKPioHqGCDRrJfspZu2w86WS7xxusYUdosgsZGbWAo2jnV3s63fxB1K; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:29 GMT + x-request-id: + - req_086b9e3b4fbb4969a2f89c904e8314cf + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288?starting_after=0&stream=true + response: + body: + string: |+ + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1771162170}} + + headers: + CF-RAY: + - 9ce527a2ba303d3e-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:34 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '334' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_9adc65bca281433bb3ca194578773fd2 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml index f1c9a79d76..16b3d3083e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml @@ -218,4 +218,223 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce5265f095afd86-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '15' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=xEuDDyrRAbNu0ud0BG8DfJhAshDmO50Yl.va1drRQiM-1771162122.087318-1.0.1.1-ZcQ7nRp3YRBsegCtgBAjmHZwTW8N8omk0_EIU0u2Maddk9kfaIkjsX2zb9SPhUIgk.iZWT6J0GKEpWNp2gb4qgOYQSLLng_crZBRnGg9rGKyPX6uIvcHBUUZWheo5wUI; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:42 GMT + - _cfuvid=OF.URk.pRthB63UPDPbLUW08I7JcHOFF23qYdC86xo0-1771162122.087318-1.0.1.1-FbTzNwMzx9bLDYr7mTS3PXbTak5o9DtlMw4680ComCA; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_76bed75952e74eb683090dfc43963706 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_08959ae34ba9b90e006991ca43392c8193ba2bff54ad1765a7","object":"response","created_at":1771162179,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_08959ae34ba9b90e006991ca43392c8193ba2bff54ad1765a7","object":"response","created_at":1771162179,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"f1ugSGhRPtVk","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"eZq3h4S1eV0TD","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"L7RpJE2bRN1kSM","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"DiYsp1RjUDC","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"91BJCJ5N2PNYbg8","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_08959ae34ba9b90e006991ca43392c8193ba2bff54ad1765a7","object":"response","created_at":1771162179,"status":"completed","background":false,"completed_at":1771162180,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9ce527c15c7606a1-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:39 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '59' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=N47BONMHl.W7xFTPaKpIjD5mKWScgD18hOrYVki7P6Y-1771162178.7743359-1.0.1.1-R_8wmj6682jbUqgI6DRAAAEpN2cVBcX.5scuCTLLBi7w3mYgyMfOulXwayZ0yb3Fl14zwE2oRcp1_U4a6HsOqgkuiFS5wmcyo22kPIz5FuAK_JCFhiHCcGx70zWXBNuE; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:39 GMT + x-request-id: + - req_dc4c5cb64bb240f1aa13fcf53248ae28 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index b5ead1ec69..05be904c01 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -3055,4 +3055,344 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce526567f83c45e-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:40 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '16' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=akRdtKb5nR7YeriBzX2HcpHUk.pINvjidWqKGhwXNVM-1771162120.7126136-1.0.1.1-XQs2ADMD3XdFWWajozu5BqH0l10DfpLSrNwuCPpY48WNN9ueKIAy9QAFgviXgv3h5TDwi20uQqE7_mDSHfhnWkQxLw5f73m93yMY1Pg9cgPR2x9WonftjqCSFouPcVCk; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:40 GMT + - _cfuvid=n7kFm1njsD4fNGzq41LopqBS_L1TczUUXSJh__1hIAk-1771162120.7126136-1.0.1.1-nb5Qgw7P0wNcLpPFakJJ6w0GLGjMUkSsItuhzsv2_fY; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_db4847507edb41a6848e1a10c5e54368 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "background": true, + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '91' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","object":"response","created_at":1771162158,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.queued + data: {"type":"response.queued","response":{"id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","object":"response","created_at":1771162158,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1771162160}} + + headers: + CF-RAY: + - 9ce5273bf97a42ea-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:18 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '653' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=9adPse4e7Rz6LUwGDIrBvfKwyaLPy171g5HuE2k5.kE-1771162157.4320157-1.0.1.1-l4yPIYMzPACmwUGb1ViSxzyOci7PbGAN9i1Q0PeqpqrMq1yhLVM51CUV3SAnPdNIDQ6wk0vGQpZ8Cv8yLycgYgftWNWv62QzRwG.kOhoMYIiSGSQC363o7y8MKR_azFh; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:18 GMT + x-request-id: + - req_d21c2914ed554da6a9263a5cdd950117 + status: + code: 200 + message: OK +- request: + body: '' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + cookie: + - test_cookie + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: GET + uri: https://api.openai.com/v1/responses/resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12?stream=true + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.queued + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.in_progress + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + + event: response.content_part.added + data: {"type":"response.content_part.added","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":8} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":9} + + event: response.output_text.done + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":10} + + event: response.content_part.done + data: {"type":"response.content_part.done","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + + event: response.completed + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1771162160}} + + headers: + CF-RAY: + - 9ce5275fcd4b429a-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:23 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '303' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + x-request-id: + - req_e9c58b155594433cb864d99c852f6786 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index 2227a8958e..4e55215f73 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -1736,4 +1736,223 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce526544b59cd7f-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:40 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '18' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=e9bCnNV2R6zbmfkV.mBTAvBvN9WHTkkvO3tQ70.EtNg-1771162120.3623517-1.0.1.1-FzANODuQ8ZC8cecdmSNgqAPUlKuIZuCjdix19cRzqbSwNcDZyIMEoQpZvgtTE6035Rfcp.SvaPfIdw1_FM0x6.jM5vrPSApbuNPXuUcNhcUCznouYpidx493eYaGYHcI; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:40 GMT + - _cfuvid=Br64oeFq3AFUeSJl5pbmkglBM4l9DItw20kGfo1C3P4-1771162120.3623517-1.0.1.1-4GOZifOwFGuLE51OdkVPSMLTfE4QnLXKRrbkIU08lrQ; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_8636db8fb8644d40b22c1312f9c15cc6 + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0f3c3fff467e7fb1006991ca2ad7188196a7ad12038cecab96","object":"response","created_at":1771162154,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0f3c3fff467e7fb1006991ca2ad7188196a7ad12038cecab96","object":"response","created_at":1771162154,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"55STbyLXTRmU","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"WCzA6M9pV2M7u","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"3t2kz7Oq79hfPj","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"8v8uVsUDt7x","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"sz1yG9Os2U649wB","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0f3c3fff467e7fb1006991ca2ad7188196a7ad12038cecab96","object":"response","created_at":1771162154,"status":"completed","background":false,"completed_at":1771162155,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9ce5272b7a75786b-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:14 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '98' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=Fk3T0Em4kjPrthWAqt101MiRpgGqL0p8s3ec_D5yXQs-1771162154.7935753-1.0.1.1-ovWDjEWI54Gm8Buicl65YGp.a0KgJBQna8lb5wfeV3ZJvJrMsmWTg6ekO5uVKAZekw0c_TUcFSF.eXhFuhXHHYlITItdR0xfNbo8qHfRnbqwCWZLXi79wrfHXaYMHCz6; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:14 GMT + x-request-id: + - req_9246678632f24bb4bf1f950e27ac59a9 + status: + code: 200 + message: OK version: 1 diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml index 5acd56fcbe..0158279e61 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml @@ -218,4 +218,223 @@ interactions: status: code: 200 message: OK +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |- + { + "error": { + "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", + "type": "invalid_request_error", + "param": null, + "code": "invalid_api_key" + } + } + headers: + CF-RAY: + - 9ce52663b92528c9-EWR + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/json + Date: + - Sun, 15 Feb 2026 13:28:42 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '14' + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=8zsrkINUnUAzZijN97BU7O_6EQACR0S6gSGdHaA_IU8-1771162122.834196-1.0.1.1-JpPynt2cHRZ64IPwif2rw8GCv9HYPC_EeHNeyBnN1i1p_WATtOJ1DsvPJaGJ8eF7Q5MY.Au1hlh3dMtU3.tna6blxOhJ3b1CPT.60aECr41axmJxtSsaK3GyHDob55BP; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:58:42 GMT + - _cfuvid=fN1Clpv9q0muYZDrZ6v8IYTKP1ysUZzrHWErZp8bYI4-1771162122.834196-1.0.1.1-da_MGtsgNI67Qv6sXX5QyewL5B2PEfFovNXT4NnJeaY; + HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com + www-authenticate: + - Bearer realm="OpenAI API" + x-request-id: + - req_fe62255bf4bf4f79b367bb746feb937a + status: + code: 401 + message: Unauthorized +- request: + body: |- + { + "input": "Say this is a test", + "model": "gpt-4o-mini", + "stream": true + } + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '71' + Content-Type: + - application/json + Host: + - api.openai.com + User-Agent: + - OpenAI/Python 1.109.1 + X-Stainless-Arch: + - arm64 + X-Stainless-Async: + - 'false' + X-Stainless-Lang: + - python + X-Stainless-OS: + - MacOS + X-Stainless-Package-Version: + - 1.109.1 + X-Stainless-Runtime: + - CPython + X-Stainless-Runtime-Version: + - 3.12.12 + authorization: + - Bearer test_openai_api_key + x-stainless-read-timeout: + - '600' + x-stainless-retry-count: + - '0' + method: POST + uri: https://api.openai.com/v1/responses + response: + body: + string: |+ + event: response.created + data: {"type":"response.created","response":{"id":"resp_0551647e47b36f7b006991ca45d82c81968866cd5d612b355c","object":"response","created_at":1771162181,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + + event: response.in_progress + data: {"type":"response.in_progress","response":{"id":"resp_0551647e47b36f7b006991ca45d82c81968866cd5d612b355c","object":"response","created_at":1771162181,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + + event: response.output_item.added + data: {"type":"response.output_item.added","item":{"id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + + event: response.content_part.added + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"0hejdXud6rxk","output_index":0,"sequence_number":4} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"3HfydY288usBU","output_index":0,"sequence_number":5} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"7KsQ0mKOoHQo5I","output_index":0,"sequence_number":6} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"L7LFRx0t2av","output_index":0,"sequence_number":7} + + event: response.output_text.delta + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"EpARTQvluDMl9HS","output_index":0,"sequence_number":8} + + event: response.output_text.done + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + + event: response.content_part.done + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + + event: response.output_item.done + data: {"type":"response.output_item.done","item":{"id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + + event: response.completed + data: {"type":"response.completed","response":{"id":"resp_0551647e47b36f7b006991ca45d82c81968866cd5d612b355c","object":"response","created_at":1771162181,"status":"completed","background":false,"completed_at":1771162182,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + + headers: + CF-RAY: + - 9ce527d44e37d481-EWR + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 15 Feb 2026 13:29:41 GMT + Server: + - cloudflare + Set-Cookie: test_set_cookie + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + openai-organization: test_openai_org_id + openai-processing-ms: + - '57' + openai-project: + - proj_s74VWObPgWXRchv2sHdrOTPY + openai-version: + - '2020-10-01' + set-cookie: + - __cf_bm=7gC6oIZ6fwb.PkITmn74.6mqLUjJoeqn1cNzridzlsU-1771162181.8053312-1.0.1.1-qyoOomZo5GSxbEeoHoo0uLi0HPPvV4h_50W_WXymzoy6.1YDsclMCOBXSaKdSmn8Bh_QGq7izJySVjjjVbMJK0dKsTA.y8AIEMEVVrrHFGo3GSuWy2b4pcOZ6I_hzJQe; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 13:59:41 GMT + x-request-id: + - req_0a12e1e0030f4d3fbd46b214cd85d7a8 + status: + code: 200 + message: OK version: 1 diff --git a/util/opentelemetry-util-genai/src/opentelemetry/util/genai/utils.py b/util/opentelemetry-util-genai/src/opentelemetry/util/genai/utils.py index 616d9ab471..3fb6417cee 100644 --- a/util/opentelemetry-util-genai/src/opentelemetry/util/genai/utils.py +++ b/util/opentelemetry-util-genai/src/opentelemetry/util/genai/utils.py @@ -111,6 +111,18 @@ def should_emit_event() -> bool: return False +def should_capture_content() -> bool: + """Return True when content conversion should be performed.""" + if not is_experimental_mode(): + return False + mode = get_content_capturing_mode() + if mode == ContentCapturingMode.NO_CONTENT: + return False + if mode == ContentCapturingMode.EVENT_ONLY and not should_emit_event(): + return False + return True + + class _GenAiJsonEncoder(json.JSONEncoder): def default(self, o: Any) -> Any: if isinstance(o, bytes): diff --git a/util/opentelemetry-util-genai/tests/test_events_options.py b/util/opentelemetry-util-genai/tests/test_events_options.py index 78476de880..f83fc9562e 100644 --- a/util/opentelemetry-util-genai/tests/test_events_options.py +++ b/util/opentelemetry-util-genai/tests/test_events_options.py @@ -25,6 +25,7 @@ OTEL_INSTRUMENTATION_GENAI_EMIT_EVENT, ) from opentelemetry.util.genai.utils import ( + should_capture_content, should_emit_event, ) @@ -206,3 +207,45 @@ def test_should_emit_event_user_setting_overrides_default_for_no_content( ): # pylint: disable=no-self-use # User explicitly setting emit_event="true" should override the default (False for NO_CONTENT) assert should_emit_event() is True + + +class TestShouldCaptureContent(unittest.TestCase): + @patch_env_vars( + stability_mode="default", + content_capturing="SPAN_AND_EVENT", + emit_event="true", + ) + def test_should_capture_content_false_when_not_experimental( + self, + ): # pylint: disable=no-self-use + assert should_capture_content() is False + + @patch_env_vars( + stability_mode="gen_ai_latest_experimental", + content_capturing="NO_CONTENT", + emit_event="true", + ) + def test_should_capture_content_false_when_no_content( + self, + ): # pylint: disable=no-self-use + assert should_capture_content() is False + + @patch_env_vars( + stability_mode="gen_ai_latest_experimental", + content_capturing="EVENT_ONLY", + emit_event="false", + ) + def test_should_capture_content_false_when_event_only_but_event_disabled( + self, + ): # pylint: disable=no-self-use + assert should_capture_content() is False + + @patch_env_vars( + stability_mode="gen_ai_latest_experimental", + content_capturing="SPAN_ONLY", + emit_event="", + ) + def test_should_capture_content_true_for_span_only( + self, + ): # pylint: disable=no-self-use + assert should_capture_content() is True From 11d1b3c008aa7de92458c124d32d7049bd4db2f7 Mon Sep 17 00:00:00 2001 From: Teja Date: Sun, 15 Feb 2026 15:26:54 -0500 Subject: [PATCH 16/20] regerating cassettes and fixing failing tests. --- .../instrumentation/openai_v2/utils.py | 12 +- .../cassettes/test_responses_create.yaml | 2410 +----------- ...est_responses_create_captures_content.yaml | 382 +- ...es_create_captures_system_instruction.yaml | 387 +- ...reate_no_content_in_experimental_mode.yaml | 382 +- .../cassettes/test_responses_retrieve.yaml | 3442 +---------------- ...ses_retrieve_stream_existing_response.yaml | 2748 +------------ ...est_responses_stream_captures_content.yaml | 352 +- ...st_responses_stream_existing_response.yaml | 3230 +--------------- .../test_responses_stream_new_response.yaml | 1870 +-------- ...tream_no_content_in_experimental_mode.yaml | 352 +- .../tests/test_responses.py | 10 +- 12 files changed, 227 insertions(+), 15350 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index 671498abda..bf433645c4 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -42,17 +42,19 @@ def is_content_enabled() -> bool: + capture_content = os.environ.get( + OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, "false" + ) + legacy_enabled = capture_content.lower() == "true" + try: from opentelemetry.util.genai.utils import ( # pylint: disable=import-outside-toplevel should_capture_content, ) - return should_capture_content() + return legacy_enabled or should_capture_content() except ModuleNotFoundError: - capture_content = os.environ.get( - OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT, "false" - ) - return capture_content.lower() == "true" + return legacy_enabled def extract_tool_calls(item, capture_content): diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml index 430e2441f9..6aeee65254 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create.yaml @@ -47,15 +47,15 @@ interactions: body: string: |- { - "id": "resp_0b1b70a6d91f11da0069841dceb95081949165d050fe8f1c35", + "id": "resp_0ddadc2b6c99631e0069922bc4c8b881a1bb297b80eab5f2da", "object": "response", - "created_at": 1770266062, + "created_at": 1771187140, "status": "completed", "background": false, "billing": { "payer": "developer" }, - "completed_at": 1770266063, + "completed_at": 1771187141, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, @@ -65,2395 +65,7 @@ interactions: "model": "gpt-4o-mini-2024-07-18", "output": [ { - "id": "msg_0b1b70a6d91f11da0069841dcf11a481948bdee40b06bf8983", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test. How can I assist you further?" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 13, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 25 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9c8fb1ebbf93436f-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 05 Feb 2026 04:34:23 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1573' - openai-organization: test_openai_org_id - openai-processing-ms: - - '605' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_b30645d3740b4d31ac6c998c158607bd - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '72' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.109.1 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.109.1 - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.9.6 - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_029f99a286f1ea040069841e50fa0081a38a4e13b98c6d2e3f", - "object": "response", - "created_at": 1770266192, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770266193, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_029f99a286f1ea040069841e51762481a398200772dad9885c", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9c8fb519cbb151ba-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 05 Feb 2026 04:36:33 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '659' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-ratelimit-limit-requests: - - '200' - x-ratelimit-limit-tokens: - - '60000' - x-ratelimit-remaining-requests: - - '199' - x-ratelimit-remaining-tokens: - - '59969' - x-ratelimit-reset-requests: - - 7m12s - x-ratelimit-reset-tokens: - - 31ms - x-request-id: - - req_676e53bd4f8c4770bb6a82a40743c6da - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '72' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.109.1 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.109.1 - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.9.6 - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_09edbd762bdb54ff0069841ed6c32c8193982e6c6b188159d2", - "object": "response", - "created_at": 1770266326, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770266327, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_09edbd762bdb54ff0069841ed779b08193bcc0dc18a78e1d55", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9c8fb85dfbe78df5-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 05 Feb 2026 04:38:47 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '910' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9963' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 5m15.516s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_36116ec88c4c4adab17e46d22be27cfc - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_05c57262f43718d1006989e158bca88195adf66f24f30e1873", - "object": "response", - "created_at": 1770643800, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770643801, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_05c57262f43718d1006989e159a14c8195833f0325056cb25c", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3b803f8cf187f-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:30:01 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '1119' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=yYN9OhPtOTNDXZ7PAgbMN55jQD6enH260TMCT4O31MU-1770643799.6738563-1.0.1.1-ak0XllYGcXlqKOWWW8we3uhfDon48xF5Qs.UMtekewHY4XM91.OqJAjNtM6t0gVCXn_USW7rWqvD9LF1treKLJKJ4TbjCw.m5adAcnGVOgoHRTwlD7hIvWL1v643wmyj; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:01 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_1ece7d17a31847bb9d346cc7703044a4 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0045ca85f1f0f66a006989e2f015548196aa0850ea7d894061", - "object": "response", - "created_at": 1770644208, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770644209, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0045ca85f1f0f66a006989e2f0fdd48196bb9ccadfe941795e", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test!" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3c1f88eca1325-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:36:49 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '1068' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=6DEosT5G.YYiJ4sRm.eesC0PDSQ69w1UsqpfNSEds04-1770644207.4421477-1.0.1.1-182TAXB7kODeUjVY8_HVkxudBab48tlIKrMlIr075WJvsQ55BcFM4T.IVN7R70Eaw40HIqiL7W3H.9CYFXaKrhWVG5QxU3G4CYn6o87WAu3AzpolDMlN6XFeMlYlyqGe; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:06:49 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_3373b0ec8435486e80e359c53bece0bd - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_09ffefdabc58dfa3006989e752d0388194a0a3508d358da156", - "object": "response", - "created_at": 1770645330, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770645331, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_09ffefdabc58dfa3006989e75366dc8194af6c540481183eb1", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3dd654f4af4d7-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:55:31 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '760' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ncyRcnHSHBZCymvuIKVeWZW6cmjitBWjVw6Wq.GNKSY-1770645330.7677965-1.0.1.1-CW7sPX00Wn_NNdmRB6OKxI9e6AC6CI6MLL0gXFrRd7DmrfOFgVdGSVNhYAd9B3eqWUXPU3aVvbB2XsH72lWrRs9_BJjGi_bjmj.U4hMpuLLi5Az42YLZZCM_M5ChV7gV; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:31 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_e2451b6f2f5841c3b3b92f2cfc24cc5a - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_05fa94544fb0f75100698b1d2527e88191a9fe1bbfca2345df", - "object": "response", - "created_at": 1770724645, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770724646, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_05fa94544fb0f75100698b1d260e748191bb826f6373cfe419", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cbb6dc468052ef2-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 10 Feb 2026 11:57:26 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '1087' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=tpbqst2i_VMPcUNqMEpGV.xIWu1CPOJpIx46Hdh7e38-1770724644.5486097-1.0.1.1-D7GXopbFON4n_kYzKpvY_GxU_0.uvvf9eg9_tnC5T4jgFdKidfLIWoGwvimadwax4EeQbKlsDExtQ5Mbe_uEEirQngDyuVvkQC2KWkuM2AkkBUwK4i0orC4KqiA.sxkE; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:26 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_5150044644f64aceb311a713aa1f57da - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0684d8081461c9d700698b23a1790c8193b605c8d53232be76", - "object": "response", - "created_at": 1770726305, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770726306, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0684d8081461c9d700698b23a201388193a43b6ec8f66a84ec", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cbb964c1a653eb4-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 10 Feb 2026 12:25:06 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '920' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=c8GlYQgsWUlM7dXhHXiKxD8OPT7IIY9hwRtrOdDiRVI-1770726304.6518757-1.0.1.1-ravVEb0k_BTqgnqMj.QkBrgdKm4kAHXTWNucwGiZjYBXjdriNB4oq76ucihPMchNdYC3qAxSpAtMlqsYt_.tpxqe4vQKYo.mwpLhorw7AwtYQn41sQd.G18XcagHspJ7; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:06 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_da3da8daaa404e4981cc39c6945b74b0 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_08d671ab98e6b7d800698d4cf970ac819cbc43184a3e3b6fb2", - "object": "response", - "created_at": 1770867961, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770867962, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_08d671ab98e6b7d800698d4cfa04f0819cbead98e1ab843fea", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc918b6ddd8d481-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 03:46:02 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '720' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=jhyCr0.CLvXLfVnt.FNtHeA3.7VP38czYAcykw19hrk-1770867961.4132617-1.0.1.1-5iqVtG.KtdaoU4fum2qrI3i5IDAfRSMOxLf4d20RXr8WR_ymUKJL5gLrOjVMKLxTNUwFLfSQ9xR34K2xpcwGV2jBkOvfFclA0QUXnthNlYELyhJfCXmJHwiNz31Aobg5; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:02 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_1a587d2d779b4fc69008bd53562c9f4f - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_07bc67aa5352aaf800698d4ff0e0b881a1b7c39058e7ff881c", - "object": "response", - "created_at": 1770868720, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770868721, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_07bc67aa5352aaf800698d4ff1674481a1a61e8d6717d64c40", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc92b415e29db40-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 03:58:41 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '688' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ifZ52bt5H0wCqQ7KkP86zwUftyqSRtSUcUuPMK22TyY-1770868720.851776-1.0.1.1-HXcMonzDPmZq9mqqsy7aozrznqq9DKZpw_1BA7NdkVD6TnBzlqw9_BbNlO8QSYOYIAXJVSehHjiFLh_GOpX3zjuBT3PPcGDfmVpyPrQZy8zfJ027SgXSewVPTpmtbjkG; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:41 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_bbde805431a148c392640a6abc93efe5 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9312969f47b0b-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:02:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '17' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=A1rYA8d4AFiFQwlXYOgSUufZ1hfKtz.Tsg5oM80ub9s-1770868962.7852468-1.0.1.1-xWLT4CAuW7PbiTja0EtnHy4zFsV1BhMvQ_gYG7vdfPGvG8fwAR6dvy8QPMoA_PjNw_g11HQ_Jad0J.0Jf3x6rAqz8dfKmdQVXhg_NU2yUSF6EsyDKeiKBoubMueYVJiH; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:32:42 GMT - - _cfuvid=URv6mwaE0_NT3FCVH3lVytzg4bpA_VqC03rHSxLTx4Q-1770868962.7852468-1.0.1.1-g6hM5ABd.LbGU33hcDnwKwZgT5KPCqYhP1L3giL3vSg; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_362605ce1ed64052b084361298bbc284 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0fb74957081fdb0b00698d5164ba6c819785b68fc76f1517ad", - "object": "response", - "created_at": 1770869092, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770869093, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0fb74957081fdb0b00698d51652c908197a514612adcac8a57", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test. How can I assist you today?" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 13, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 25 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc934554d6e1512-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:04:53 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1571' - openai-organization: test_openai_org_id - openai-processing-ms: - - '904' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=SD62VIBPrWCGTDOHfjSrAp4EYq7MGj2PvSm9Mzf59Q4-1770869092.682529-1.0.1.1-AbaMKYSTrLUfnnSx.uscSOJfMIg8OBVuJPCe5yHEA4UGceY6wKprVcjmZcLoa1.cEKOVcwz44zXrOI7NmuzH5w8Gdo5xJnv6BuBARCD0vVQkgmNQe.mlFHIx9Q0f9Htz; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:34:53 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_07d567b4f2084f96aab66988162b1256 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_06dc6cdba7e9968700698d614a849c819ebc87217646f52938", - "object": "response", - "created_at": 1770873162, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770873163, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_06dc6cdba7e9968700698d614b12d8819eb0ad438ac0c471d4", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc997af7873eeee-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:12:43 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '704' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=H2ddfDrktaHHAFOcMtS2nHYYhLqqKDkre9arPEKoFCI-1770873162.1530507-1.0.1.1-R7g7wdKCg6qKwihgmag2SFzAMK7KFT_y1j1..th76Yg0d7QW8baNg2LGBP2o6geeoI1ASNTyLE1MzY3ZkNR9bcsW96wxk4CoZzfSIjAKTT1CR3uzPQwXOEr9FXz8a3fF; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:43 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_e509f507077649599bff6fda12d9237d - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_05027429832591a700698d6660c5c4819da38b79b9e05ca4ff", - "object": "response", - "created_at": 1770874464, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770874465, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_05027429832591a700698d66613da8819da853060aed5a68ad", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test! How can I assist you further?" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 13, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 25 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc9b77ca82d5f83-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:34:25 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1573' - openai-organization: test_openai_org_id - openai-processing-ms: - - '885' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=UR_NYL6QZHL3fLsSiup7F9IQuZ2yy5ZuPpkOjeh.KMg-1770874464.7465413-1.0.1.1-Ju1T.6uRbDYAy4aMhnuWXG3h.R50zR37hMwpzIPUEoX8.XqPSKO2F6PxQo6N_o7BMLg.5MMlWt.pcf8IPUJyoUQgERHT6dKimEaZIDxh1NazI29Vz6698BLpbdNsHtnh; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:25 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9999' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 8.64s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_809fd2d79531447b9c2f5491920ceda6 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce52651baac7291-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:40 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '17' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=jjhTsEYvu0ZxKQQVZmNBf4k86LIGNkHv4.dPXE_SYMw-1771162119.9576197-1.0.1.1-vyg2v0jqjzy5h.1EHu1SP7P_OzpLNlN4YPo_V7GeVmkl8TCv2DyJkHY_an65Q9X2HgDWWw2AiCncKZQmbS5fCoI3gAyLlCbc6ndEcuLOG6Ct5qZkiTqeLyMIMYHWVnzB; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:40 GMT - - _cfuvid=lu0Ewn2CUYhMm1AvMTXg922CoEldsiKXbEoENEx0mSE-1771162119.9576197-1.0.1.1-KKg1jRrcSdiTACnEsaSC3Re6t.rfZMi8ZWfVhpMQLtU; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_ae019b5912d14856af76e32a5be47f26 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0ba73fa7a946049a006991ca2959a88195921a1eb1d78e0bc1", - "object": "response", - "created_at": 1771162153, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1771162154, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0ba73fa7a946049a006991ca2a5fec8195a0f8a257b2bc2eab", + "id": "msg_0ddadc2b6c99631e0069922bc5bb7481a1bd2cf765e86f0324", "type": "message", "status": "completed", "content": [ @@ -2507,13 +119,13 @@ interactions: } headers: CF-RAY: - - 9ce5271f0c30785b-EWR + - 9ce7892a1edf6e28-EWR Connection: - keep-alive Content-Type: - application/json Date: - - Sun, 15 Feb 2026 13:29:14 GMT + - Sun, 15 Feb 2026 20:25:41 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -2531,15 +143,15 @@ interactions: - '1542' openai-organization: test_openai_org_id openai-processing-ms: - - '1176' + - '1117' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=IHyl6o.Uizu4jSVyzImzL8jVdZTbIIYZMrXvGt0zXZQ-1771162152.8053372-1.0.1.1-c4sbKi5fF5FoxXHUVkKN.lTn4TYbX6OZLCEqt3WhR5LC1.9FZHllB39aGjgRJT9t2Co2WdUCpMlKN9i.7AbODp9XoT8JDOhOzn0W._KeRJrW4uB63hRBrjnKEbU6dbSl; + - __cf_bm=EqzSyI6frjYjpe4KHsZwfOCC3u_Kwly3Sd3J5Zds8zI-1771187140.1743493-1.0.1.1-OmexI2NvBMMEXBpmchsnZHZYoTN49ITf88EX6vLlvPVe2omNldWnkBVDxPsaqC43T_5jYbgXJ8TWJOreyavfvAJJt5s6AT_6hiOPPN9GC8ZuS6nii1Buh8VcBBlsCibo; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:14 GMT + 20:55:41 GMT x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -2547,13 +159,13 @@ interactions: x-ratelimit-remaining-requests: - '9999' x-ratelimit-remaining-tokens: - - '199968' + - '199969' x-ratelimit-reset-requests: - 8.64s x-ratelimit-reset-tokens: - 9ms x-request-id: - - req_47f31107c5f34232b6fc8780dba3f102 + - req_599094c097964d0d8609a82a7d64b624 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml index 7789c4e409..df7fec79a0 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_content.yaml @@ -47,375 +47,15 @@ interactions: body: string: |- { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9b6d9de897c9a-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:33:58 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '25' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=NQmt3rscpkkDtkPgh5kFmBT.X.dvbshbJ5SFdGXndAE-1770874438.694763-1.0.1.1-zlhE6_Ivcj8uJmrmeTo9j83oHX2.qQ5CYyQpXtAfk84mquJjYHOZp1vQtEbpl8tThCVxWumPA2IgGufX1ATzcctai5ubASAfMS8yWWmGdguSBxH0mAarz7W3rV3JPls2; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:03:58 GMT - - _cfuvid=bel0IWQ5MIzmX9eNBr094yb88H2sp8sHtSHtKVwKqSk-1770874438.694763-1.0.1.1-8pvU7q1aoS_iVFcMo90Np_i8EO1_uZWF8pWNc46F0MQ; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_19e2e8de40d649c19429d51778481133 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_02b7cb119bfee61000698d6674e450819cba84676dbe0a3682", - "object": "response", - "created_at": 1770874484, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770874485, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_02b7cb119bfee61000698d66751eec819cb3c34e13ffab3483", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc9b7fa58b10f39-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:34:45 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '409' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=1nwbeDYnksQcDcdG5v6tdiuqM2Prmye60lOR9K0FS4U-1770874484.8604217-1.0.1.1-NvWUGq_THbvaz1Xhvrihz_jJSGOCNb0EKRajy0dC7JF3HCzBITxATJUiGyKA7NQts2LOl45qGJFOQR.SAYysmJGRpYPB0ZjECMbBJbMI8aG57QyjDGxIUs1XX0iNOoOW; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:45 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9996' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 31.914s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_f3f094031a879fc186ebb21db24ab611 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce5265d79968068-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:41 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '26' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=5hnHdmOWkzpSL5phN8zyh9LvGDhHOlKXr3k7jnvlwR8-1771162121.8365912-1.0.1.1-dz30CGxzBWW1ykG0pFKKHN3xzj48YgNM4ZJ5PTuw..nOEY57xtcj7b4nh4z3IKJL7MrNQfy33qd2IB0.VNBhOU1wViWFnpbb7Dn5LApTG6bU3IjD0qkeY9ph7.sJeWvZ; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:41 GMT - - _cfuvid=UeddeX4o.nX6eUUMvv9hD5XzliAIgX29jEbf8DwYH2k-1771162121.8365912-1.0.1.1-SB4_Uh89SpUM33bMkFjs3WYn32gFa3V.CLy6mUMESF0; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_85fd1729702543cc9348417ef7ec16eb - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0ae0e912ac510612006991ca415c18819698e41632722c4887", + "id": "resp_0a692bbc4a9a738e0069922bd6dff081a0bf3b31e4574406b3", "object": "response", - "created_at": 1771162177, + "created_at": 1771187158, "status": "completed", "background": false, "billing": { "payer": "developer" }, - "completed_at": 1771162178, + "completed_at": 1771187159, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, @@ -425,7 +65,7 @@ interactions: "model": "gpt-4o-mini-2024-07-18", "output": [ { - "id": "msg_0ae0e912ac510612006991ca426b68819684e3027af40f466f", + "id": "msg_0a692bbc4a9a738e0069922bd7639481a0a23616dd17799eee", "type": "message", "status": "completed", "content": [ @@ -479,13 +119,13 @@ interactions: } headers: CF-RAY: - - 9ce527b44f143d08-EWR + - 9ce7899ecfb1c623-EWR Connection: - keep-alive Content-Type: - application/json Date: - - Sun, 15 Feb 2026 13:29:38 GMT + - Sun, 15 Feb 2026 20:25:59 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -503,15 +143,15 @@ interactions: - '1542' openai-organization: test_openai_org_id openai-processing-ms: - - '1257' + - '680' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=AYdPtUzf8fw7wF08NIgZfhE3jROjSnNxErk4twDMHlc-1771162176.6882827-1.0.1.1-WLZf.P6Vg.P8sCz4tCtYWXpcuTMGhvd4WDbQO2Vtc9FgXQvR_Zlm9w.lHew0M91NQMbbeQEIhwCVs3DTt_noQRTYCkW6_8KZWhO5EAL.P3gm3BOe9lgFM77e6L8FhdkL; + - __cf_bm=Lbl9DmPj4kySvF1eCafY9T.72od8gDdGIcR6nMvlxSM-1771187158.8475974-1.0.1.1-DH7BPaBw8nKQK0B5lfBSYvhHSTWUreFW2DrfErLPfwM_IpreByWYdyGv7NbNayCYFpXQ3tOrv3ZRWlSwxCsKNLWnRqgoAsZxV4U97QOuR93RJVlDpWEaPPf4b8RtxUe3; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:38 GMT + 20:55:59 GMT x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -521,11 +161,11 @@ interactions: x-ratelimit-remaining-tokens: - '199969' x-ratelimit-reset-requests: - - 28.024s + - 34.205s x-ratelimit-reset-tokens: - 9ms x-request-id: - - req_abb4114ba099488a81bcfe9383043b06 + - req_f41b7b1fa8bc4e4b8bdd55a243075b36 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml index 1b357263c6..784b053ee8 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_captures_system_instruction.yaml @@ -48,378 +48,15 @@ interactions: body: string: |- { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9b6decada7aea-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:33:59 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '14' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=jzbRZIlC7BJVmQ1sbyzK7yCpRpKdQyGteA60kYdVwac-1770874439.4811592-1.0.1.1-d5MKUaccTFaMrgeXDhlX1jKgzqCEEHsuQLyW9_.74tHbzXzL8j4Zn9FQjyCC59WXnfz7EMP.aMfUp7EoaubPYF4msTJe_qpSTqjJr6IfhhTGhBasHlNkCMQ13hs0YxVv; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:03:59 GMT - - _cfuvid=k4P6ukPntd1BZdvpZuyT_XPCDoONDD05k4IKWZsy.Aw-1770874439.4811592-1.0.1.1-TmwN7GVVY1vDpiEzl48l0KbmVJ2SETnnDxy2lEp89Ko; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_dd08ef939edd4fd0b23b0705828bc70c - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "instructions": "You are a helpful assistant.", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '120' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0d868124323d633600698d66779e48819588bed1c8f7f84cd8", - "object": "response", - "created_at": 1770874487, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770874488, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": "You are a helpful assistant.", - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0d868124323d633600698d667811ec8195977363305a7d2b3c", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test! How can I assist you today?" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 22, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 13, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 35 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc9b80b4bf141f5-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:34:48 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1597' - openai-organization: test_openai_org_id - openai-processing-ms: - - '738' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=2qZG1qgW5.QrpPy1RskQhB9kW.tUFFMjHArgznhpsv0-1770874487.5680182-1.0.1.1-7F0vD0NCkTKIK4MIsBGfv52mQFf0Iu6P5lU7AvRf39e_dBStIzVXgFmDcCvUspbZod3tbIWbprxYG_5ZPnr.Lm0FhyaoZgvfSaknYCvr0SDHAqL8V2ngfMxuwxvbgpfw; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:48 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9994' - x-ratelimit-remaining-tokens: - - '199959' - x-ratelimit-reset-requests: - - 46.247s - x-ratelimit-reset-tokens: - - 12ms - x-request-id: - - req_91b6987423b3457c82e85b88b8d5fe99 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "instructions": "You are a helpful assistant.", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '120' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce52661ee4f57b0-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '25' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=dKbAIF.653aGG4qXviEIPaKxjUb9djsJ8oHcUTUbzT0-1771162122.545856-1.0.1.1-gXRh1nXAEaXIF3Yr_ObpmJ35Fn67CmiOijMwM.ppTSwocZblvYsfYaK2iQwpY9e9lsQZ8gvUBoHy5j7awH8hpulXoNVJeLNBMya9CimmHG0Jn1CCUCWiMWFqsSkSqPFX; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:42 GMT - - _cfuvid=8I5pca93UEe51dEAE7EQ.OKc.jHn4l0Uv1W72Jxvt5g-1771162122.545856-1.0.1.1-BLd7noGPX26Stgw4ckJ9rYtHXbhNCIMYGSDMJlzdCuI; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_5d69d2bcf41f4e41a58a7a04c152fc60 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "instructions": "You are a helpful assistant.", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '120' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0349adc29a03975e006991ca452f108193965dc4ec77ed3425", + "id": "resp_0233b438169682b40069922bd952e0819d81cec5cf35c84e81", "object": "response", - "created_at": 1771162181, + "created_at": 1771187161, "status": "completed", "background": false, "billing": { "payer": "developer" }, - "completed_at": 1771162181, + "completed_at": 1771187161, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, @@ -429,7 +66,7 @@ interactions: "model": "gpt-4o-mini-2024-07-18", "output": [ { - "id": "msg_0349adc29a03975e006991ca45705481938e0aa01dae0f46bb", + "id": "msg_0233b438169682b40069922bd9a7e0819d86b88f3926660e99", "type": "message", "status": "completed", "content": [ @@ -483,13 +120,13 @@ interactions: } headers: CF-RAY: - - 9ce527d02b688110-EWR + - 9ce789ae1dd261a4-EWR Connection: - keep-alive Content-Type: - application/json Date: - - Sun, 15 Feb 2026 13:29:41 GMT + - Sun, 15 Feb 2026 20:26:01 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -507,29 +144,29 @@ interactions: - '1568' openai-organization: test_openai_org_id openai-processing-ms: - - '414' + - '536' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=.n8AVJkA1d0eTjhC3v1TK2.I7x2G_5EE1TMRoVHSGTE-1771162181.1443655-1.0.1.1-xi9TkeVZr.xCGmq3JLmDCqat4P3CrdT333nbnWxtj346QFo0OQSLSxarMkrzKD4v4W_Y3LhsBXVKnnRtvfSEyh0h0nesafj6dXID.YwcyauWkx_.uWi_4QQsdTU_ACrr; + - __cf_bm=3eCCvSommNHuhREd5dxYrLGSytg4GALQnYmyVXMfgXE-1771187161.2950814-1.0.1.1-o2mJ1h4Tt6HcRvGyo42zkOXIleax_EI9XYyJKq.yPxrIc3VV5GFCrCVrMo.Xg..KubEy67gunDANwHKllJOuXIQVmYDm4YUdYmfunqeuyrNpchY_XJ6FOOFhqtLddF6z; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:41 GMT + 20:56:01 GMT x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: - '200000' x-ratelimit-remaining-requests: - - '9994' + - '9993' x-ratelimit-remaining-tokens: - '199959' x-ratelimit-reset-requests: - - 50.715s + - 57.872s x-ratelimit-reset-tokens: - 12ms x-request-id: - - req_7eb62b5571114c5c9e5960f98fb332f0 + - req_9674b98f2ad540d2ad8f83ae6bb085d8 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml index 121b460ed0..b2eb3a150f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_create_no_content_in_experimental_mode.yaml @@ -47,375 +47,15 @@ interactions: body: string: |- { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9b6dd380f8a15-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:33:59 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '21' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=LTNbrsMVohV7VdxzGbOxapvmSyBzs._B1Vc_Gy6_m_U-1770874439.2376857-1.0.1.1-JskG08Z2TGjfsBIpZPZEj20Y9IgUwzYlN7tuWDMBwwq42UhgQmT.MPdwdzO9UnWXMPHppaDftE7UPo_IxS37UpbHlZttpV0WyGsEK15_pGYHaFQkW.kWPKLa7iSvgt8y; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:03:59 GMT - - _cfuvid=0mSBkfDzql.xvKrYRhLVWtHSdpVo70N6vJzfMPAtYD8-1770874439.2376857-1.0.1.1-4DrnZiJjHt15kPuK8GYO24IJJ3FCiqBA3mq4JPfZP34; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_6c88b07f579c4a38a9ae00dccec51b4f - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_057803e6aa46c69f00698d6676bb2481a0b1b002964ef08a98", - "object": "response", - "created_at": 1770874486, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770874487, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_057803e6aa46c69f00698d6677395881a080b789886495cbf7", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc9b803d8107b0e-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:34:47 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '672' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=rCp8v5iZG.Dw2rt12wCmmTsN6BOqR4NG0rq7cLIlPGI-1770874486.3764565-1.0.1.1-3RuNpZXFrAV3ODsx.biDFRpKtuUzEWKSOyYrBuJnSql5tfz7bI4lvVcfqaLLrL4rPAT7wfUwOXU5XwgjQUnFnmaR5i6N.mLZySdn1auw1znpeKxTOAjOodJOIl3z7l0M; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:47 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9995' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 38.497s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_0c3113b870274b83ac59930d3b552399 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce526607cfc4f0b-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '14' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=Q5rZhXo12u4tRWk9uzqsVNW3z1H_SgFy1eEqBzzy9g0-1771162122.3170002-1.0.1.1-krleFUHu.lcC6wtnlX5qZaZZM1H.FmBextvl2tnTL4kpmwb48aDO6EsDRyqJPsm9woiQ4YpV6VQ0qx5O4cgrV2u0lmAFvTHl1J8HvVVWK_RI47QJ9a3XbVoTDM5ADF3z; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:42 GMT - - _cfuvid=uUsP7wN5XlrDTiGExZGcldiDVrrKoFSbwXctLKeloG4-1771162122.3170002-1.0.1.1-lUGBFV2LO1fr2kgAFmvssfcNJtOhIh3_Y55LNp_CRNY; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_410f21c3e79548f0840ff5d54d6ee800 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_03d3da6a97a892ed006991ca4464f08192ac667eaa9aab12a2", + "id": "resp_0d18b4a505bb3e7a0069922bd88954819f884008a1e164c94c", "object": "response", - "created_at": 1771162180, + "created_at": 1771187160, "status": "completed", "background": false, "billing": { "payer": "developer" }, - "completed_at": 1771162180, + "completed_at": 1771187161, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, @@ -425,7 +65,7 @@ interactions: "model": "gpt-4o-mini-2024-07-18", "output": [ { - "id": "msg_03d3da6a97a892ed006991ca44c5b88192a4ec5e584e09a073", + "id": "msg_0d18b4a505bb3e7a0069922bd8e5b4819f8e1086a823f00419", "type": "message", "status": "completed", "content": [ @@ -479,13 +119,13 @@ interactions: } headers: CF-RAY: - - 9ce527cb4d183eb4-EWR + - 9ce789a9281d60e6-EWR Connection: - keep-alive Content-Type: - application/json Date: - - Sun, 15 Feb 2026 13:29:40 GMT + - Sun, 15 Feb 2026 20:26:01 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -503,15 +143,15 @@ interactions: - '1542' openai-organization: test_openai_org_id openai-processing-ms: - - '515' + - '589' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=suzov_6noWRuorWPsGa9pcKxNd4d3GdPGyntE.7vov0-1771162180.3620577-1.0.1.1-nDHu0L5DkBwhqUOAxW1nofzau75tGTZ7vVPxHZPTbBrh6Px7llcdonAaoSUMXe0QJSudXau1qrRFSDdf7hif7dlfvcVm6qvR40R4_.x834LD1dlgZTInrp00XVacyHIf; + - __cf_bm=n4.5mxMWU4m5YLF1PpbKFO7tw4IRw1nmtvQzxo2rcB4-1771187160.510076-1.0.1.1-7uGrj0QFRCtsERMlJtLfzLI0fK_HaShDinmhpr1cpsoGs6We1zdnkAQqZhM2JlFB4aWnVCOOzs34A1meNF8BQjBHhPjPoWHYpjiCTHRno4JdFNvyhzuIperX.ZQkqIeV; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:40 GMT + 20:56:01 GMT x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -521,11 +161,11 @@ interactions: x-ratelimit-remaining-tokens: - '199969' x-ratelimit-reset-requests: - - 34.932s + - 41.391s x-ratelimit-reset-tokens: - 9ms x-request-id: - - req_5b96b9b8032f4ae890fcf1620c411307 + - req_6c5f965d80654f80bed9e7b7c3cf1067 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml index c2f069025f..c65299ca3c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve.yaml @@ -47,15 +47,15 @@ interactions: body: string: |- { - "id": "resp_0deb4578b1ea0c09006989e164cc848196a8fe5c4dc957cbbb", + "id": "resp_03af00866b03fea30069922bce690c8197af8c9605c28116a1", "object": "response", - "created_at": 1770643812, + "created_at": 1771187150, "status": "completed", "background": false, "billing": { "payer": "developer" }, - "completed_at": 1770643813, + "completed_at": 1771187150, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, @@ -65,7 +65,7 @@ interactions: "model": "gpt-4o-mini-2024-07-18", "output": [ { - "id": "msg_0deb4578b1ea0c09006989e165ac788196839d7f3837c04090", + "id": "msg_03af00866b03fea30069922bcede2c81979727cb46b656fd79", "type": "message", "status": "completed", "content": [ @@ -119,13 +119,13 @@ interactions: } headers: CF-RAY: - - 9cb3b855c859b547-EWR + - 9ce78969dcd319c7-EWR Connection: - keep-alive Content-Type: - application/json Date: - - Mon, 09 Feb 2026 13:30:13 GMT + - Sun, 15 Feb 2026 20:25:51 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -143,15 +143,15 @@ interactions: - '1542' openai-organization: test_openai_org_id openai-processing-ms: - - '1029' + - '639' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=pIcQAIMC8MUVfpXdPlIjq4fTiDuezIFZvzziXp1Rs4M-1770643812.764382-1.0.1.1-NEgiKilvlEFpWKu.MMAGwyA1mERdnaMR5I6KX7g_PzLXyRx3mtIUMFWN5rRYJzm.GPufBfa0rkUJ95hb5IsHrMiICM4hRPklRPgwTCoaOO1JBwLLJ9GUzqnibXgQbGUo; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:13 GMT + - __cf_bm=5VGMYEsZeS.ABFbzaCXfWVvbW3NKuqMPba5PaXoLGUA-1771187150.371446-1.0.1.1-oVgVIOIJiMxLBuCd55yeZ7VthiZFnQlBj2ns9QXws_fYVWTAeka0T81qJ7c15C4ptJrbZa2cLE6QtHr_pFlO3LHvsS8lUVYJP34h0QACa0ODIbQ1sInYNh0OZlBRgFwV; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 20:55:51 GMT x-ratelimit-limit-requests: - '10000' x-ratelimit-limit-tokens: @@ -161,11 +161,11 @@ interactions: x-ratelimit-remaining-tokens: - '199969' x-ratelimit-reset-requests: - - 22.615s + - 25.39s x-ratelimit-reset-tokens: - 9ms x-request-id: - - req_9bbc4bd4010f421a83aad23471fa0f9a + - req_9425bf3f0f79463996939395328f939f status: code: 200 message: OK @@ -205,178 +205,20 @@ interactions: x-stainless-retry-count: - '0' method: GET - uri: https://api.openai.com/v1/responses/resp_0deb4578b1ea0c09006989e164cc848196a8fe5c4dc957cbbb - response: - body: - string: |- - { - "id": "resp_0deb4578b1ea0c09006989e164cc848196a8fe5c4dc957cbbb", - "object": "response", - "created_at": 1770643812, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770643813, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0deb4578b1ea0c09006989e165ac788196839d7f3837c04090", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3b85d7eb54243-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:30:14 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '169' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=Ruc_aRSy487JW7wSxFlF896ZwWg4htfukl8b1y_a6Wk-1770643813.9922419-1.0.1.1-blfwDmS3yTE1WZ6Z0gl4EmBHSfxIjXw053bek.KD3eHVotcWcP8tAeznha71ljnbbT0RngX1MXcSxI26h8lSxognfwJMRqICqiyC3sEI7m6reLFhzCGaTIEns5km7Y7p; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:14 GMT - x-request-id: - - req_057fdfe719624005ae5dbc7da7c703c5 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses + uri: https://api.openai.com/v1/responses/resp_03af00866b03fea30069922bce690c8197af8c9605c28116a1 response: body: string: |- { - "id": "resp_053b3f93be7d6ffc006989e2fa2fec81a3b2a497b161dc5efd", + "id": "resp_03af00866b03fea30069922bce690c8197af8c9605c28116a1", "object": "response", - "created_at": 1770644218, + "created_at": 1771187150, "status": "completed", "background": false, "billing": { "payer": "developer" }, - "completed_at": 1770644218, + "completed_at": 1771187150, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, @@ -386,7 +228,7 @@ interactions: "model": "gpt-4o-mini-2024-07-18", "output": [ { - "id": "msg_053b3f93be7d6ffc006989e2fa72a081a39d8eab61e86e2a77", + "id": "msg_03af00866b03fea30069922bcede2c81979727cb46b656fd79", "type": "message", "status": "completed", "content": [ @@ -440,13 +282,13 @@ interactions: } headers: CF-RAY: - - 9cb3c23b7c24f21e-EWR + - 9ce7896f4c98de92-EWR Connection: - keep-alive Content-Type: - application/json Date: - - Mon, 09 Feb 2026 13:36:58 GMT + - Sun, 15 Feb 2026 20:25:51 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -464,3255 +306,13 @@ interactions: - '1542' openai-organization: test_openai_org_id openai-processing-ms: - - '412' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=SFOcKcjNEDpzoUmfIKDJd.15lnCtbOfXanUR7wLHoGw-1770644218.1567044-1.0.1.1-JDhjei9N4r1s0dsfPYtGAhye9Sx_vhzxOgiiV_efx7T5JDhFZjrh.g3QzhC1TuMrg5MzUTlD0vcrVyn7qbJTk8UNPqx7lIT6wH7WZtgFGUtZN9P.rWf5hP4MDqIGrt5z; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:06:58 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 25.059s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_7fe7e6d2616041f49756c26bf5efea08 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_053b3f93be7d6ffc006989e2fa2fec81a3b2a497b161dc5efd - response: - body: - string: |- - { - "id": "resp_053b3f93be7d6ffc006989e2fa2fec81a3b2a497b161dc5efd", - "object": "response", - "created_at": 1770644218, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770644218, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_053b3f93be7d6ffc006989e2fa72a081a39d8eab61e86e2a77", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3c23f3dbc4f3a-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:36:59 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '61' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=LpxYnxNo5m4mIrzMqYWamG2zJ3hpXYyK4chjzsxBPlM-1770644218.7603755-1.0.1.1-e5HAjIPJGP1O3jdwrtbi72sH1rXzf8itmn9UEP53XYKoGl9oLqVFU50UZWfFrI_DG_h_4J8oEZeEF5ACQneWjD10rmjyQWDmWGJWU8VNRTbfxaFmtYTI60i2IycU1ViR; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:06:59 GMT - x-request-id: - - req_1db4602566924030a244244f7f97ed77 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0628c14e8a3741c3006989e75c5d988194b4967cf999ec8659", - "object": "response", - "created_at": 1770645340, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770645341, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0628c14e8a3741c3006989e75d1b888194bb6626e5dda13fc4", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3dd9e9967c60f-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:55:41 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '1026' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=dEIsVQHaNDUM0MFsGpS1PCFrpJWUNTJRnK7pmnYcscM-1770645339.9409304-1.0.1.1-GIiT6.xalTCBYHdL3Hej5L3zFblKXv0zwUIlfQFTy1iyuxHTba4QBySApR2ctuzfb1.MCR1CcJX6JMcgOE7asSjNYbg.zzvMvgzyqz_lqksrqQJXCVO.LUnXi76HXrUO; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:41 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 24.792s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_fe8c6abaac104a319f78fa0566ab649f - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0628c14e8a3741c3006989e75c5d988194b4967cf999ec8659 - response: - body: - string: |- - { - "id": "resp_0628c14e8a3741c3006989e75c5d988194b4967cf999ec8659", - "object": "response", - "created_at": 1770645340, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770645341, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0628c14e8a3741c3006989e75d1b888194bb6626e5dda13fc4", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cb3ddaa2d73d123-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Mon, 09 Feb 2026 13:55:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '90' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=7BFl.6ENIMMPYrS5TrOJHAsH_JixfdQNnXUa50gtauQ-1770645341.7887216-1.0.1.1-gMAn5JB2Kifg6erhNIDyxotgCD1HDynTQDvCfQQLdIrdGlYDWhxu_uRJKPD4cQt8Fr0rtu_eVQuesIX1wLZS.Bslen3W9LB5NHfAh.BVJuuDkTzCVrqBHq4TmUg6LrYC; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:42 GMT - x-request-id: - - req_c12d76842dc74895ac75814a561506c7 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0c3284301a98507d00698b1d2fee78819585a54ab7cb4ca1cf", - "object": "response", - "created_at": 1770724655, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770724656, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0c3284301a98507d00698b1d3072488195929365fb2a18bd60", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cbb6e085b68ace5-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 10 Feb 2026 11:57:36 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '696' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=TuAyEaVGaFOE0v28mbVz.YDVQR4gTssBFxkBXSEGgwg-1770724655.4158082-1.0.1.1-hWU21Od64_vwnXko37bYTL7nFSANoJoKTbQqlktpXnH.f2b3lCxdcZb3DinNb0b.jCjCOVxOCfzwYQSoim7Ph9sHg9MIoc0K6E3u7Ai4jm4PUYlTPz8YDkqWU0XgNzwD; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:36 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 24.195s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_a1afc694bdbe4abc8dad9d0b518b622e - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0c3284301a98507d00698b1d2fee78819585a54ab7cb4ca1cf - response: - body: - string: |- - { - "id": "resp_0c3284301a98507d00698b1d2fee78819585a54ab7cb4ca1cf", - "object": "response", - "created_at": 1770724655, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770724656, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0c3284301a98507d00698b1d3072488195929365fb2a18bd60", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cbb6e109ab38e3e-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 10 Feb 2026 11:57:36 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '97' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=NJqChYMXKESdvrlT4gGeqp9LGdQf9bqdKnR8GPy15bo-1770724656.7379186-1.0.1.1-XLn2HwXV0UoPNiMCiiofdxFkPcnN3e_H4QRnOpvCOBKSOdkeym9jFs4D3HCvTGOnnzelkuxH.vQra7iZjOM4fpQ0N0nXUM5djdHhWjzwQ84nRWGTDkVCN8u5Tbid6bmH; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:36 GMT - x-request-id: - - req_13fa14166fb34dc9ac5aaf89de61bb8a - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_08530deab88e1a0900698b23abfd908197a4f0e4b5d352d3bc", - "object": "response", - "created_at": 1770726316, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770726316, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_08530deab88e1a0900698b23ac92088197b59276f3fb6ccb6e", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cbb968f6cedf965-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 10 Feb 2026 12:25:16 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '746' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=cOj3sUuVLHvJJAXuFXxvxgZ5gSWfPQ2CoJ7QcTCWbyY-1770726315.4227011-1.0.1.1-Eb2ZQjNeEKoDngnEvLPFJnbJMXY80wLHxqccumusa1AXoHZb.r36G4rR72Sk48ZZmxZTqn_MU_v8rWhT0SlPXEmBvyUA9gJBvRaTk4tm2TwlXWIX5QVLBLaTFn0TBLKR; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:16 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 23.986s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_10e1e270547842bf9fa12a2d36df0979 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_08530deab88e1a0900698b23abfd908197a4f0e4b5d352d3bc - response: - body: - string: |- - { - "id": "resp_08530deab88e1a0900698b23abfd908197a4f0e4b5d352d3bc", - "object": "response", - "created_at": 1770726316, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770726316, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_08530deab88e1a0900698b23ac92088197b59276f3fb6ccb6e", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cbb96987b3dcb2e-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Tue, 10 Feb 2026 12:25:17 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '172' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ZXTIu3EqoUn7O6DdNQtPKRpfORkUxRmo_y2U6kSqoMU-1770726316.8734188-1.0.1.1-WWf3lCY4fufsJAuenl8HDZpJ2aeyiuRtIkB5ZhjK_1UY17Pbjyr9MDuMe7UgkZTMjsBlKyzxc53atQB2k0RgUfhl.Qk7j2ZW5Sg1QPkmTMs80kORHzBKRzDnpBzf8XYE; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:17 GMT - x-request-id: - - req_791c713b254145b2b49105573899f7b3 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_05541a1cca0df86400698d4d04306c81a182d62fd2a90159be", - "object": "response", - "created_at": 1770867972, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770867972, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_05541a1cca0df86400698d4d04a74c81a19430fb29a4fb651d", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc918f9fbae4357-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 03:46:12 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '623' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=NUE.r1nIUIbb3OHZJZK2.eurdXWZ5NhiLi8aNeseaHk-1770867972.155458-1.0.1.1-0CI9ZVeb7KM8NNnO89RZ2TWo7D2Cl4GVxqyAAhSIEIWbEpnwYCPrsVGrY72hZdbMzZDWlJvVF_INvcrDityC2yjEf_33Mctky8L1TsihQHn3ClKSkpAvRi7kZKZvsLy7; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:12 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 23.791s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_f62ac7676c64448683e41b881dac1de4 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_05541a1cca0df86400698d4d04306c81a182d62fd2a90159be - response: - body: - string: |- - { - "id": "resp_05541a1cca0df86400698d4d04306c81a182d62fd2a90159be", - "object": "response", - "created_at": 1770867972, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770867972, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_05541a1cca0df86400698d4d04a74c81a19430fb29a4fb651d", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc918fea905a3fe-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 03:46:12 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '53' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=xiYV2aBh_hTr3WY5nSxptlKfrLBuB9LVnA71ZW5cwU0-1770867972.9099538-1.0.1.1-LmQtB2VpNQKVRcXjJp9R3blqFDprYYHBQRhBBOtGfTWT7TniM2Nzh6S6ZxAH9XBKikuW7AnqRIa0euZ7uXQS0WWjGUOmZTshIsHrrjs2TyeAGywq4uUjmmz8zMWiW0or; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:12 GMT - x-request-id: - - req_4c533ef234fe4323aba63d5b6c4da8eb - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_02ba1cf8e4de28d200698d4ffb95548196b22979bff89d74e6", - "object": "response", - "created_at": 1770868731, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770868732, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_02ba1cf8e4de28d200698d4ffc1f04819699411b076256f147", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc92b841d59439a-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 03:58:52 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '745' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=4gDU3X47J6w47jkxohQuFsc2glCl61IQVnC0WvVAXMM-1770868731.5373325-1.0.1.1-sD5e7CYqcLtuRC68GI82rchCcFc7b6NhWEgzc1_mfpXErij0vNNcnvHKpBqeg7mtq6I0GXk1nupYVBSaNN84tCfM5Vq20mIlXpBetexyiqjPN2a3ziilLUdf12oTGmQH; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:52 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 23.869s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_fe55d1ce62c548aabf7720e4f6cd0452 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_02ba1cf8e4de28d200698d4ffb95548196b22979bff89d74e6 - response: - body: - string: |- - { - "id": "resp_02ba1cf8e4de28d200698d4ffb95548196b22979bff89d74e6", - "object": "response", - "created_at": 1770868731, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770868732, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_02ba1cf8e4de28d200698d4ffc1f04819699411b076256f147", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc92b8a4fba1914-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 03:58:52 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '156' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=0nV_GkpQYObow.MLqbF5ppMqakzJ9MWYQFe8MltKpAY-1770868732.5213642-1.0.1.1-gCXVSwrBYAVihQMUCHedMPODrjZKeYaneaQ3xWEbHByeJEh6qoJEmYd2yNDYVxeyBPE9hiWNwEnBeEpVzHu.I5kcDrliUdFoVuebYMRmpL5eMf8zo29YeLU49vkDkP3I; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:52 GMT - x-request-id: - - req_371b1f41cc354855b25409d3f4e71603 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc93135cf6d426d-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:02:44 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '17' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=b1l39w5k3dF0mns1xOjENvWYS8l25hdgMPDLc5MKQeg-1770868964.762243-1.0.1.1-mAsPqGbz8nMeVjOhjEEMaxAo_JoG1cW8atFjqevJeYRg.KOkU4T8ppDmP2MHyqJNIT5kDG_02gwJB69quO.KUUeQxAhcfKEwmSJzzecej0eyd8QBYYv8wm.wMIeOPKJm; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:32:44 GMT - - _cfuvid=Se8jaVnVLjNVDvayi.JpyGL5h0nHibibazWpl1nQSqM-1770868964.762243-1.0.1.1-M431.rVI73_Lbk2nJnlYn1FFNa4dsVPV23psfYxEAm8; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_b669ccea0bba49e493ad1e0817e44a17 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0013af385fbc4b9a00698d516ebc20819c9efa3e81c1411605", - "object": "response", - "created_at": 1770869102, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770869103, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0013af385fbc4b9a00698d516f2650819c904c9ee9803bd108", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc93493ea647285-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:05:03 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '608' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=.vQAhDsxwX1Tz_kE2xa5rHYx5yBsXbpWrjVvOAJjNcs-1770869102.7068415-1.0.1.1-Eg1TznzHwqAEM2YexqMx_4L8lSak.SwMmrBim_3hvLgkcoBIwrk4YF.FqVX6UrOMS1eL60wD04Kq9uuxG3lEEeJboxXqeFrNevmJ8jxMyvQx6P1iKeInQ3lf0RhLb085; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:35:03 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 24.667s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_c972081d9a2d4ee58cf1d23082eae7d5 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0013af385fbc4b9a00698d516ebc20819c9efa3e81c1411605 - response: - body: - string: |- - { - "id": "resp_0013af385fbc4b9a00698d516ebc20819c9efa3e81c1411605", - "object": "response", - "created_at": 1770869102, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770869103, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0013af385fbc4b9a00698d516f2650819c904c9ee9803bd108", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc934987e8d0f47-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:05:03 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '205' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=lwPGifuWWOtpEAVJw4Fq6hUiNCPibYlvw8k1pauglUo-1770869103.4377072-1.0.1.1-7VgkV29BhJVQW8u8XMMzR71DlyfsZoWhsQHM9j5z8qo2dKNpFTeQ2RSrDCUJS5j08xUfX0rXW0u012yxKOdHUhAgLDo.Aqwz2fm3ZK.OY8zDy064I6axUjlo6Jh9ypPN; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:35:03 GMT - x-request-id: - - req_5dd0015773af4f13b0f3e88a1fae6458 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0ed507649da2297900698d615689a081a0beed10e2f5495916", - "object": "response", - "created_at": 1770873174, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770873175, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0ed507649da2297900698d6157165881a091c674abba1e522f", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc997faaa8955d7-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:12:55 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '721' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=g83cpC.1W2sVHl7I.ZoT9f_ZASMmJeyRsZT1yl5X9w8-1770873174.1824052-1.0.1.1-rC9wI8tW7_lLD7Uju08Ok1t8QCIqmlEtIlggH2PP5MDdhzWCOFZhxmRi3uzeCFiVMc6uA4Luom_iUo6Z4Fd_wNcnUtXToAtVzyZVwiKfkMhHoAm_kzc0lS1I9kfZyA7j; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:55 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 22.529s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_9c5bc85acaec4bb7afd5e68b758dd161 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0ed507649da2297900698d615689a081a0beed10e2f5495916 - response: - body: - string: |- - { - "id": "resp_0ed507649da2297900698d615689a081a0beed10e2f5495916", - "object": "response", - "created_at": 1770873174, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770873175, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0ed507649da2297900698d6157165881a091c674abba1e522f", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc99801ec3ff793-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:12:55 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '99' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=eo5Nw0vgVSExYK_wH4L4V5rwd8Zen32.svM8wxCdKu4-1770873175.3448126-1.0.1.1-x.Ai2A9m8YQjnpghs3pOfkyEjIptYBmguIqqX17qe12ExZfNNc3299hX718TWgeFM6r2Cq9fAVlMQWDZpU3fhqHhIH7m9np1iCBKnqhI__C8FILJ0dFooHV0H8fxwlPb; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:55 GMT - x-request-id: - - req_614f858fb78b443eaa38f971cdc49fb2 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_0aaf63cedc07b88700698d666bd9708191aae956d17805ece4", - "object": "response", - "created_at": 1770874475, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770874476, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0aaf63cedc07b88700698d666c41e081919bc63c4bafd35c91", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc9b7c1dc245590-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:34:36 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '589' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=Vh9GtQxHEuZIGoijNgUmgXY4g7IXAg7gTQj2UyD2UwQ-1770874475.818553-1.0.1.1-zf4MKL7Qa1RPt.jk89ksDJ0A4YxsIGzAe77DNOQV35.Td_9YSWfJ.ImKCNdU.R_l2DiI3gvlPqa7hUG5EzH68nljPC.WRD2AHX5NnhYJL5d8HtXlHxBvG6jShBkJ69dp; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:36 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 23.696s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_a9f7bfadbdd24f24abb60a6392b84317 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0aaf63cedc07b88700698d666bd9708191aae956d17805ece4 - response: - body: - string: |- - { - "id": "resp_0aaf63cedc07b88700698d666bd9708191aae956d17805ece4", - "object": "response", - "created_at": 1770874475, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1770874476, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_0aaf63cedc07b88700698d666c41e081919bc63c4bafd35c91", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test." - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 6, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 18 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9cc9b7c64ed2be83-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:34:36 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1542' - openai-organization: test_openai_org_id - openai-processing-ms: - - '184' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=iMp.GZhC8HFr_NEy04KOqul0vFsj9vnxxKvO7nNTY0k-1770874476.525253-1.0.1.1-otqoEF.2hI2Zf0SCLJmf0iWLnqETHrAfNmf206ZyMBNIaPi2oDyLxGijG8EvoaVVD9gjw7KLffET51cWAKY05xJNnMOAoj933n_GWB8IBOPqE5MBegcKyewTNSouFnY5; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:36 GMT - x-request-id: - - req_22b3ee6d6d1649ce84b5c75f82e59e85 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce526590829436f-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:41 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '19' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=uKDiQCls6zS6DVJdlcUSglgYePzswJkYrO_vXeWyj.I-1771162121.1216908-1.0.1.1-jeBr12034SrM62t2hckWcCQ1K7yL1GTUNQrlOE_R6tQJbMwXAPF5x4rJrmSdojWYhV4n4d.fd5Iguo42O0gjPoxW0L0pq83FwiLQIUIPySBO.UQu9O7pU8o9UAUXweqZ; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:41 GMT - - _cfuvid=3KgJfjFq9EgL2xj9XRSXIfwDESdzxFDO_5.4tRthTyc-1771162121.1216908-1.0.1.1-CJJKuPceEYmjlGHq4UI.Q35WWfEv8AXltLoydTyd0SY; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_291dac0fdc1b49d9818481039704ad7d - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": false - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '72' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "id": "resp_039b62fdcf88a203006991ca3621648192bb67ccd047e4f204", - "object": "response", - "created_at": 1771162166, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1771162167, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_039b62fdcf88a203006991ca371b54819296c87ce191eb2b12", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test. How can I assist you further?" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 13, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 25 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9ce5276deef10f88-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:29:27 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1573' - openai-organization: test_openai_org_id - openai-processing-ms: - - '1208' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=HPyhV2Pl81ZRccip_dx6IqhZVmKf0w1Xct65EQRJSVY-1771162165.4286332-1.0.1.1-JtSgg5_.2N2w3GmD0oPv.nM.N6Fly.oASLuCMxfSxnMRTIGWl4RkqE1lRZWImgGv8UTzylZPbfcvUsNuNkPClUERguHSqN1NW8IrrndA5.eLIM1lzk5eWCMJKNCSYwPw; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:27 GMT - x-ratelimit-limit-requests: - - '10000' - x-ratelimit-limit-tokens: - - '200000' - x-ratelimit-remaining-requests: - - '9997' - x-ratelimit-remaining-tokens: - - '199969' - x-ratelimit-reset-requests: - - 22.599s - x-ratelimit-reset-tokens: - - 9ms - x-request-id: - - req_0db9de349e334c09b9fcedcd355e4db9 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_039b62fdcf88a203006991ca3621648192bb67ccd047e4f204 - response: - body: - string: |- - { - "id": "resp_039b62fdcf88a203006991ca3621648192bb67ccd047e4f204", - "object": "response", - "created_at": 1771162166, - "status": "completed", - "background": false, - "billing": { - "payer": "developer" - }, - "completed_at": 1771162167, - "error": null, - "frequency_penalty": 0.0, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "max_tool_calls": null, - "model": "gpt-4o-mini-2024-07-18", - "output": [ - { - "id": "msg_039b62fdcf88a203006991ca371b54819296c87ce191eb2b12", - "type": "message", - "status": "completed", - "content": [ - { - "type": "output_text", - "annotations": [], - "logprobs": [], - "text": "This is a test. How can I assist you further?" - } - ], - "role": "assistant" - } - ], - "parallel_tool_calls": true, - "presence_penalty": 0.0, - "previous_response_id": null, - "prompt_cache_key": null, - "prompt_cache_retention": null, - "reasoning": { - "effort": null, - "summary": null - }, - "safety_identifier": null, - "service_tier": "default", - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - }, - "verbosity": "medium" - }, - "tool_choice": "auto", - "tools": [], - "top_logprobs": 0, - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 12, - "input_tokens_details": { - "cached_tokens": 0 - }, - "output_tokens": 13, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 25 - }, - "user": null, - "metadata": {} - } - headers: - CF-RAY: - - 9ce5277ab81eb89f-EWR - Connection: - - keep-alive - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:29:27 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - content-length: - - '1573' - openai-organization: test_openai_org_id - openai-processing-ms: - - '52' + - '80' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' x-request-id: - - req_266594b6582945d2b5613e3548c983d5 + - req_5155e47a313f4615911460d831e27cc6 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml index 4b276da03b..e319a3ccb7 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_retrieve_stream_existing_response.yaml @@ -48,77 +48,77 @@ interactions: body: string: |+ event: response.created - data: {"type":"response.created","response":{"id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","object":"response","created_at":1770643814,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + data: {"type":"response.created","response":{"id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","object":"response","created_at":1771187151,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} event: response.queued - data: {"type":"response.queued","response":{"id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","object":"response","created_at":1770643814,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + data: {"type":"response.queued","response":{"id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","object":"response","created_at":1771187151,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187151,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + data: {"type":"response.output_item.added","item":{"id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + data: {"type":"response.content_part.added","item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":8} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":9} + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":9} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" How","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":10} + data: {"type":"response.output_text.delta","delta":" How","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":10} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" can","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":11} + data: {"type":"response.output_text.delta","delta":" can","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":11} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" I","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":12} + data: {"type":"response.output_text.delta","delta":" I","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":12} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" assist","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":13} + data: {"type":"response.output_text.delta","delta":" assist","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":13} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" you","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":14} + data: {"type":"response.output_text.delta","delta":" you","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":14} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" further","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":15} + data: {"type":"response.output_text.delta","delta":" further","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":15} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":16} + data: {"type":"response.output_text.delta","delta":"?","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":16} event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test. How can I assist you further?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":17} + data: {"type":"response.output_text.done","text":"This is a test. How can I assist you further?","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":17} event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":18} + data: {"type":"response.content_part.done","item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","part":{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":18} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":19} + data: {"type":"response.output_item.done","item":{"id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":19} event: response.completed - data: {"type":"response.completed","sequence_number":20,"response":{"truncation":"disabled","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":13,"total_tokens":25},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643816}} + data: {"type":"response.completed","sequence_number":20,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":13,"total_tokens":25},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187151,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1771187153}} headers: CF-RAY: - - 9cb3b85f9c2dde92-EWR + - 9ce78970efe10f3e-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Mon, 09 Feb 2026 13:30:15 GMT + - Sun, 15 Feb 2026 20:25:52 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -134,17 +134,17 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '762' + - '1126' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=uTQPoDt1NER0KiGrwEOejBN8EnkV.7x0zYADlPNG6E0-1770643814.3347235-1.0.1.1-rgQGweyMxj_CRAGuvkoDDHXkY6Qgt5b9T.Dd6XuXSqGIRQwDnlmyn1Z995BajUgQ9v2NqMk5WjBQ5A5ZRqJVLWnWqboMZgYzRpzDMrDInAZ6VpNkFXWP1mLPNdbhnOzG; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:15 GMT + - __cf_bm=mpzbaGS1KSEREmECIYifExDkv3qTFoZOseGXdjZSrQI-1771187151.5091498-1.0.1.1-hPZFu0axb6XudOZa3f5Dh_0QUIwlsoGtAUqgizvcsPuUaf9B5ufC1aIixdLTLrkhmAReszYvRqXy0f1d.AsBewSH3HhM22i80SPiJdhhELzJqcvDkWy1HLtI8kO.GQlw; + HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 + 20:55:52 GMT x-request-id: - - req_bb34d05fd10048589240908a42187d56 + - req_1147ddbf62f4452291cbb827ca174e1e status: code: 200 message: OK @@ -184,2721 +184,79 @@ interactions: x-stainless-retry-count: - '0' method: GET - uri: https://api.openai.com/v1/responses/resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" How","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":10} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" can","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" I","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":12} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" assist","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":13} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" you","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":14} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" further","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":15} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":16} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test. How can I assist you further?","logprobs":[],"item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"output_index":0,"sequence_number":17} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content_index":0,"part":{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":18} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":19} - - event: response.completed - data: {"type":"response.completed","sequence_number":20,"response":{"truncation":"disabled","id":"resp_08d2cf5a58399d31006989e16662fc8190b89834418fc53d71","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":13,"total_tokens":25},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643814,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_08d2cf5a58399d31006989e1683a888190b9195c56590561ab","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643816}} - - headers: - CF-RAY: - - 9cb3b87dcb9b8c7b-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:30:19 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '413' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=.0V0NVX9_w8uuITr.NxJALLrwLLbf1U1lP3GTCHfPJg-1770643819.1714222-1.0.1.1-6Ptd8ph0lH.9qsuSCL2UtoEfVbnffxG5zqD.uxc5gKmIXZOPSC9avsRabNRQ_7m1eSrT2YDdTeXqxbOfsaRb_ETCF8mhLMl3vGwGEUHUYizsD4TfBkRwGZsOAh68aCjo; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:19 GMT - x-request-id: - - req_ff976aefe1cc4d8485b134e4bf0ff7a1 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses + uri: https://api.openai.com/v1/responses/resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54?starting_after=0&stream=true response: body: string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","object":"response","created_at":1770644219,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","object":"response","created_at":1770644219,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187151,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187151,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + data: {"type":"response.output_item.added","item":{"id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":7} + data: {"type":"response.content_part.added","item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770644221}} - - headers: - CF-RAY: - - 9cb3c2443f734f3a-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:37:00 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '1151' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=hPyZrwMbpm1hdEbhNU2MOCYu1NcKeHgSJIyvbErJEtk-1770644219.5582347-1.0.1.1-gufdMNZl6SC9ZIQICSbJm.QtMrfnyuSkAXZnBhHYnEEy5riA9oxPAp9Zz4icB8Rxj.SpS9Ij269JTA5nuEffA4_aMDtr9e41jVLpzV7V3H39LeaHY5JcM2fvjkcFLx.s; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:07:00 GMT - x-request-id: - - req_395b056b30df459ba39abe79636b581b - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":8} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":9} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","delta":" How","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":10} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_084ace4f6ae81fef006989e2fb95788191a1f8ebc186b66e53","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644219,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_084ace4f6ae81fef006989e2fd79b8819186b8f8ba182eac5d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770644221}} - - headers: - CF-RAY: - - 9cb3c263cf3942fc-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:37:05 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '598' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=cpmg8OBNGlyNM07o89aL9xrO8ujjoCAafkHhXczdaXA-1770644224.6022356-1.0.1.1-mBGn2XJoY_2sL1zAb6_TbzlmB2hOSPexpvGuAbUjzU1A60GeB4TkoEii.Ep_sJOhAFkZghqVMXcpCHgDvw9zROz.JPXF7bep7ZoRLQ99WmeghxDStCP4ooZWPohHwwmE; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:07:05 GMT - x-request-id: - - req_3c09fbe94b954cf49ea58b4f65836e61 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","object":"response","created_at":1770645342,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","object":"response","created_at":1770645342,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645344}} - - headers: - CF-RAY: - - 9cb3ddb08ae50cc2-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:55:43 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '806' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=DOCAN1Wy9xUEjyyXaB8hDbuQpolLQD2dkMFFcgy1z0U-1770645342.8075092-1.0.1.1-jZuntKTaJV06MImBe1S49tUTDGm2sqb0HrD9Z0Etajv02qY10wZqKslSouJpfbZvCcS5qWEQeUam6Id6l1gAj2Hdrr3m5oJoiPHKXx7qn3cqh6KJY8PQWgnO02TYccyz; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:43 GMT - x-request-id: - - req_7ce464c15d4c4a9ba218492f75fedaca - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0a35fe5b9a41a55c006989e75ed5ec819e874f2705117c89e7","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645342,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0a35fe5b9a41a55c006989e760d714819eb7dadcbfe2402f6f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645344}} - - headers: - CF-RAY: - - 9cb3ddd03b0341f2-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:55:48 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '511' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=rUJaQ8GcKFstnxcEvGRR17Krf9xkb643VYSXjV0wj.o-1770645347.8736434-1.0.1.1-kQG8DJsh5d4SVoV.ZKPq6VqT0z4Hk1AoYwKpbImnAZfwxOmlhIUFINnLmlaiMOq7G4.9pKHt4NlA0Ki1gLd9BbX99xCiiHe2xkRch_jloxOWitNdMsN6FyuXfH8k9676; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:48 GMT - x-request-id: - - req_82e690bfb9ca4a4ba467f6449299135b - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","object":"response","created_at":1770724657,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","object":"response","created_at":1770724657,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770724659}} - - headers: - CF-RAY: - - 9cbb6e126d5743bb-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 11:57:38 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '870' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=73GgqjDJtwrxHZkQNdY.j8uPBX6v1bFdcxMESHV5VnI-1770724657.0283952-1.0.1.1-DBkaIhE.nvXWnUJfzgITUIT4dldkO0ryA_rJlcsPyviz3LULo_2ky0gc6aRWdS7tlAFRgM50B9UtBik7hYhLadC454BE10npVAKTcBrf_jPECjZTqpeFdJzp5GAkqs81; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:38 GMT - x-request-id: - - req_cd9484d1df84442fae1d093401cc18e6 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_037e2000444b711500698b1d31938081a2b097f1c21f321da0","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724657,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_037e2000444b711500698b1d33d17881a2ba6efec3b7f1f83d","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770724659}} - - headers: - CF-RAY: - - 9cbb6e387ef2269c-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 11:57:43 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '556' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=J6CSiGn__wDTCSAu.goDh9yrdPDBZPgqtNrtFhUrLY8-1770724663.118438-1.0.1.1-w0M_Bt6GmHNfI1oSgYsyKnBtlGU_sXcs2vdjYsmePlZk5lVmtWn62O6d6wZKdddMRppmASB52ajqiTytyLzjlq_MJC.wZ_CSqzEIWA2E2Cr1.2lQrqtD7jS4LQTYqJEo; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:43 GMT - x-request-id: - - req_7034a315d367454789a2973729c06cf2 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","object":"response","created_at":1770726317,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","object":"response","created_at":1770726317,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770726319}} - - headers: - CF-RAY: - - 9cbb969b98b9d911-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 12:25:18 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '828' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=Zllv4baEWlppA9zRPxcANEtJyJ8MaRO4TU3BO7ip4qM-1770726317.3726966-1.0.1.1-ywfDQ67zkuAB11t9gTlMSPXMKgERvHmq8lD3b_j2SyaIM5NxitxPwrz_0e987YKg14vTXOJZrZVS_vGrf4xVOGldQkqSwly3UNKMDkHDs_r6MYa1s0Sy1evmRIy2.4Yq; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:18 GMT - x-request-id: - - req_b83a1bd31c374a90a77531db3d3239cc - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_058ae5d17828accf00698b23ad66c481a19a5efcfe241f1156","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726317,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_058ae5d17828accf00698b23af467081a196551a90b23c060c","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770726319}} - - headers: - CF-RAY: - - 9cbb96b998074ada-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 12:25:22 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '243' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=xFBrroiAhYJhhmtPrQ8uxwelYOLJvUkqtWyHmjoYk3c-1770726322.171218-1.0.1.1-VBEULlr.3R_F0Sryz.FoUviQ8fICGuz4kZt84d911UUYw3UfLdcxehp11LbprMXihzqB8A1if9Klsv4bTLDmC3wzv_KQg8fMiopfb7AwQ05USUlDehUphNDw_RtEqp5S; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:22 GMT - x-request-id: - - req_2e4e48611adf479daa704eacbb07ea47 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","object":"response","created_at":1770867973,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","object":"response","created_at":1770867973,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867976}} - - headers: - CF-RAY: - - 9cc919008b70427f-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:46:14 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '882' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=EkAill4Lzj8Lv1LbFAW0ytL4hg9B9DuUrhxQ3.UXaXE-1770867973.2023118-1.0.1.1-jjZLkAHT_kqE7Crd.6WA.UD8MjILiIICQpTpfksFqXRyH5dIUkfrhVy9EwytsinI5y8d5ov37LGm7aCk8iWI15QLaxXrlzBD2aUX9jJEomRy59MIxc0mL5m8sR.aJc7z; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:14 GMT - x-request-id: - - req_8a532ef2b07a474398ec418868d22d84 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_09581cf4b9235d1900698d4d05c35481a3ba92458e1d1403bb","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867973,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_09581cf4b9235d1900698d4d08379081a3bd913dac637b2e6a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867976}} - - headers: - CF-RAY: - - 9cc919268ea74815-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:46:19 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '575' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=tfTnUUMulj7boML.T3AWUvOf0fAPP9Of1wVwP.DXPOw-1770867979.2823195-1.0.1.1-n6Ww5kW7WGymYAQZP.YRLDBiuCFV8qLCe2L5j91dLvhgep3btIcwUZxAEgIpGEjKAv_VI0CyWONKBRu5vixXOt8a0qbRbW8pPpFpZu2lj9doXYUPxfup6A9tyNdbLBEN; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:19 GMT - x-request-id: - - req_d5df33e4b904424cbf71805fb6623642 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","object":"response","created_at":1770868732,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","object":"response","created_at":1770868732,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770868737}} - - headers: - CF-RAY: - - 9cc92b8c8a81ae12-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:58:53 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '948' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=S6inzg3tp65d9arT43vi7bcbtzlcXg3IzX9padquF_o-1770868732.8857043-1.0.1.1-8K2nonvw.Y1ccHgR6BfAhEhSNT7xp.0Jv3E.jxGGOK8zi.bqV2EldonZGHnkKuffYRc8ABPNaUdaVddIVihCg334hUoYA0SIzF.bG8U0OUbt4W4zYeSj.QneyVK6vX57; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:53 GMT - x-request-id: - - req_5b901113c5fd4871b346ec49394c2f22 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b3606dded2d075500698d4ffcec8881a29034bc239ad31053","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868732,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b3606dded2d075500698d5000fd2481a28b3f3fda0e42ebf4","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770868737}} - - headers: - CF-RAY: - - 9cc92bb97f017a02-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:59:00 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '590' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=fL3Fsxk98j4FgsmIL1HiPJEHshFEtzisIwi1gzSFEGQ-1770868740.078156-1.0.1.1-Se3QEV_E9KG9EIQjc1h3LmV4P4s_2qFcUtM0_gBRKqcu6n1Hl2ljAOb5JQyjVRBloh2YY4vEDs88__Qixj1RgoBvS0L.I15RzYu6GHeyM7WikBCFpzQnd9WlKMfveHGX; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:29:00 GMT - x-request-id: - - req_0fe5da8bd1c047519942a57f61daa72a - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc93137ecb33d64-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:02:45 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '22' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=8.9kOe1mJT3itzHUAte1fq94l_Zmlgtp9zU6yqQJGK0-1770868965.1036782-1.0.1.1-OllVCCNLXsOr4fxU1tYP8GLcxl7PhUBtghNSpxOr4ZOzDGUFcnvdmH9NBibwlpeQcYttNQaWHYeD2wvfXgURUkNJIjSIw0MqQBZ1mlgcdlrKccivwXvEVXWTWBxUL6BB; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:32:45 GMT - - _cfuvid=NvGyqu6KryDhyBi0NfG1W2Yrvow8lNLWO5BNlDFYDL0-1770868965.1036782-1.0.1.1-NCfEj2gObb1aa_onIud0DjrfJX6nMwiuqA.aBPKVix0; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_d5695e1eb4c7490eb4672efcf49cea23 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","object":"response","created_at":1770869103,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","object":"response","created_at":1770869103,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869105}} - - headers: - CF-RAY: - - 9cc9349b68327a99-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 04:05:04 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '860' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=MxgzwQjnEPWDnYf0Skune2weBbdEuSJgLFFkf5PxFYE-1770869103.9061773-1.0.1.1-qhYSnH2YYIRVwkV6rUXyWob9WvksjxGHeCFfhpjhoH0Flj4Pr6T7YLuT55b5sOiqDeVLRxwHKXT6lY2a_Lr2LZbsBtfvEy.73ntE061HhBNQu_Q5miawwqpgDqyaVgJk; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:35:04 GMT - x-request-id: - - req_f011176916674d5aa8419537732be3de - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_013b4a28843a619b00698d516fefa081a0a5df5483fa89ebb1","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869103,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_013b4a28843a619b00698d5171b89081a091aacf41121624a5","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869105}} - - headers: - CF-RAY: - - 9cc934b8bd2442bc-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 04:05:09 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '555' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=bh1kq.Q2sm9Y5Ax.NtTQEn2Mx7RsLl2Seok6lUlwKt8-1770869108.5924356-1.0.1.1-znkHTpBveNkhQ_gY_SsYpmiyaZZfIKu9qJximbahBo3v__aNLj3HjcqevSpVNin.s8rtr045V9jJLHgRYbTZWzPxb39njfHriVicb8fTah_OJojuneTm73XWGj6l3ya9; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:35:09 GMT - x-request-id: - - req_8865c8d841064aa896baee290211471c - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","object":"response","created_at":1770873176,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","object":"response","created_at":1770873176,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873179}} - - headers: - CF-RAY: - - 9cc99804ee933d64-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:12:58 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '1938' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=4a8xhSXI9dgyfcn3xwuKk8.YETAJ1knmiA21kd3cL2w-1770873175.8226812-1.0.1.1-_fyCXe2QwphpGHTH4TC13wx23020RXNTejvUIYuV7KxlYApgo_g3do3CHAEb1hTBaBleIUsSHfhRY4H7O2KrGeNbVl7NczZNIuii1uVzF_GnCEh1Ds5RrWbSdNDzPxUT; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:58 GMT - x-request-id: - - req_b8cd5bfa6fa445b1a66959596929183c - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c4011e8e2a6972800698d6158352c8195a72d87cda977ad45","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873176,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c4011e8e2a6972800698d615b46648195acef342dd7d8a534","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873179}} - - headers: - CF-RAY: - - 9cc9982c9ebc8c54-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:13:03 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '575' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ut6Qo8iQFlMSIaEMNVIs247kbhiCD3ftdzdtU9a2_Ok-1770873182.1714065-1.0.1.1-w5pTpGFhsXJrV1z80ATvQp7x9B09YCZsvBis32KahuWAzm68BLIrWIyvb4dZ72mbne9bP1aODtopI_.nzzthAqbhQiw_r1a_hB4cUcH3q5me58rxPpNaVRnYoZfRrBEU; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:43:03 GMT - x-request-id: - - req_6ff2a97c91d143829d15a1683004e73f - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","object":"response","created_at":1770874477,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","object":"response","created_at":1770874477,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874479}} - - headers: - CF-RAY: - - 9cc9b7c99a25c47f-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:37 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '831' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=HpLHRk0mjoUpWmR2gGadOHLHC5g_wwjS1zPKhrVafyQ-1770874477.0602748-1.0.1.1-DBkV6ETnJDZYH9chw4VpR.UItSjKwcv1K6LEzVzSBhdOxsZnFdGtCKcGkrQQmUhcI0DGHezt6k2MqfVuCKqvNgBJF3i.ZrYiBMSw6Moxn2XTCqObrlLNXtjiE2TnxNU3; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:37 GMT - x-request-id: - - req_291a3c9866604ad5ad504456baa1e496 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b1c785710b3089300698d666d1880819f87898aefa4b8b913","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874477,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b1c785710b3089300698d666f4d70819fa7e21c32e2707cfb","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874479}} - - headers: - CF-RAY: - - 9cc9b7eb1c6472b3-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '454' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=Wxk7VcAUTzEiU0mQnX04WHXgEc7u82cOvB2x67iju.I-1770874482.41478-1.0.1.1-NN.GxgXrOKnmPLWFbmdfIrGKmry3rFvdSnR3h9255LybL2Gb6QMZHT.aa8aFJ_KilLk6UWZaer73SxAQNtzTYeHfG4fF0un3RsUDUFd88qS1il.pIaRaxqZ7uB4cYPpu; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:42 GMT - x-request-id: - - req_d10dae68749c43c0b2f97f18e961bace - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce5265b8c5dcb3a-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:41 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '15' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=nFrghf2nf4sYMaFwcBUEY0hPTWPgf8p0HaE2rdhH7Zc-1771162121.521758-1.0.1.1-GJeHWEkHM3eJNcN4HQCNCH0794uvJImm6kczMwqzmCFeRM6HLFqneRIa02eQRSbiVb6p4_xzHH12Mxo8QsYON6BLLHGAit6prxrTsiHXG5OG7ZwZH1gbbULEk.2Jw7xA; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:41 GMT - - _cfuvid=KdjwgG6mzBZKXeSho6MOTeWM8mAm2CGtfvbG1dq1XWQ-1771162121.521758-1.0.1.1-ZQSnI09riML3W8ZnHjgvIdr_9TCTWQmRJ5_wVx.oFPE; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_a7601f19d8274ed2a7916775c77fcdb5 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","object":"response","created_at":1771162168,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","object":"response","created_at":1771162168,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1771162170}} - - headers: - CF-RAY: - - 9ce5277cae072fef-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Sun, 15 Feb 2026 13:29:29 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '827' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=xSqwQVa6411qipgIrQXbxWuDYVoDQdlLE56vYMWVJYI-1771162167.782927-1.0.1.1-udMNo_gqmbbWYTsjRkPs7Pe9IPbMFvTVD_WOdJt9E_m7VCNliULZfT0aPZZ_jzOH7LrtxMjwEMKPioHqGCDRrJfspZu2w86WS7xxusYUdosgsZGbWAo2jnV3s63fxB1K; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:29 GMT - x-request-id: - - req_086b9e3b4fbb4969a2f89c904e8314cf - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288?starting_after=0&stream=true - response: - body: - string: |+ - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + data: {"type":"response.output_text.delta","delta":" can","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":11} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","delta":" I","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":12} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","delta":" assist","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":13} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","delta":" you","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":14} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","delta":" further","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":15} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":9} + data: {"type":"response.output_text.delta","delta":"?","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":16} event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"output_index":0,"sequence_number":10} + data: {"type":"response.output_text.done","text":"This is a test. How can I assist you further?","logprobs":[],"item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content_index":0,"output_index":0,"sequence_number":17} event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + data: {"type":"response.content_part.done","item_id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","part":{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":18} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + data: {"type":"response.output_item.done","item":{"id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":19} event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_034f7cee6bebbbc3006991ca3857fc8192a299746c22e85288","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162168,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_034f7cee6bebbbc3006991ca3aa7d08192b71a8a325aa99916","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1771162170}} + data: {"type":"response.completed","sequence_number":20,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_039be8aa35b2d1f30069922bcf8b04819db82d51010ae07a54","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":13,"total_tokens":25},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187151,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_039be8aa35b2d1f30069922bd19998819d801caf28bd4ac920","content":[{"text":"This is a test. How can I assist you further?","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1771187153}} headers: CF-RAY: - - 9ce527a2ba303d3e-EWR + - 9ce78992ad67c475-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Sun, 15 Feb 2026 13:29:34 GMT + - Sun, 15 Feb 2026 20:25:57 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -2914,13 +272,13 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '334' + - '317' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' x-request-id: - - req_9adc65bca281433bb3ca194578773fd2 + - req_42fa11cb44354271a2c09bc096ec10ed status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml index 16b3d3083e..c3417d2818 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_captures_content.yaml @@ -1,318 +1,4 @@ interactions: -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9b6dbcf5a60c8-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:33:59 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '15' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=IyTi2I1KIrzh2fNOybM77kkOJYEBBqHvumJWJliOJ8A-1770874439.0050933-1.0.1.1-lZT7nYS0VZV3cl_.ca_Tn.PgpoaNF5ePb5XvXmV.4uNP18Xd_co3zN.ZbAuXsrSeTnQRn1ryGOrfSRE1HtPfAk_Pjr2wLpacAhQzuigNjGvK7oHD7ZehL8NZIAkHehNf; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:03:59 GMT - - _cfuvid=pJ.v1USBUzdVlzd_ryMV_2l5f8zpZVPcaz905Xd114c-1770874439.0050933-1.0.1.1-5FECYk2dMUc5jtovok1m1vuwKD2p5nx9NVzuVRMCR4o; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_7c359249eb794f0fba932093ff56f1d9 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_023331c4d261975e00698d66758fb08196a4cec970581db62e","object":"response","created_at":1770874485,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_023331c4d261975e00698d66758fb08196a4cec970581db62e","object":"response","created_at":1770874485,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"WpwyubRIKCN5","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"upSQ8wQ5SFRia","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"cGaqpPElurOFaY","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"skYF8GzPxb1","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"obfuscation":"1N1RvxQpitwSLOe","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_023331c4d261975e00698d66758fb08196a4cec970581db62e","object":"response","created_at":1770874485,"status":"completed","background":false,"completed_at":1770874486,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_023331c4d261975e00698d66761ec88196882d26eb1b9f8337","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cc9b7fdea982560-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:45 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '166' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=Scle_.x1vPOukv2IsWSm8TyYnjW8W4O_nxbLYyiv0a4-1770874485.4274735-1.0.1.1-U9J23pBpsudIBj4tBHoWavwDudQIlM5q26TZbR.DwoIisj9FfWyGAkXZmZzPeSjZAi_oTxLgxDqnU_dGLFO8ZkzvLXDxHsq4py632ASNkl4CI8S9fBOaF_jbfo39NWwM; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:45 GMT - x-request-id: - - req_83585ceb8c1c4e369b0cdbe54fd110b3 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce5265f095afd86-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '15' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=xEuDDyrRAbNu0ud0BG8DfJhAshDmO50Yl.va1drRQiM-1771162122.087318-1.0.1.1-ZcQ7nRp3YRBsegCtgBAjmHZwTW8N8omk0_EIU0u2Maddk9kfaIkjsX2zb9SPhUIgk.iZWT6J0GKEpWNp2gb4qgOYQSLLng_crZBRnGg9rGKyPX6uIvcHBUUZWheo5wUI; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:42 GMT - - _cfuvid=OF.URk.pRthB63UPDPbLUW08I7JcHOFF23qYdC86xo0-1771162122.087318-1.0.1.1-FbTzNwMzx9bLDYr7mTS3PXbTak5o9DtlMw4680ComCA; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_76bed75952e74eb683090dfc43963706 - status: - code: 401 - message: Unauthorized - request: body: |- { @@ -361,53 +47,53 @@ interactions: body: string: |+ event: response.created - data: {"type":"response.created","response":{"id":"resp_08959ae34ba9b90e006991ca43392c8193ba2bff54ad1765a7","object":"response","created_at":1771162179,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + data: {"type":"response.created","response":{"id":"resp_0385929b1a05c16b0069922bd7b2a881a2a79473a37f9f1864","object":"response","created_at":1771187159,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_08959ae34ba9b90e006991ca43392c8193ba2bff54ad1765a7","object":"response","created_at":1771162179,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + data: {"type":"response.in_progress","response":{"id":"resp_0385929b1a05c16b0069922bd7b2a881a2a79473a37f9f1864","object":"response","created_at":1771187159,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + data: {"type":"response.output_item.added","item":{"id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"f1ugSGhRPtVk","output_index":0,"sequence_number":4} + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","logprobs":[],"obfuscation":"ExVRdLq1LHgA","output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"eZq3h4S1eV0TD","output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","logprobs":[],"obfuscation":"KZr63d8wBO3lQ","output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"L7RpJE2bRN1kSM","output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","logprobs":[],"obfuscation":"P1y6AZReRdTUb8","output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"DiYsp1RjUDC","output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","logprobs":[],"obfuscation":"vkjDqdQhuUA","output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"obfuscation":"91BJCJ5N2PNYbg8","output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","logprobs":[],"obfuscation":"EMX0XlHMAVzSTze","output_index":0,"sequence_number":8} event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + data: {"type":"response.output_item.done","item":{"id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} event: response.completed - data: {"type":"response.completed","response":{"id":"resp_08959ae34ba9b90e006991ca43392c8193ba2bff54ad1765a7","object":"response","created_at":1771162179,"status":"completed","background":false,"completed_at":1771162180,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_08959ae34ba9b90e006991ca4401c0819393cfb91f9e869ba2","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + data: {"type":"response.completed","response":{"id":"resp_0385929b1a05c16b0069922bd7b2a881a2a79473a37f9f1864","object":"response","created_at":1771187159,"status":"completed","background":false,"completed_at":1771187160,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0385929b1a05c16b0069922bd837a081a2901d0bf7eb088fde","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} headers: CF-RAY: - - 9ce527c15c7606a1-EWR + - 9ce789a3f862377d-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Sun, 15 Feb 2026 13:29:39 GMT + - Sun, 15 Feb 2026 20:25:59 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -423,17 +109,17 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '59' + - '41' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=N47BONMHl.W7xFTPaKpIjD5mKWScgD18hOrYVki7P6Y-1771162178.7743359-1.0.1.1-R_8wmj6682jbUqgI6DRAAAEpN2cVBcX.5scuCTLLBi7w3mYgyMfOulXwayZ0yb3Fl14zwE2oRcp1_U4a6HsOqgkuiFS5wmcyo22kPIz5FuAK_JCFhiHCcGx70zWXBNuE; + - __cf_bm=qYxVKrWrZ9N1a0esR02WdIDekq4DeBv.e7rlf4ei8DY-1771187159.6724527-1.0.1.1-AQoBv_iuqoXmhxKBeVgT_AhKekwM_hrenQIZnV95ChQpNJsSiswSkjmrOrKWYj282k_SFJglHTIXJmtgOyXoUKU7RHmzinh_mZr7UxVXUzCsxsViuCt6wzWRss33oXA8; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:39 GMT + 20:55:59 GMT x-request-id: - - req_dc4c5cb64bb240f1aa13fcf53248ae28 + - req_4c838c84665d45c5abc5a948f3eec262 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml index 05be904c01..f9d35003bd 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_existing_response.yaml @@ -48,56 +48,56 @@ interactions: body: string: |+ event: response.created - data: {"type":"response.created","response":{"id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","object":"response","created_at":1770266065,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + data: {"type":"response.created","response":{"id":"resp_0902a5af124240630069922bc771408192a122de125273821c","object":"response","created_at":1771187143,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","object":"response","created_at":1770266065,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + data: {"type":"response.queued","response":{"id":"resp_0902a5af124240630069922bc771408192a122de125273821c","object":"response","created_at":1771187143,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0902a5af124240630069922bc771408192a122de125273821c","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187143,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + data: {"type":"response.output_item.added","item":{"id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} + data: {"type":"response.content_part.added","item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":8} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":9} + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":9} event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":10} + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":10} event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} + data: {"type":"response.content_part.done","item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + data: {"type":"response.output_item.done","item":{"id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770266067}} + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0902a5af124240630069922bc771408192a122de125273821c","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187143,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1771187145}} headers: CF-RAY: - - 9c8fb1fde8b427f6-EWR + - 9ce7893e5983d954-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Thu, 05 Feb 2026 04:34:26 GMT + - Sun, 15 Feb 2026 20:25:44 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -113,3169 +113,17 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '877' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_787c4623a2ca4b899c454b3ecc257759 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0c1ec8c33a20b9bc0069841dd19d14819fb1200ca80ca9673a","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266065,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0c1ec8c33a20b9bc0069841dd378cc819faf3deae7e9d1a70f","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770266067}} - - headers: - CF-RAY: - - 9c8fb21d58856a5f-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 05 Feb 2026 04:34:31 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '555' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_98b5179282b74830a461e6db0ee096bb - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '91' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.109.1 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.109.1 - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.9.6 - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","object":"response","created_at":1770266328,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","object":"response","created_at":1770266328,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770266330}} - - headers: - CF-RAY: - - 9c8fb86b8fe68456-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 05 Feb 2026 04:38:49 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '696' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_351e924fb4374959998decf735ed370d - status: - code: 200 - message: OK -- request: - body: '' - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - cookie: - - test_cookie - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.109.1 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.109.1 - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.9.6 - method: GET - uri: https://api.openai.com/v1/responses/resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05f2a02f9a956d410069841ed8ed7481949747b4cd84ea8b96","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770266328,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05f2a02f9a956d410069841edac41481949e50b23c6a0acda3","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770266330}} - - headers: - CF-RAY: - - 9c8fb8894b0b8456-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 05 Feb 2026 04:38:54 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '534' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_886c229a9e304030bb9ffb59380074de - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","object":"response","created_at":1770643804,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","object":"response","created_at":1770643804,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"content_index":0,"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643807}} - - headers: - CF-RAY: - - 9cb3b81f3eee7c93-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:30:05 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '874' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=rpzn8DkagohwxQctSTtpC6.guQ0CV0EtHESonxILJIE-1770643804.0333288-1.0.1.1-439F17oMty3OVzTrR7nh4NxuIEo2BmfM7wpjHo97hiOFdhlihKYCBqovnTa5qW_MOXveVVyHwCXjQ_u0jC.Z9XSfdpM7fRFFRLQ8zJaNhALEN3zFLAnQGBJCN4C6tGNu; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:05 GMT - x-request-id: - - req_9faebd5c304542c0bebc6d028c3a3923 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0148d8df506da6fe006989e15c99048191bb084218667c8344?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"in_progress","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"content_index":0,"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_0148d8df506da6fe006989e15c99048191bb084218667c8344","tool_choice":"auto","status":"completed","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770643804,"prompt_cache_key":null,"text":{"format":{"type":"text"},"verbosity":"medium"},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0148d8df506da6fe006989e15efe8081918ed4e00a5ec408a3","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770643807}} - - headers: - CF-RAY: - - 9cb3b8434a067c6a-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:30:10 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '341' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=zTAN6tFGn_SGn4aUkttFFprCC8QZpe2K9BO8ZI4NCVM-1770643809.8070018-1.0.1.1-kVggksJw12zveocEikK7xfthogaRXY6Eaii.kgDq4bWoAs6Nh8SIyJUmxusK7bkzBewVAE8Jo8UmjVkhRap27tmGdh7CeT6e5mVRuG_T79AhvoYLGJ0or3dESBJgR1Ns; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:10 GMT - x-request-id: - - req_6967ca9459e1418a85709a65e630caf5 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","object":"response","created_at":1770644211,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","object":"response","created_at":1770644211,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770644213}} - - headers: - CF-RAY: - - 9cb3c211097a643e-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:36:52 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '860' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=4Gwrw3H_pwAeEU79wdn2HMgilTvl4iBzqA7OWhIF84Y-1770644211.3661993-1.0.1.1-.XTNmXiizm6Xx8_QA4B26UQvyd8agBoL5aAgYPP5NPBhgwT7sdTCv75yjicpwVQQwxLPbo1SgwtJBse7bT7ohvl5_XHoKdnXhw20usDLKCLMEWThrdk3T_RMK6RUbM87; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:06:52 GMT - x-request-id: - - req_711a6b2c2b6c4f89b4cd5cc16e1b82dd - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05a457251fac0f13006989e2f366bc819ebe0cd9b0ebaa64ce","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770644211,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05a457251fac0f13006989e2f538a4819e84a46cc0f280462a","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770644213}} - - headers: - CF-RAY: - - 9cb3c22f7f0a41c6-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:36:56 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '382' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=KLyb4w6_uwWDyjN9___24J13UBcBMgWzhrSd9xoiC_Y-1770644216.2335768-1.0.1.1-t_xihvo.XEleyIWC.Nw3jMyYqNCqZZryF.dnk_cPnf85PUk4ENKQ4vo8FPldQIgUvsJw54o2EOmfBa3pFcz66.vnQzejXoIXhMK_RM0ZL327MrFjb1JdYzuA9CzH.UI1; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:06:56 GMT - x-request-id: - - req_e2211e7b86b24125b56c665e816a5de3 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","object":"response","created_at":1770645333,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","object":"response","created_at":1770645333,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645335}} - - headers: - CF-RAY: - - 9cb3dd73dd2143c7-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:55:33 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '810' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=VbUlwocOyFgmNV__PTP3XG7J4yon1c0Ch8Xxo2ppv74-1770645333.0948477-1.0.1.1-1h.4KcbFd5Ytnv4XYjZDMzT8oORoQ_0oWvpvxZwhlzDxUgp1Pj_t9zSm9RxSgPtnzKl.UqVsGu49W_fvgnhWxiLAtB4_qc4hoiLLvn061n35h3.6XiHyZKuodr7ktI8H; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:33 GMT - x-request-id: - - req_17ea2c5d1be447a6b49e140e6e3a289a - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","tool_choice":"auto","status":"queued","usage":null,"top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_016fd2a14fd51324006989e75522e08197bd0da4243c9ea470","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770645333,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_016fd2a14fd51324006989e756f9c0819788bb74a96fb2d989","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770645335}} - - headers: - CF-RAY: - - 9cb3dd930802d2b1-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:55:38 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '403' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ATGl5_dh.lIqECeNIXA7urz6vsnHDhMrvaAa_teMV4E-1770645338.0863152-1.0.1.1-3t5CRAVNrHl7I0_celSPoo7C8PE.gW6dD.Me6QtqB5ZFgYuKwWWR_3_NOfEKyvqkQvOY2erzOIQDUH5AmLCFv2OQeA4BV.Z03duh7sMdrUXRz3OjzTNPPHAB61Vyb_76; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:38 GMT - x-request-id: - - req_656ff7c12bc7464989c84b5107161bdd - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","object":"response","created_at":1770724647,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","object":"response","created_at":1770724647,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770724650}} - - headers: - CF-RAY: - - 9cbb6dd5eeba4267-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 11:57:29 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '1103' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=QEb8WPA3cvb0EyzeVGJ_5FhHzF35Keqz27xzZfJfN0g-1770724647.3456447-1.0.1.1-rzzCsAYqJPkmF5D1nW2m17.qLasyXugQ1KGBAFuGFGw0pXGYllhyUjru00mWvErGG4CL_bB6Hj_t.f8e2k5YGgYeFcP9Bz4rWkBqegV7Mc1cDiVY.gotJ8CVj4vLGGLx; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:29 GMT - x-request-id: - - req_9944683557f4482b9dd241cc0b6bb4b5 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0b7f28da73a2eb7000698b1d27e5848191a5c92325601263a4","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770724647,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0b7f28da73a2eb7000698b1d2a2f6c8191a211e46185458e41","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"default","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770724650}} - - headers: - CF-RAY: - - 9cbb6df8df886e26-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 11:57:33 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '367' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=kaukUDQcjos_fLPGxRM1gLQM_ddbPuRwpZMCa.KtfDA-1770724652.936016-1.0.1.1-K7hojVdc34k36tRG9d2yXU2YP41SMtDh.80aw_K2orkVxhB9KcpjSQS9LgEaLO1dmC.2sL1lMvHyNBaU8lRCQDXbomy9siqGEZ0lw90dQ.PzhLil5JBFJ3IZaWFYrVrC; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:33 GMT - x-request-id: - - req_d31888fcc2a14f7499a843922def1132 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","object":"response","created_at":1770726307,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","object":"response","created_at":1770726307,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770726310}} - - headers: - CF-RAY: - - 9cbb965f5dd952c6-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 12:25:08 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '812' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=mW4o1QeHA8caz2IE8OR.dGdXC60qsfBLLKzp47MkTvk-1770726307.732058-1.0.1.1-ooLP73BzFlrqQOnISvnNHqdWYpqNwrSnUUEs6OwuuGRK5jBFl5OoVtejG9QBxNjc7BpDFCSxe8daB4B5i6fOTrmN5AcyISLU2FI3UD5sRYWtp_djjVzQBwnIq4PPQ8ru; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:08 GMT - x-request-id: - - req_94840e2dd7b5463289eacb2763259721 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_031ea4328311eed400698b23a3c2a881a285cecc83d73238d5","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770726307,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_031ea4328311eed400698b23a6042481a2b4ff42f06c5c1a45","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770726310}} - - headers: - CF-RAY: - - 9cbb96815c16ad1b-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 12:25:13 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '383' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=zNHMwERvNAOse1YYHOJndbhqu4betfKC6LgL7T_sJNQ-1770726313.1742525-1.0.1.1-6zZ7YZlzfzlE0OQrejafUQo0hCgbjJyeBUgeBCqn6tJ2Ziw9fhClxeFKv30rZbp7R_hR3b9xo4z2Dtj4w8fUBJgyzSjR6MZIR2oTuvhaeAi2F0M7ubfnJccJuVkdr17X; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:13 GMT - x-request-id: - - req_ce73677429df44f581ed70930b54a494 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","object":"response","created_at":1770867964,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","object":"response","created_at":1770867964,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867966}} - - headers: - CF-RAY: - - 9cc918c42ff20c23-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:46:04 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '705' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=hHMNOWHo644IWEIG1UG1mLCF4MSPa394V3CENTmqSDc-1770867963.547861-1.0.1.1-hOPW3Ir6a2l8jUIuSXmxL_Wjn9Du3cFZkwqbvp06JL4.Lc9LBwST.mfYe_e3_xlcAYA0CH7GMk3GwCzz35t.tOdKF6sya4psWfC8CqbSmupZA75b301Jr25yo5t_6_fD; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:04 GMT - x-request-id: - - req_6f11ef0c44644b91a229757a581e49f0 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_026f7be60ca577ed00698d4cfc0d748197be21911a4d549b28","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770867964,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_026f7be60ca577ed00698d4cfe77d48197a9417fa5c3b96744","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770867966}} - - headers: - CF-RAY: - - 9cc918e94e257327-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:46:09 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '461' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=8EJcpwKJqn3Oo1ThW.X6IDbZbSWAiBqfu2gW.c_r7G4-1770867969.490054-1.0.1.1-54S9E5zktvTQ8yzVphIJB2x1eFOjV3s7b6a3Nliu0zz0SWVcPAFCq55CCvLqoQMaF2IQv793I7aLc5rntEnrNmDSnKZdwIPpUZgiof1WL6WJRvp44.KwE9L20mvPV0dS; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:09 GMT - x-request-id: - - req_ef90fb883284473ab8506549cc595da3 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","object":"response","created_at":1770868722,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","object":"response","created_at":1770868722,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770868725}} - - headers: - CF-RAY: - - 9cc92b4e093d2633-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:58:43 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '887' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=teq1DElI45Gh4uJXv2Zh1oe8pEPp1drOXGOeXo.aWNw-1770868722.8885946-1.0.1.1-TuuFiPg4cw.ZoYwDUUp8KBCrGi.Baj3fV_u1MDJzPCUddvkRY7jJAUhTGrerYBBWgL8bxbsPdprVpE09.JcpUlAV5sSvuwXk8ffMJqGH7szOWVKNs3YALxYiVn1VWwB1; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:43 GMT - x-request-id: - - req_bdd57a0aea33459db4c4ac32078b3b32 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","id":"resp_05862156bbc6ae4300698d4ff2ea5c819e9461d98af4f02605","tool_choice":"auto","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770868722,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_05862156bbc6ae4300698d4ff5eaa8819e90fcc9de3c924e46","content":[{"annotations":[],"text":"This is a test.","logprobs":[],"type":"output_text"}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1770868725}} - - headers: - CF-RAY: - - 9cc92b738b99c3f3-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:58:49 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '512' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=jFvZqbvfZV_x8HqXEHPVzSra2swNP6HwIBipN4t_7UE-1770868728.882983-1.0.1.1-yiS9EjgQEH4rJeUBHkIvZiJlLA24lX21OsVT5zySA0YTAK57npNMK9rjNruv8Wmf2QGOJ3doabyuQk4NyJhuOyGr8pd1Pdv_q7vZKcOl_6P1uxHqwK2Ufejf7_QGeELM; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:49 GMT - x-request-id: - - req_a737f120bc134517a2bb47d3ac4204e4 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc931335b42c674-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:02:44 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '21' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=cN6HXXe09u4no3T0rObH8_OxeqmJxiQcPUbj1ezHo7g-1770868964.372188-1.0.1.1-Bkj7Z93thGzqZC3dHM8NhCIiMwEZVlfHfOjIt2OTRCdpDhqgDJqQf8SpSrMDkzBqrJbEmqqS8OZLGzwYPUwkGUHYPflUypEyKnaSHfSzKXKQ77kEARMURqDwLQG7UYCL; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:32:44 GMT - - _cfuvid=GsMYUkDzTk4hSN1MCu_iwj6KMwDJ2.i4jEkH1f9u9hY-1770868964.372188-1.0.1.1-PVRU5DH6bob6DFVzsKThM7EzX6V6sE0Sw_xGKN977XI; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_5046f2b79335432cad001c773a0a1679 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","object":"response","created_at":1770869095,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","object":"response","created_at":1770869095,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869097}} - - headers: - CF-RAY: - - 9cc93464cc323f3b-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 04:04:55 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '751' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=lnOqjz_NdrPw56zGUXT1ONU1FoLy3dZsbtHNOwoTE_Q-1770869095.1610901-1.0.1.1-D3abIBlAAXr.z0oUIlajbmlnZh8nmdaUqd9yBYQo5SmzIneAlGrdGsUN6ruGF6ceQ54OgRCj22nKF_zjtb2WfW1U2bDrylXe90OH1kywHpULlXiqxa4HcGj3GXowETma; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:34:55 GMT - x-request-id: - - req_fca581118c2c41fe89dfc6cfc3c54a66 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0360276550aeba8600698d516734c8819086a16b42b1284ecc","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770869095,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0360276550aeba8600698d51691c2c8190a864e85daa2cf6ea","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770869097}} - - headers: - CF-RAY: - - 9cc934868a8497d2-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 04:05:00 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '338' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=qscB_G3Lcys_gMNnvnYi5TDCFd1X3WlyEuzm0XSHi1A-1770869100.5632508-1.0.1.1-BA0VdYJilIy24H8Jprhlsn1FHX48s7ipHyO0K67ylH9mFFEzX.dK5apn_NUe6877xm7PQpxJT7kd6TXbSDLgZms5vG.jvFYt14MkkN5jhufjerZaf_jLEsaB5PxzZ8YG; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:35:00 GMT - x-request-id: - - req_2a2fc75ed57b42f6a4e4451bb49f0384 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","object":"response","created_at":1770873166,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","object":"response","created_at":1770873166,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873168}} - - headers: - CF-RAY: - - 9cc997c0bc027288-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:12:47 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '1203' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ULGjZuKUGBpGgQO0HAUCxQjLlMccWHrXJY8KZBQ_jNA-1770873164.912948-1.0.1.1-GXiJ57yQzyHwIxYufD7QYCNhpzgSsgzL69oxV_tl9tIVHpzudeHwCkitTcLpO2pUREvNIXrw1CouJ0TWKp48vlEFPct91rRuRWSUSAlL1h_NuyTG.yac_Wsz30LcxHUK; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:47 GMT - x-request-id: - - req_e842a237b2be4676825258772a5792ad - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0caff70b686a0da000698d614eb0288195bbeed0a2ba10950e","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770873166,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0caff70b686a0da000698d6150c4648195bc134f68b9f20b11","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770873168}} - - headers: - CF-RAY: - - 9cc997ec3ab64352-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:12:52 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '432' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=vHVxC95u1KkjbJDmqEw1bm7iJTi3yHQVGacydr22Q.w-1770873171.872945-1.0.1.1-ePBhPyQb4cku4XjDjg_m5WtqyoM5Lut_IS52dul05zDvfMziK.CbYLndRdCMvIGa.pWyTtfi8qh9D1.Wd8uxS.rAOrsA_5q1ahVyQ0_pP.6tv2VkO7bzGyPiD8wja8fF; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:52 GMT - x-request-id: - - req_88667072691f47efacfd24fdc4ddf269 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","object":"response","created_at":1770874467,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","object":"response","created_at":1770874467,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874469}} - - headers: - CF-RAY: - - 9cc9b78d1fdf3eb4-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:28 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '827' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=SJM9y5sfi6QeBC4958.TNSbWXusZMIWtgKYRman1L_0-1770874467.372517-1.0.1.1-xvNXbBBbzmukmPdjQ4KtmjmPDA9MlOtTCOwT.RkgFzItKeZSRnBTrhQDAfmMwLMkM4.acVLipW1cSWY7.JCE1DrAmgGZwchcUF5JE0PfBbpO1B4RzLwJqKK713Dd4Cfm; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:28 GMT - x-request-id: - - req_ceff0538ad4b48b3b9b18b0bc374edc7 - status: - code: 200 - message: OK -- request: - body: '' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - cookie: - - test_cookie - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: GET - uri: https://api.openai.com/v1/responses/resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd?stream=true - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"content_index":0,"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_07f3b6f3ff57d17200698d666366c8819ebc025d8a14d795fd","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1770874467,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_07f3b6f3ff57d17200698d66655fd4819e800a6a12015bb839","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"background":true,"completed_at":1770874469}} - - headers: - CF-RAY: - - 9cc9b7b40a49acf1-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:34 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '450' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=R3P14LW_M8tqdmPB.gLKj7DymNRd0tRxHjfgUYUdM8E-1770874473.6103997-1.0.1.1-aBuasfVI5rAtjxc3ND6.s.RwWBNYI5CB9595ZX3FF04XxFWGEbCgZrpojhjAcnl_vDGAmlyRfewdkFV9IDDXquoevlu9V1zTT.qQFl.taXhClB3jz3d4WTxgGn0ppW7c; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:34 GMT - x-request-id: - - req_8f3764c1a8f544a78b35f0a62cfab538 - status: - code: 200 - message: OK -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce526567f83c45e-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:40 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '16' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=akRdtKb5nR7YeriBzX2HcpHUk.pINvjidWqKGhwXNVM-1771162120.7126136-1.0.1.1-XQs2ADMD3XdFWWajozu5BqH0l10DfpLSrNwuCPpY48WNN9ueKIAy9QAFgviXgv3h5TDwi20uQqE7_mDSHfhnWkQxLw5f73m93yMY1Pg9cgPR2x9WonftjqCSFouPcVCk; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:40 GMT - - _cfuvid=n7kFm1njsD4fNGzq41LopqBS_L1TczUUXSJh__1hIAk-1771162120.7126136-1.0.1.1-nb5Qgw7P0wNcLpPFakJJ6w0GLGjMUkSsItuhzsv2_fY; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_db4847507edb41a6848e1a10c5e54368 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "background": true, - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '91' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","object":"response","created_at":1771162158,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.queued - data: {"type":"response.queued","response":{"id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","object":"response","created_at":1771162158,"status":"queued","background":true,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} - - event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":9} - - event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":10} - - event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} - - event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1771162160}} - - headers: - CF-RAY: - - 9ce5273bf97a42ea-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Sun, 15 Feb 2026 13:29:18 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '653' + - '825' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=9adPse4e7Rz6LUwGDIrBvfKwyaLPy171g5HuE2k5.kE-1771162157.4320157-1.0.1.1-l4yPIYMzPACmwUGb1ViSxzyOci7PbGAN9i1Q0PeqpqrMq1yhLVM51CUV3SAnPdNIDQ6wk0vGQpZ8Cv8yLycgYgftWNWv62QzRwG.kOhoMYIiSGSQC363o7y8MKR_azFh; + - __cf_bm=wdqKFzmig00qL5iRqKdSV5B86Q4qwIxGAekZkL6MbIU-1771187143.4113734-1.0.1.1-FG980w2OZNpsIyCNY58BpMIlwNGYFung.RgZSVG1qRhLTzNkXeDGFRGVt87CIc3PD_AOao7uHZIjVYt90pKGHYHzAVMgqZ45QK6u3gEn0WmljmWATbHxQ_hikPcTxacB; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:18 GMT + 20:55:44 GMT x-request-id: - - req_d21c2914ed554da6a9263a5cdd950117 + - req_16f6d65735b649ff886e473dcad3db8e status: code: 200 message: OK @@ -3315,61 +163,61 @@ interactions: x-stainless-retry-count: - '0' method: GET - uri: https://api.openai.com/v1/responses/resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12?stream=true + uri: https://api.openai.com/v1/responses/resp_0902a5af124240630069922bc771408192a122de125273821c?stream=true response: body: string: |+ event: response.created - data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","tool_choice":"auto","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + data: {"type":"response.created","sequence_number":0,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0902a5af124240630069922bc771408192a122de125273821c","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187143,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} event: response.queued - data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + data: {"type":"response.queued","sequence_number":1,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0902a5af124240630069922bc771408192a122de125273821c","usage":null,"status":"queued","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187143,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} event: response.in_progress - data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"model":"gpt-4o-mini-2024-07-18","previous_response_id":null,"safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"background":true,"max_output_tokens":null,"service_tier":"auto","instructions":null,"max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} + data: {"type":"response.in_progress","sequence_number":2,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0902a5af124240630069922bc771408192a122de125273821c","usage":null,"status":"in_progress","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187143,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"auto","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":null}} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} + data: {"type":"response.output_item.added","item":{"id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content":[],"role":"assistant","status":"in_progress","type":"message"},"output_index":0,"sequence_number":3} event: response.content_part.added - data: {"type":"response.content_part.added","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"annotations":[],"text":"","logprobs":[],"type":"output_text"},"output_index":0,"sequence_number":4} + data: {"type":"response.content_part.added","item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"part":{"text":"","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","delta":"This","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","delta":" is","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","delta":" a","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","delta":" test","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":8} event: response.output_text.delta - data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":9} + data: {"type":"response.output_text.delta","delta":".","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":9} event: response.output_text.done - data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"output_index":0,"sequence_number":10} + data: {"type":"response.output_text.done","text":"This is a test.","logprobs":[],"item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"output_index":0,"sequence_number":10} event: response.content_part.done - data: {"type":"response.content_part.done","item_id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content_index":0,"part":{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]},"output_index":0,"sequence_number":11} + data: {"type":"response.content_part.done","item_id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content_index":0,"part":{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]},"output_index":0,"sequence_number":11} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} + data: {"type":"response.output_item.done","item":{"id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"},"output_index":0,"sequence_number":12} event: response.completed - data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0ef7be47323cd8cd006991ca2e04308195b8a29de585633c12","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771162158,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0ef7be47323cd8cd006991ca3015308195955908dbe75e24dd","content":[{"text":"This is a test.","type":"output_text","logprobs":[],"annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1771162160}} + data: {"type":"response.completed","sequence_number":13,"response":{"truncation":"disabled","tool_choice":"auto","id":"resp_0902a5af124240630069922bc771408192a122de125273821c","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens_details":{"reasoning_tokens":0},"output_tokens":6,"total_tokens":18},"status":"completed","top_p":1.0,"temperature":1.0,"top_logprobs":0,"object":"response","created_at":1771187143,"prompt_cache_key":null,"text":{"verbosity":"medium","format":{"type":"text"}},"incomplete_details":null,"frequency_penalty":0.0,"previous_response_id":null,"model":"gpt-4o-mini-2024-07-18","safety_identifier":null,"metadata":{},"store":true,"output":[{"id":"msg_0902a5af124240630069922bc998188192a56c34bc519252a9","content":[{"text":"This is a test.","logprobs":[],"type":"output_text","annotations":[]}],"role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"error":null,"instructions":null,"max_output_tokens":null,"service_tier":"default","max_tool_calls":null,"prompt_cache_retention":null,"tools":[],"user":null,"background":true,"presence_penalty":0.0,"reasoning":{"effort":null,"summary":null},"completed_at":1771187145}} headers: CF-RAY: - - 9ce5275fcd4b429a-EWR + - 9ce7895b9c838c8d-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Sun, 15 Feb 2026 13:29:23 GMT + - Sun, 15 Feb 2026 20:25:48 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -3385,13 +233,13 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '303' + - '435' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' x-request-id: - - req_e9c58b155594433cb864d99c852f6786 + - req_573eb07663324b1da146ed2ebdc51cd6 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml index 4e55215f73..5eb7925500 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_new_response.yaml @@ -47,53 +47,53 @@ interactions: body: string: |+ event: response.created - data: {"type":"response.created","response":{"id":"resp_0248c38c3ffac6050069841dd01dac8190af681597b03c5c71","object":"response","created_at":1770266064,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + data: {"type":"response.created","response":{"id":"resp_0ed89c7c7fe30b0f0069922bc62a788196baf96470de20bf1e","object":"response","created_at":1771187142,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0248c38c3ffac6050069841dd01dac8190af681597b03c5c71","object":"response","created_at":1770266064,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + data: {"type":"response.in_progress","response":{"id":"resp_0ed89c7c7fe30b0f0069922bc62a788196baf96470de20bf1e","object":"response","created_at":1771187142,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + data: {"type":"response.output_item.added","item":{"id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"R0rjCLsAoGyt","output_index":0,"sequence_number":4} + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","logprobs":[],"obfuscation":"mP3OzBGcGwoN","output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"FUpwiz7MqEtNm","output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","logprobs":[],"obfuscation":"4oyXAkuroaPuJ","output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"W8mwermkTX9NT5","output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","logprobs":[],"obfuscation":"CP2UMbr4diy5br","output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"veeIiLYpsZC","output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","logprobs":[],"obfuscation":"gDnWyUINjvp","output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"obfuscation":"ozfhGdt1xZTOoGk","output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","logprobs":[],"obfuscation":"MMCPwsJRyYHfWBw","output_index":0,"sequence_number":8} event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + data: {"type":"response.output_item.done","item":{"id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0248c38c3ffac6050069841dd01dac8190af681597b03c5c71","object":"response","created_at":1770266064,"status":"completed","background":false,"completed_at":1770266065,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0248c38c3ffac6050069841dd109b08190adf7389faa272316","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + data: {"type":"response.completed","response":{"id":"resp_0ed89c7c7fe30b0f0069922bc62a788196baf96470de20bf1e","object":"response","created_at":1771187142,"status":"completed","background":false,"completed_at":1771187143,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0ed89c7c7fe30b0f0069922bc6fa5481969e5f6dfb46d7c872","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} headers: CF-RAY: - - 9c8fb1f0fdcd3e9d-EWR + - 9ce789364873b1f3-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Thu, 05 Feb 2026 04:34:24 GMT + - Sun, 15 Feb 2026 20:25:42 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -109,1849 +109,17 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '119' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_b03595fe90914538bcbf04edc0d0b182 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '71' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.109.1 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.109.1 - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.9.6 - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0c116b3a90990d180069841e51f114819c89e0abbefcb49e9f","object":"response","created_at":1770266193,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0c116b3a90990d180069841e51f114819c89e0abbefcb49e9f","object":"response","created_at":1770266193,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"BQ0VZyX99IHQ","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"rkyhZBvjbt1BG","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"UGQf2uwGMhgYAh","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"TIsiH5ms9qW","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"obfuscation":"5pSTap0E4JD7LAG","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0c116b3a90990d180069841e51f114819c89e0abbefcb49e9f","object":"response","created_at":1770266193,"status":"completed","background":false,"completed_at":1770266194,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0c116b3a90990d180069841e524aa8819c8d6b7cb518942b9b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9c8fb51fe834fef2-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 05 Feb 2026 04:36:34 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '57' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_11212912366042b999af13099863b3c1 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - accept: - - application/json - accept-encoding: - - gzip, deflate - authorization: - - Bearer test_openai_api_key - connection: - - keep-alive - content-length: - - '71' - content-type: - - application/json - host: - - api.openai.com - user-agent: - - OpenAI/Python 1.109.1 - x-stainless-arch: - - arm64 - x-stainless-async: - - 'false' - x-stainless-lang: - - python - x-stainless-os: - - MacOS - x-stainless-package-version: - - 1.109.1 - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - CPython - x-stainless-runtime-version: - - 3.9.6 - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_003dd6c772a28cfb0069841ed7fbb4819397bfc639f41c322b","object":"response","created_at":1770266328,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_003dd6c772a28cfb0069841ed7fbb4819397bfc639f41c322b","object":"response","created_at":1770266328,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"CvtmfQYtDveH","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"V1Kja1dttDNCV","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"IgSeetEXJTkPrM","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"wsC1P31fEa4","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"obfuscation":"kAipRvsdTVL5eoN","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_003dd6c772a28cfb0069841ed7fbb4819397bfc639f41c322b","object":"response","created_at":1770266328,"status":"completed","background":false,"completed_at":1770266328,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_003dd6c772a28cfb0069841ed849fc81938933fcb7fd9c2e4e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9c8fb8659930c451-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 05 Feb 2026 04:38:48 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '59' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - x-request-id: - - req_d0c865518dea41eaae1c33b0e0dab6ca - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_03908c6b15ff67cf006989e15aaaac819ca4ff9346b51c65d3","object":"response","created_at":1770643802,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_03908c6b15ff67cf006989e15aaaac819ca4ff9346b51c65d3","object":"response","created_at":1770643802,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"4TKXZ1DG9JAZ","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"RIHhashaKqIlk","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"qdu83NDu3gJ0ck","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"qxqlIJQk0oE","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"obfuscation":"GAm0FQDfKGabat1","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_03908c6b15ff67cf006989e15aaaac819ca4ff9346b51c65d3","object":"response","created_at":1770643802,"status":"completed","background":false,"completed_at":1770643803,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_03908c6b15ff67cf006989e15b8f30819cbb348d774998df09","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cb3b812cf3f5cb9-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:30:02 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '39' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=6n.bUeTommxAzUfk76yK7yZMUeeTdQDlxTHVOTrNpL4-1770643802.0510373-1.0.1.1-jSE1kdu_Q0EHTd5mJc_U1QAsqfGtzK2IDj9NM40Ew16O.XtEXUcnmcBYZFml_PtSkRqbYFcdtaCurtxlBTlbOqf_qOAG5ZZzSy_Z6hC.7tZrR_cWHgR2kFntpRLyfnUr; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:00:02 GMT - x-request-id: - - req_e2e17b66baea40b7be3dc0270ce2ff47 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0b5cc31d11cb33ec006989e2f1ff988191b71a637d72eee764","object":"response","created_at":1770644210,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0b5cc31d11cb33ec006989e2f1ff988191b71a637d72eee764","object":"response","created_at":1770644210,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"wW7rEzh4uPlN","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"AlhfP74CdEYBT","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"JSOPxkEkaj9yL2","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"osbbnTAxvYI","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"obfuscation":"73UYK4gsAISweKD","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0b5cc31d11cb33ec006989e2f1ff988191b71a637d72eee764","object":"response","created_at":1770644210,"status":"completed","background":false,"completed_at":1770644210,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0b5cc31d11cb33ec006989e2f2d7b0819195d91a1fcac825f3","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cb3c205192cff90-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:36:50 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '35' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=SxvgSb9pfjP7_LzD5BK7hnDYs.GYICQvd8xTtRyUE98-1770644209.4554598-1.0.1.1-1Vb3TgOGcUiaX0IKkJLJ4zJZoQmzvHZsLBSXViQ7d1r630C7IOqIhkQ7J697M3BbrxJy9zoJneFCNOm5u8CpiQPOeXxga5WqtqHDPd8aPktPR_0auOJtZDvxb.rw_xr6; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:06:50 GMT - x-request-id: - - req_fd80496512fa41499291851f45884824 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0e27e316613778d9006989e753ff4881948d1a10896cd7e2cc","object":"response","created_at":1770645332,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0e27e316613778d9006989e753ff4881948d1a10896cd7e2cc","object":"response","created_at":1770645332,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"cqSAlF5nnvrZ","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"P4ChvyTPhJdXd","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"BHG2Qtf08bL5fi","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"wvqQYdYlA40","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"!","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"19fJSTVkv5KhXto","output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" How","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"HVSG1HPyircm","output_index":0,"sequence_number":9} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" can","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"xOo47gZ8UvXu","output_index":0,"sequence_number":10} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" I","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"RsNTKjbVNRVqWF","output_index":0,"sequence_number":11} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" assist","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"PctOmlMOS","output_index":0,"sequence_number":12} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" you","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"dOQt98cmhjN4","output_index":0,"sequence_number":13} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" further","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"SgIGcc91","output_index":0,"sequence_number":14} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"?","item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"obfuscation":"PSPrwiNlZeKBPWO","output_index":0,"sequence_number":15} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","logprobs":[],"output_index":0,"sequence_number":16,"text":"This is a test! How can I assist you further?"} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test! How can I assist you further?"},"sequence_number":17} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test! How can I assist you further?"}],"role":"assistant"},"output_index":0,"sequence_number":18} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0e27e316613778d9006989e753ff4881948d1a10896cd7e2cc","object":"response","created_at":1770645332,"status":"completed","background":false,"completed_at":1770645332,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0e27e316613778d9006989e754732c8194a0263549a9de020b","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test! How can I assist you further?"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":13,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":25},"user":null,"metadata":{}},"sequence_number":19} - - headers: - CF-RAY: - - 9cb3dd6cbc5a61ce-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Mon, 09 Feb 2026 13:55:32 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '82' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=EMEvMqGApU3ozDxhzGl3101Ox2GWFYpMh3TqcoizxRw-1770645331.9510934-1.0.1.1-_ShFC4cokwSYkqTKad4N.uf23Lrt8LEjWfUidRgTx.v4jxb7w_VL76OnacuI9SiGLi3PW30yNS5M1e45FKXEIWUE6p11bJ25cZJzNdTGGudiuwIk2th6RlB.ryJl2tkX; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Mon, 09 Feb 2026 - 14:25:32 GMT - x-request-id: - - req_a056e762fe5149fa99198231b94b4ed4 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_03d8362571afaf6600698b1d269088819e964846d7a94d4459","object":"response","created_at":1770724646,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_03d8362571afaf6600698b1d269088819e964846d7a94d4459","object":"response","created_at":1770724646,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"ukWSxSSC5P1b","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"dIwESfdoawPRE","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"5AT2L4AtHTBVtf","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"erRAywRdoqe","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"obfuscation":"h28snF5bYEc7qBr","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_03d8362571afaf6600698b1d269088819e964846d7a94d4459","object":"response","created_at":1770724646,"status":"completed","background":false,"completed_at":1770724646,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_03d8362571afaf6600698b1d26cc48819e83d22fae2c825258","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cbb6dd0d86cad1b-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 11:57:26 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '46' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=3PQoqRs2iRdzPljmFRS2fR0r1lP3Ypcwj8V350PwUi8-1770724646.5367904-1.0.1.1-gcb.LHTKRBTPXipRo9U1E1rv2EC.I1cyRzJFPb1SUMCie8IMisMYXECXcBCvWLmx6r9O_0KDYACRxxVpMwnQIRCtTmR54KVfv85EBVNR_in2eZiuZLukb1SZkCdAUPez; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:27:26 GMT - x-request-id: - - req_ee66a9a78761457f8ddf6bc4e85847e8 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_097434ae4051689200698b23a2a32c81a0bea8ed92ce821cd9","object":"response","created_at":1770726306,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_097434ae4051689200698b23a2a32c81a0bea8ed92ce821cd9","object":"response","created_at":1770726306,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"EraXvNfv3JTC","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"wKX4aJFRefrFl","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"le58JaBV1nSBWt","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"kcum1dN31DN","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"obfuscation":"Z8yotDPRZOKTgGY","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_097434ae4051689200698b23a2a32c81a0bea8ed92ce821cd9","object":"response","created_at":1770726306,"status":"completed","background":false,"completed_at":1770726307,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_097434ae4051689200698b23a32c4881a0a6dbe88e7ed086dc","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cbb96584c264243-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Tue, 10 Feb 2026 12:25:06 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '58' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=uMeMUqRdupJl1sFolk3sqFiqOg_jUTWHfF.IKbQgzTc-1770726306.6050355-1.0.1.1-Kv5WQ_j9NRnHq9A52nDzX.Me.TS_vBTuKMzPcTZlzrv2sCZoAV2O_j550uoxjebsLjwG65EzzAm2VtfTa6ZaBBld1kEbUYv4RTluFCfep0g2qjcfVbH3sw_gM.CHNpTr; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Tue, 10 Feb 2026 - 12:55:06 GMT - x-request-id: - - req_7b2e832d0adb4290af1353e80c34b93f - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_06255fe8727259cc00698d4cfa7c608197b17558a06e6b2be0","object":"response","created_at":1770867962,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_06255fe8727259cc00698d4cfa7c608197b17558a06e6b2be0","object":"response","created_at":1770867962,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"8iYxwtFtjRKK","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"6oz4SRoxoS3a0","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"PzijEf00s761LR","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"eSD8uz8AXBI","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"obfuscation":"06YMcDBckV0iCgd","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_06255fe8727259cc00698d4cfa7c608197b17558a06e6b2be0","object":"response","created_at":1770867962,"status":"completed","background":false,"completed_at":1770867963,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_06255fe8727259cc00698d4cfae9448197bfdcda44ffcbc0fb","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cc918bd4a970ab9-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:46:02 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '65' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=8pkFzP3eHObkLs08oqs8n8lAZGYl8DBWEiHHvRlrd.I-1770867962.44136-1.0.1.1-vyF34L00PIKO8k6UmHEy6tflDtgJvFsCtxuwYtlkDTtRBtcqMp5g__yIwC9tWSxHeCHxkv2RkdfiA.IAyC8qCm5CJ3M7kuV8EZhyuVXNbwIBbA3YkFNCnKLk9pz48U_v; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:16:02 GMT - x-request-id: - - req_79666ac6d4bb4277a1a1a87b45904673 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0b79093d54332ed400698d4ff1e390819486e6134fd9a50a67","object":"response","created_at":1770868721,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0b79093d54332ed400698d4ff1e390819486e6134fd9a50a67","object":"response","created_at":1770868721,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"DY3FiwfxIUnm","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"fxTGZIpsyU1j1","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"xHZXEHW15pIhyv","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"xxcOTf0yIIK","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"obfuscation":"7oQhAbP76wmzTQh","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0b79093d54332ed400698d4ff1e390819486e6134fd9a50a67","object":"response","created_at":1770868721,"status":"completed","background":false,"completed_at":1770868722,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0b79093d54332ed400698d4ff24e6c8194bfdaff17554ac1fa","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cc92b477ec6de96-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 03:58:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '150' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=2LauqUm4Qyh6qhR__ZrkJk6X3B8gWs3iqQHZB6kOGB0-1770868721.8325293-1.0.1.1-TjIWnbd1WkhGqi7Oo5oc.PcgnBUSDH4OxSqQiaRkXUq04OqmP6ZJVvgjVeaSjhPDftHhKTpgjHEkjKQia8inwhvt8cHaYQ49YcAVdRUA2qos4Ef2Bn8oomaY4f6MyZ66; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:28:42 GMT - x-request-id: - - req_cfcaed1ec69e4545997f5f2063a93faa - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9312b8a5a1a38-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 04:02:44 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '37' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=dDAYLZoNyURI67ucUyfBauZrO8itX7GKzlbp50d3OBw-1770868963.1219938-1.0.1.1-kKDfr24jqtjDOGBl_zHuZKk_u7pexslp5FEjAgvBiypFiXILexI6kKX4aUj1Wi39ogYFXJPKjJsaCVctekI0SaIMdJr8WpTPACzq4c4pGaA3b86HIRz4d_CHZxPxmjbP; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:32:44 GMT - - _cfuvid=C9jQarVe_H7QET71.9mG6JxfTHzsqofOESS7MhiRVTU-1770868963.1219938-1.0.1.1-gHIac5B3..g6oFWAYDKhC0HtPQMdUEcPCc.77LOem4w; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_b5c464e057eb4e0f92138861cb4631d4 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_067728eebf486ac800698d5165eaec819fa5e24aa7d6e7318d","object":"response","created_at":1770869093,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_067728eebf486ac800698d5165eaec819fa5e24aa7d6e7318d","object":"response","created_at":1770869093,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"6jSVePP2ajm8","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"v0LwdCkxbYFVv","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"WMgOsZBxtLgyWh","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"JHVJAL4eQZF","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"obfuscation":"RY9fj5dgls1vjci","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_067728eebf486ac800698d5165eaec819fa5e24aa7d6e7318d","object":"response","created_at":1770869093,"status":"completed","background":false,"completed_at":1770869094,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_067728eebf486ac800698d51669518819fb766417ff7c68f96","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cc9345ccda126df-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 04:04:53 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '37' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=DlWrD6_ozIOhQCzVfnfoh9udPIKWhuNEpQTSkCiY2gA-1770869093.889876-1.0.1.1-ZsVBDROTo0sOTS4esDjdqUIxGHVTSDpsxawcAsY8o5BEvksroz28S1u69uAXvc1b2PWBydnfEbxRdXXpLA2zEXK7X0CQ448KS27dwNdan8r41u2NJIFTCTtTeNFH4Wa8; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 04:34:53 GMT - x-request-id: - - req_26ed73960a244ad7a4f611b3e0c78746 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_076fb2e5e2775a8300698d614bd5048192ace3ae8713f7cefc","object":"response","created_at":1770873163,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_076fb2e5e2775a8300698d614bd5048192ace3ae8713f7cefc","object":"response","created_at":1770873163,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"dpo98iy4Hq5s","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"VcJ6ui0KD2jZP","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"lqdDcKKTQZtj6Y","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"c0T17Mu0EUw","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"obfuscation":"EGHDOLpmFtLftV0","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_076fb2e5e2775a8300698d614bd5048192ace3ae8713f7cefc","object":"response","created_at":1770873163,"status":"completed","background":false,"completed_at":1770873164,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_076fb2e5e2775a8300698d614c4ef881928c720223edfb8f46","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cc997b7ca5542a3-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:12:43 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '36' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=DuKfrz1jLO.hM33IQMFa.6lwBEPT9phIPiVNsYhTljA-1770873163.4853525-1.0.1.1-b_SsnlTSZOW2YpYeYcf9Ts4GcSGR3xXt2VmrO07fw93Df8DZJwxYX4SHGag00u9i5EteFs0yXcGL2_LyXVlSy8MS2e_apsIpZwHAIW52iCimShzJ3RH1ok_HiA7dEjN5; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 05:42:43 GMT - x-request-id: - - req_8e0c275ee90641538e3ec9afaab9996f - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0a6a9b5ed843293900698d666247e88196ad4901f775451198","object":"response","created_at":1770874466,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0a6a9b5ed843293900698d666247e88196ad4901f775451198","object":"response","created_at":1770874466,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"u29F3EMxDpK9","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"Bep4erKn9tLgp","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"Z2KmQanJABCKKc","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"NtSNiAFkqQq","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"zTGS4YHjT5NOjfS","output_index":0,"sequence_number":8} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" How","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"lPC48oFQRsQN","output_index":0,"sequence_number":9} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" can","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"rDo5WpXdN7Ym","output_index":0,"sequence_number":10} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" I","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"XsYvGbz3w8je6Y","output_index":0,"sequence_number":11} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" assist","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"oDl7BSPaD","output_index":0,"sequence_number":12} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" you","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"en8qiMjkJzEf","output_index":0,"sequence_number":13} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" further","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"U7ODr5iC","output_index":0,"sequence_number":14} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"?","item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"obfuscation":"zWwN7Bg13rfaPsa","output_index":0,"sequence_number":15} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","logprobs":[],"output_index":0,"sequence_number":16,"text":"This is a test. How can I assist you further?"} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test. How can I assist you further?"},"sequence_number":17} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test. How can I assist you further?"}],"role":"assistant"},"output_index":0,"sequence_number":18} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0a6a9b5ed843293900698d666247e88196ad4901f775451198","object":"response","created_at":1770874466,"status":"completed","background":false,"completed_at":1770874466,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0a6a9b5ed843293900698d6662ae64819683ef53594a883774","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test. How can I assist you further?"}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":13,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":25},"user":null,"metadata":{}},"sequence_number":19} - - headers: - CF-RAY: - - 9cc9b7847a9d421f-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:26 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '64' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=e6QPWJPKYbz2SmJTisgi3Y3D20mOH53mcOUf4BSeD.0-1770874465.9913394-1.0.1.1-qmOwnrIGDnEKahiaR_Mq9Xt38SYizugcww1fIvfJvB35DLKsHJOtowHkxrk2ImkEP736Yr_rIT8f_AJH.vE_v6zbwPyvUmRwfCYgaaymgd.VRWuc9E2o6ErHDUIBIW71; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:26 GMT - x-request-id: - - req_976c70b7ebf34904a3e2a37a0fe333a6 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce526544b59cd7f-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:40 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '18' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=e9bCnNV2R6zbmfkV.mBTAvBvN9WHTkkvO3tQ70.EtNg-1771162120.3623517-1.0.1.1-FzANODuQ8ZC8cecdmSNgqAPUlKuIZuCjdix19cRzqbSwNcDZyIMEoQpZvgtTE6035Rfcp.SvaPfIdw1_FM0x6.jM5vrPSApbuNPXuUcNhcUCznouYpidx493eYaGYHcI; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:40 GMT - - _cfuvid=Br64oeFq3AFUeSJl5pbmkglBM4l9DItw20kGfo1C3P4-1771162120.3623517-1.0.1.1-4GOZifOwFGuLE51OdkVPSMLTfE4QnLXKRrbkIU08lrQ; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_8636db8fb8644d40b22c1312f9c15cc6 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0f3c3fff467e7fb1006991ca2ad7188196a7ad12038cecab96","object":"response","created_at":1771162154,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0f3c3fff467e7fb1006991ca2ad7188196a7ad12038cecab96","object":"response","created_at":1771162154,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"55STbyLXTRmU","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"WCzA6M9pV2M7u","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"3t2kz7Oq79hfPj","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"8v8uVsUDt7x","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"obfuscation":"sz1yG9Os2U649wB","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0f3c3fff467e7fb1006991ca2ad7188196a7ad12038cecab96","object":"response","created_at":1771162154,"status":"completed","background":false,"completed_at":1771162155,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0f3c3fff467e7fb1006991ca2b59dc8196a21a153d14cf2718","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9ce5272b7a75786b-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Sun, 15 Feb 2026 13:29:14 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '98' + - '67' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=Fk3T0Em4kjPrthWAqt101MiRpgGqL0p8s3ec_D5yXQs-1771162154.7935753-1.0.1.1-ovWDjEWI54Gm8Buicl65YGp.a0KgJBQna8lb5wfeV3ZJvJrMsmWTg6ekO5uVKAZekw0c_TUcFSF.eXhFuhXHHYlITItdR0xfNbo8qHfRnbqwCWZLXi79wrfHXaYMHCz6; + - __cf_bm=gprbrDpkrav1W_jFKKXc.zxxSHTqomhuiS3uxx3AF1U-1771187142.126042-1.0.1.1-KqsoOqzgPHIsAlG2LgNktRyTgZOSngIzjbqTVcajVAapa3Oxqz342KE6dgKdIHi2d6zfu3Y47xT.tPEYFMEAmajdFqt.FzsZCknltAYnCTgvoH7so0HbWNmPq7gRoHCw; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:14 GMT + 20:55:42 GMT x-request-id: - - req_9246678632f24bb4bf1f950e27ac59a9 + - req_b564b82f23b64d0c9565ebabd1007055 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml index 0158279e61..fea07e3782 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/cassettes/test_responses_stream_no_content_in_experimental_mode.yaml @@ -1,318 +1,4 @@ interactions: -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9cc9b6e01e3a269c-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Thu, 12 Feb 2026 05:33:59 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '22' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=ayG_0CyZVLq9lbzFQvwvzg_80OkXQK7N1eVJFdc7O40-1770874439.6956916-1.0.1.1-LodUqPFwER5h93320fkWLkOrBHslILGMEh1lvQXaNs7QVsZlsApbArqikFWGDZC6zH1TQKI6A5Lsne3hE2wj0ApIRXF9nnPZ3BBteg07xdCt6TQ62oXJ8lDBJlTuUbH8; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:03:59 GMT - - _cfuvid=z9WCwadVt3EqFLoZzpcD.SIaKhXdlqff0LUgTidimCA-1770874439.6956916-1.0.1.1-PkuBOf8YPgTnA98xTY2I1To2UexeflYOEEZIb35ZLXE; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_823863ac300c4eafb13f66f754d69cd4 - status: - code: 401 - message: Unauthorized -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |+ - event: response.created - data: {"type":"response.created","response":{"id":"resp_0dc625f081ef87b700698d66788d9c819ea9a334efeb38545d","object":"response","created_at":1770874488,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} - - event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0dc625f081ef87b700698d66788d9c819ea9a334efeb38545d","object":"response","created_at":1770874488,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} - - event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} - - event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"mZga96nQvMn5","output_index":0,"sequence_number":4} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"9mgw5B2L8poAV","output_index":0,"sequence_number":5} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"nqpSBYWrzykMnN","output_index":0,"sequence_number":6} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"s3amrGjf08N","output_index":0,"sequence_number":7} - - event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"obfuscation":"evuJKRaRhIfi0Dv","output_index":0,"sequence_number":8} - - event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} - - event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} - - event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} - - event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0dc625f081ef87b700698d66788d9c819ea9a334efeb38545d","object":"response","created_at":1770874488,"status":"completed","background":false,"completed_at":1770874488,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0dc625f081ef87b700698d6678d8d0819e8e3264db5cefbf1e","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} - - headers: - CF-RAY: - - 9cc9b8113e308c5d-EWR - Connection: - - keep-alive - Content-Type: - - text/event-stream; charset=utf-8 - Date: - - Thu, 12 Feb 2026 05:34:48 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Transfer-Encoding: - - chunked - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '44' - openai-project: - - proj_s74VWObPgWXRchv2sHdrOTPY - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=GWEApy6PVNN6oliIhk7jYYmau_g1GAhbk8J_dzoGirc-1770874488.5203753-1.0.1.1-ZpOW_.QbDU3jFM5NL4QduhwxP2sVHj_lVTjpQL2jyQ0_zxU5aWJvm6ecLuaPRxP32c0MoFDDLxoZePdEOd0nZgZD9Th3u3svG7vGxqDchFt5Ed0kcqJbuyQgH9izHpNv; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Thu, 12 Feb 2026 - 06:04:48 GMT - x-request-id: - - req_82c37c8b542e4f5fa08328c092d0a151 - status: - code: 200 - message: OK -- request: - body: |- - { - "input": "Say this is a test", - "model": "gpt-4o-mini", - "stream": true - } - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '71' - Content-Type: - - application/json - Host: - - api.openai.com - User-Agent: - - OpenAI/Python 1.109.1 - X-Stainless-Arch: - - arm64 - X-Stainless-Async: - - 'false' - X-Stainless-Lang: - - python - X-Stainless-OS: - - MacOS - X-Stainless-Package-Version: - - 1.109.1 - X-Stainless-Runtime: - - CPython - X-Stainless-Runtime-Version: - - 3.12.12 - authorization: - - Bearer test_openai_api_key - x-stainless-read-timeout: - - '600' - x-stainless-retry-count: - - '0' - method: POST - uri: https://api.openai.com/v1/responses - response: - body: - string: |- - { - "error": { - "message": "Incorrect API key provided: test_ope*******_key. You can find your API key at https://platform.openai.com/account/api-keys.", - "type": "invalid_request_error", - "param": null, - "code": "invalid_api_key" - } - } - headers: - CF-RAY: - - 9ce52663b92528c9-EWR - Connection: - - keep-alive - Content-Length: - - '248' - Content-Type: - - application/json - Date: - - Sun, 15 Feb 2026 13:28:42 GMT - Server: - - cloudflare - Set-Cookie: test_set_cookie - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - X-Content-Type-Options: - - nosniff - alt-svc: - - h3=":443"; ma=86400 - cf-cache-status: - - DYNAMIC - openai-organization: test_openai_org_id - openai-processing-ms: - - '14' - openai-version: - - '2020-10-01' - set-cookie: - - __cf_bm=8zsrkINUnUAzZijN97BU7O_6EQACR0S6gSGdHaA_IU8-1771162122.834196-1.0.1.1-JpPynt2cHRZ64IPwif2rw8GCv9HYPC_EeHNeyBnN1i1p_WATtOJ1DsvPJaGJ8eF7Q5MY.Au1hlh3dMtU3.tna6blxOhJ3b1CPT.60aECr41axmJxtSsaK3GyHDob55BP; - HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:58:42 GMT - - _cfuvid=fN1Clpv9q0muYZDrZ6v8IYTKP1ysUZzrHWErZp8bYI4-1771162122.834196-1.0.1.1-da_MGtsgNI67Qv6sXX5QyewL5B2PEfFovNXT4NnJeaY; - HttpOnly; SameSite=None; Secure; Path=/; Domain=api.openai.com - www-authenticate: - - Bearer realm="OpenAI API" - x-request-id: - - req_fe62255bf4bf4f79b367bb746feb937a - status: - code: 401 - message: Unauthorized - request: body: |- { @@ -361,53 +47,53 @@ interactions: body: string: |+ event: response.created - data: {"type":"response.created","response":{"id":"resp_0551647e47b36f7b006991ca45d82c81968866cd5d612b355c","object":"response","created_at":1771162181,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} + data: {"type":"response.created","response":{"id":"resp_0d0bf9ab3933c9150069922bda0e288195bbafeb5ce2ea8088","object":"response","created_at":1771187162,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":0} event: response.in_progress - data: {"type":"response.in_progress","response":{"id":"resp_0551647e47b36f7b006991ca45d82c81968866cd5d612b355c","object":"response","created_at":1771162181,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} + data: {"type":"response.in_progress","response":{"id":"resp_0d0bf9ab3933c9150069922bda0e288195bbafeb5ce2ea8088","object":"response","created_at":1771187162,"status":"in_progress","background":false,"completed_at":null,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"auto","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":null,"user":null,"metadata":{}},"sequence_number":1} event: response.output_item.added - data: {"type":"response.output_item.added","item":{"id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} + data: {"type":"response.output_item.added","item":{"id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":2} event: response.content_part.added - data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} + data: {"type":"response.content_part.added","content_index":0,"item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":""},"sequence_number":3} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"0hejdXud6rxk","output_index":0,"sequence_number":4} + data: {"type":"response.output_text.delta","content_index":0,"delta":"This","item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","logprobs":[],"obfuscation":"IyMsl8GsHkrL","output_index":0,"sequence_number":4} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"3HfydY288usBU","output_index":0,"sequence_number":5} + data: {"type":"response.output_text.delta","content_index":0,"delta":" is","item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","logprobs":[],"obfuscation":"gyr754u1qsG2v","output_index":0,"sequence_number":5} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"7KsQ0mKOoHQo5I","output_index":0,"sequence_number":6} + data: {"type":"response.output_text.delta","content_index":0,"delta":" a","item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","logprobs":[],"obfuscation":"C4yeYHqSnaRWlr","output_index":0,"sequence_number":6} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"L7LFRx0t2av","output_index":0,"sequence_number":7} + data: {"type":"response.output_text.delta","content_index":0,"delta":" test","item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","logprobs":[],"obfuscation":"Rn0pWLwVUtA","output_index":0,"sequence_number":7} event: response.output_text.delta - data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"obfuscation":"EpARTQvluDMl9HS","output_index":0,"sequence_number":8} + data: {"type":"response.output_text.delta","content_index":0,"delta":".","item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","logprobs":[],"obfuscation":"ppTh2nPXTlzUNGU","output_index":0,"sequence_number":8} event: response.output_text.done - data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} + data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","logprobs":[],"output_index":0,"sequence_number":9,"text":"This is a test."} event: response.content_part.done - data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} + data: {"type":"response.content_part.done","content_index":0,"item_id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","output_index":0,"part":{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."},"sequence_number":10} event: response.output_item.done - data: {"type":"response.output_item.done","item":{"id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} + data: {"type":"response.output_item.done","item":{"id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"},"output_index":0,"sequence_number":11} event: response.completed - data: {"type":"response.completed","response":{"id":"resp_0551647e47b36f7b006991ca45d82c81968866cd5d612b355c","object":"response","created_at":1771162181,"status":"completed","background":false,"completed_at":1771162182,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0551647e47b36f7b006991ca46101c81969ee04d97abd805a9","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} + data: {"type":"response.completed","response":{"id":"resp_0d0bf9ab3933c9150069922bda0e288195bbafeb5ce2ea8088","object":"response","created_at":1771187162,"status":"completed","background":false,"completed_at":1771187162,"error":null,"frequency_penalty":0.0,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"max_tool_calls":null,"model":"gpt-4o-mini-2024-07-18","output":[{"id":"msg_0d0bf9ab3933c9150069922bda71a08195b4df58b1e20fdc98","type":"message","status":"completed","content":[{"type":"output_text","annotations":[],"logprobs":[],"text":"This is a test."}],"role":"assistant"}],"parallel_tool_calls":true,"presence_penalty":0.0,"previous_response_id":null,"prompt_cache_key":null,"prompt_cache_retention":null,"reasoning":{"effort":null,"summary":null},"safety_identifier":null,"service_tier":"default","store":true,"temperature":1.0,"text":{"format":{"type":"text"},"verbosity":"medium"},"tool_choice":"auto","tools":[],"top_logprobs":0,"top_p":1.0,"truncation":"disabled","usage":{"input_tokens":12,"input_tokens_details":{"cached_tokens":0},"output_tokens":6,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":18},"user":null,"metadata":{}},"sequence_number":12} headers: CF-RAY: - - 9ce527d44e37d481-EWR + - 9ce789b28811ff90-EWR Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Sun, 15 Feb 2026 13:29:41 GMT + - Sun, 15 Feb 2026 20:26:02 GMT Server: - cloudflare Set-Cookie: test_set_cookie @@ -423,17 +109,17 @@ interactions: - DYNAMIC openai-organization: test_openai_org_id openai-processing-ms: - - '57' + - '60' openai-project: - proj_s74VWObPgWXRchv2sHdrOTPY openai-version: - '2020-10-01' set-cookie: - - __cf_bm=7gC6oIZ6fwb.PkITmn74.6mqLUjJoeqn1cNzridzlsU-1771162181.8053312-1.0.1.1-qyoOomZo5GSxbEeoHoo0uLi0HPPvV4h_50W_WXymzoy6.1YDsclMCOBXSaKdSmn8Bh_QGq7izJySVjjjVbMJK0dKsTA.y8AIEMEVVrrHFGo3GSuWy2b4pcOZ6I_hzJQe; + - __cf_bm=svni1d7N3CcpY.MpZlrBKQn37WctprZzy83bIKNQlko-1771187162.0063605-1.0.1.1-csAUtbhSTxJhgnNgMj.9t.yPCxHiikbnbbtOlX73dpBAL75xAH.jOlTy9rnq7hG.IXzSq6kUlblOXHY_MTPfmNtr46EYs7YQU752tZfg8.tfAgwrUotYEMi92YWF35Zb; HttpOnly; Secure; Path=/; Domain=api.openai.com; Expires=Sun, 15 Feb 2026 - 13:59:41 GMT + 20:56:02 GMT x-request-id: - - req_0a12e1e0030f4d3fbd46b214cd85d7a8 + - req_fba03afcdf48405db7eac80728b064f4 status: code: 200 message: OK diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index b6ac6f4f21..e1f04402fc 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -293,7 +293,7 @@ def test_responses_retrieve_stream_existing_response( @skip_if_no_responses_api -@pytest.mark.vcr("test_responses_create.yaml") +@pytest.mark.vcr("test_responses_create_captures_content.yaml") def test_responses_create_captures_content( span_exporter, openai_client, instrument_with_experimental_content ): @@ -329,7 +329,7 @@ def test_responses_create_captures_content( @skip_if_no_responses_api -@pytest.mark.vcr("test_responses_stream_new_response.yaml") +@pytest.mark.vcr("test_responses_stream_captures_content.yaml") def test_responses_stream_captures_content( span_exporter, openai_client, instrument_with_experimental_content ): @@ -360,7 +360,7 @@ def test_responses_stream_captures_content( @skip_if_no_responses_api -@pytest.mark.vcr("test_responses_create.yaml") +@pytest.mark.vcr("test_responses_create_no_content_in_experimental_mode.yaml") def test_responses_create_no_content_in_experimental_mode( span_exporter, openai_client, instrument_with_experimental_no_content ): @@ -387,7 +387,7 @@ def test_responses_create_no_content_in_experimental_mode( @skip_if_no_responses_api -@pytest.mark.vcr("test_responses_create.yaml") +@pytest.mark.vcr("test_responses_create_captures_system_instruction.yaml") def test_responses_create_captures_system_instruction( span_exporter, openai_client, instrument_with_experimental_content ): @@ -415,7 +415,7 @@ def test_responses_create_captures_system_instruction( @skip_if_no_responses_api -@pytest.mark.vcr("test_responses_stream_new_response.yaml") +@pytest.mark.vcr("test_responses_stream_no_content_in_experimental_mode.yaml") def test_responses_stream_no_content_in_experimental_mode( span_exporter, openai_client, instrument_with_experimental_no_content ): From bc1a6047de6120ba9f85374e13b4193b23af9ffd Mon Sep 17 00:00:00 2001 From: Teja Date: Sun, 15 Feb 2026 18:14:40 -0500 Subject: [PATCH 17/20] Update OpenAI instrumentation to enhance dependency management and improve optional feature handling. --- .../instrumentation/openai_v2/__init__.py | 27 ++- .../openai_v2/patch_responses.py | 175 ++++++------------ .../instrumentation/openai_v2/utils.py | 16 +- .../tests/test_responses.py | 88 +-------- uv.lock | 4 +- 5 files changed, 91 insertions(+), 219 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index bb1e9a36a5..2582bbce09 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -53,6 +53,13 @@ from opentelemetry.semconv.schemas import Schemas from opentelemetry.trace import get_tracer +try: + from opentelemetry.util.genai.handler import TelemetryHandler +except ( + ModuleNotFoundError +): # pragma: no cover - optional dependency at import-time + TelemetryHandler = None # type: ignore[assignment,misc] + from .instruments import Instruments from .patch import ( async_chat_completions_create, @@ -60,7 +67,7 @@ chat_completions_create, embeddings_create, ) -from .patch_responses import responses_create, responses_retrieve +from .patch_responses import responses_create class OpenAIInstrumentor(BaseInstrumentor): @@ -117,9 +124,7 @@ def _instrument(self, **kwargs): wrap_function_wrapper( module="openai.resources.embeddings", name="Embeddings.create", - wrapper=embeddings_create( - tracer, instruments, capture_content - ), + wrapper=embeddings_create(tracer, instruments, capture_content), ) wrap_function_wrapper( @@ -133,9 +138,10 @@ def _instrument(self, **kwargs): # Responses API is only available in openai>=1.66.0 # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 try: - from opentelemetry.util.genai.handler import ( # pylint: disable=import-outside-toplevel - TelemetryHandler, - ) + if TelemetryHandler is None: + raise ModuleNotFoundError( + "opentelemetry.util.genai.handler is unavailable" + ) handler = TelemetryHandler( tracer_provider=tracer_provider, @@ -148,12 +154,6 @@ def _instrument(self, **kwargs): name="Responses.create", wrapper=responses_create(handler, capture_content), ) - - wrap_function_wrapper( - module="openai.resources.responses.responses", - name="Responses.retrieve", - wrapper=responses_retrieve(handler, capture_content), - ) except (AttributeError, ModuleNotFoundError): # Responses API or TelemetryHandler not available pass @@ -170,7 +170,6 @@ def _uninstrument(self, **kwargs): # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 try: unwrap(openai.resources.responses.responses.Responses, "create") - unwrap(openai.resources.responses.responses.Responses, "retrieve") except (AttributeError, ModuleNotFoundError): # Responses API not available in this version of openai pass diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index 31c126861c..cc60b2c10a 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -18,24 +18,34 @@ gen_ai_attributes as GenAIAttributes, ) -if TYPE_CHECKING: - from opentelemetry.util.genai.handler import TelemetryHandler - from opentelemetry.util.genai.types import LLMInvocation +try: + from opentelemetry.util.genai.types import ( + Error, + InputMessage, + LLMInvocation, + OutputMessage, + Text, + ) +except ( + ModuleNotFoundError +): # pragma: no cover - optional dependency at import-time + Error = InputMessage = LLMInvocation = OutputMessage = Text = None # type: ignore[assignment,misc] from .utils import ( get_llm_request_attributes, is_streaming, ) +if TYPE_CHECKING: + from opentelemetry.util.genai.handler import TelemetryHandler + OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value def _extract_system_instruction(kwargs: dict): """Extract system instruction from the ``instructions`` parameter.""" - from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel - Text, - ) - + if Text is None: + return [] instructions = kwargs.get("instructions") if instructions is None: return [] @@ -51,11 +61,8 @@ def _extract_input_messages(kwargs: dict): - A string (simple text input) - A list of message items (with role and content) """ - from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel - InputMessage, - Text, - ) - + if InputMessage is None or Text is None: + return [] raw_input = kwargs.get("input") if raw_input is None: return [] @@ -97,11 +104,8 @@ def _extract_output_messages(result: Any): The response ``output`` field is a list of output items. Items with type ``"message"`` contain content blocks (output_text, refusal, etc.). """ - from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel - OutputMessage, - Text, - ) - + if OutputMessage is None or Text is None: + return [] if result is None: return [] @@ -111,26 +115,14 @@ def _extract_output_messages(result: Any): messages = [] for item in output_items: - item_type = getattr(item, "type", None) - if item_type != "message": + if getattr(item, "type", None) != "message": continue role = getattr(item, "role", "assistant") - status = getattr(item, "status", None) - finish_reason = "stop" if status == "completed" else (status or "stop") - - content_blocks = getattr(item, "content", []) - parts = [] - for block in content_blocks: - block_type = getattr(block, "type", None) - if block_type == "output_text": - text = getattr(block, "text", None) - if text: - parts.append(Text(content=text)) - elif block_type == "refusal": - refusal = getattr(block, "refusal", None) - if refusal: - parts.append(Text(content=refusal)) + finish_reason = _finish_reason_from_status( + getattr(item, "status", None) + ) + parts = _extract_output_parts(getattr(item, "content", []), Text) messages.append( OutputMessage(role=role, parts=parts, finish_reason=finish_reason) @@ -139,6 +131,25 @@ def _extract_output_messages(result: Any): return messages +def _finish_reason_from_status(status): + return "stop" if status == "completed" else (status or "stop") + + +def _extract_output_parts(content_blocks, text_type): + parts = [] + for block in content_blocks: + block_type = getattr(block, "type", None) + if block_type == "output_text": + text = getattr(block, "text", None) + if text: + parts.append(text_type(content=text)) + elif block_type == "refusal": + refusal = getattr(block, "refusal", None) + if refusal: + parts.append(text_type(content=refusal)) + return parts + + # --------------------------------------------------------------------------- # Patch functions # --------------------------------------------------------------------------- @@ -152,14 +163,12 @@ def responses_create( # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L828 def traced_method(wrapped, instance, args, kwargs): - from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel - Error, - LLMInvocation, - ) + if Error is None or LLMInvocation is None: + raise ModuleNotFoundError( + "opentelemetry.util.genai.types is unavailable" + ) - operation_name = ( - GenAIAttributes.GenAiOperationNameValues.CHAT.value - ) + operation_name = GenAIAttributes.GenAiOperationNameValues.CHAT.value span_attributes = get_llm_request_attributes( kwargs, instance, @@ -219,76 +228,6 @@ def traced_method(wrapped, instance, args, kwargs): return traced_method -def responses_retrieve( - handler: "TelemetryHandler", - capture_content: bool, -): - """Wrap the `retrieve` method of the `Responses` class to trace it.""" - # https://github.com/openai/openai-python/blob/dc68b90655912886bd7a6c7787f96005452ebfc9/src/openai/resources/responses/responses.py#L1417C9-L1417C17 - retrieval_enum = getattr( - GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None - ) - operation_name = retrieval_enum.value if retrieval_enum else "retrieval" - - def traced_method(wrapped, instance, args, kwargs): - from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel - Error, - LLMInvocation, - ) - - span_attributes = get_llm_request_attributes( - {}, - instance, - operation_name, - ) - request_model = str( - span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL) - or "unknown" - ) - streaming = is_streaming(kwargs) - - invocation = handler.start_llm( - LLMInvocation( - request_model=request_model, - operation_name=operation_name, - provider=OPENAI, - attributes=span_attributes.copy(), - metric_attributes={ - GenAIAttributes.GEN_AI_OPERATION_NAME: operation_name - }, - ) - ) - - try: - result = wrapped(*args, **kwargs) - if hasattr(result, "parse"): - parsed_result = result.parse() - else: - parsed_result = result - - if streaming: - return ResponseStreamWrapper( - parsed_result, - handler, - invocation, - capture_content, - ) - - _set_invocation_response_attributes( - invocation, parsed_result, capture_content - ) - handler.stop_llm(invocation) - return result - - except Exception as error: - handler.fail_llm( - invocation, Error(message=str(error), type=type(error)) - ) - raise - - return traced_method - - # --------------------------------------------------------------------------- # Response attribute extraction # --------------------------------------------------------------------------- @@ -303,8 +242,7 @@ def _set_invocation_response_attributes( return if getattr(result, "model", None) and ( - not invocation.request_model - or invocation.request_model == "unknown" + not invocation.request_model or invocation.request_model == "unknown" ): invocation.request_model = result.model @@ -378,7 +316,9 @@ def __enter__(self): def __exit__(self, exc_type, exc_val, exc_tb): try: if exc_type is not None: - self._fail(str(exc_val), type(exc_val) if exc_val else Exception) + self._fail( + str(exc_val), type(exc_val) if exc_val else Exception + ) finally: self.close() return False @@ -440,9 +380,10 @@ def _stop(self, result: Any): def _fail(self, message: str, error_type: type[BaseException]): if self._finalized: return - from opentelemetry.util.genai.types import ( # pylint: disable=import-outside-toplevel - Error, - ) + if Error is None: + raise ModuleNotFoundError( + "opentelemetry.util.genai.types is unavailable" + ) self.handler.fail_llm( self.invocation, Error(message=message, type=error_type) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index bf433645c4..c2774c4dc5 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -33,6 +33,13 @@ ) from opentelemetry.trace.status import Status, StatusCode +try: + from opentelemetry.util.genai.utils import should_capture_content +except ( + ModuleNotFoundError +): # pragma: no cover - optional dependency at import-time + should_capture_content = None # type: ignore[assignment,misc] + OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = ( "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT" ) @@ -47,14 +54,9 @@ def is_content_enabled() -> bool: ) legacy_enabled = capture_content.lower() == "true" - try: - from opentelemetry.util.genai.utils import ( # pylint: disable=import-outside-toplevel - should_capture_content, - ) - - return legacy_enabled or should_capture_content() - except ModuleNotFoundError: + if should_capture_content is None: return legacy_enabled + return legacy_enabled or should_capture_content() def extract_tool_calls(item, capture_content): diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index e1f04402fc..c14d5806f1 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -34,6 +34,7 @@ def _load_span_messages(span, attribute): assert isinstance(parsed, list), f"Expected {attribute} to be a JSON list" return parsed + # The Responses API was introduced in openai>=1.66.0 # https://github.com/openai/openai-python/blob/main/CHANGELOG.md#1660-2025-03-11 OPENAI_VERSION = Version(openai.__version__) @@ -149,35 +150,7 @@ def test_responses_stream_existing_response( assert final_response is not None spans = span_exporter.get_finished_spans() - assert len(spans) == span_count + 1 - - retrieve_spans = spans[span_count:] - retrieval_operation = getattr( - GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None - ) - retrieval_operation_name = ( - retrieval_operation.value - if retrieval_operation is not None - else "retrieval" - ) - assert { - span.attributes.get(GenAIAttributes.GEN_AI_OPERATION_NAME) - for span in retrieve_spans - } == { - retrieval_operation_name, - } - retrieve_span = retrieve_spans[0] - - assert_all_attributes( - retrieve_span, - final_response.model, - final_response.id, - final_response.model, - final_response.usage.input_tokens if final_response.usage else None, - final_response.usage.output_tokens if final_response.usage else None, - operation_name=retrieval_operation_name, - response_service_tier=final_response.service_tier, - ) + assert len(spans) == span_count @skip_if_no_responses_api @@ -195,29 +168,8 @@ def test_responses_retrieve( response = openai_client.responses.retrieve(create_response.id) spans = span_exporter.get_finished_spans() - assert len(spans) == span_count + 1 - - input_tokens = response.usage.input_tokens if response.usage else None - output_tokens = response.usage.output_tokens if response.usage else None - retrieval_operation = getattr( - GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None - ) - operation_name = ( - retrieval_operation.value - if retrieval_operation is not None - else "retrieval" - ) - - assert_all_attributes( - spans[-1], - response.model, - response.id, - response.model, - input_tokens, - output_tokens, - operation_name=operation_name, - response_service_tier=response.service_tier, - ) + assert len(spans) == span_count + assert response.id == create_response.id @skip_if_no_responses_api @@ -258,33 +210,7 @@ def test_responses_retrieve_stream_existing_response( assert final_response is not None spans = span_exporter.get_finished_spans() - assert len(spans) == span_count + 1 - - input_tokens = ( - final_response.usage.input_tokens if final_response.usage else None - ) - output_tokens = ( - final_response.usage.output_tokens if final_response.usage else None - ) - retrieval_operation = getattr( - GenAIAttributes.GenAiOperationNameValues, "RETRIEVAL", None - ) - operation_name = ( - retrieval_operation.value - if retrieval_operation is not None - else "retrieval" - ) - - assert_all_attributes( - spans[-1], - final_response.model, - final_response.id, - final_response.model, - input_tokens, - output_tokens, - operation_name=operation_name, - response_service_tier=final_response.service_tier, - ) + assert len(spans) == span_count # ============================================================================= @@ -380,7 +306,9 @@ def test_responses_create_no_content_in_experimental_mode( assert GenAIAttributes.GEN_AI_OUTPUT_MESSAGES not in span.attributes # Basic span attributes should still be present - assert span.attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] == "gpt-4o-mini" + assert ( + span.attributes[GenAIAttributes.GEN_AI_REQUEST_MODEL] == "gpt-4o-mini" + ) assert GenAIAttributes.GEN_AI_RESPONSE_MODEL in span.attributes assert GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS in span.attributes assert GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS in span.attributes diff --git a/uv.lock b/uv.lock index 34a865d9f8..63f6c2c49f 100644 --- a/uv.lock +++ b/uv.lock @@ -1562,7 +1562,7 @@ name = "exceptiongroup" version = "1.3.1" source = { registry = "https://pypi.org/simple/" } dependencies = [ - { name = "typing-extensions", marker = "python_full_version < '3.13'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371, upload-time = "2025-11-21T23:01:54.787Z" } wheels = [ @@ -4403,6 +4403,7 @@ dependencies = [ { name = "opentelemetry-api" }, { name = "opentelemetry-instrumentation" }, { name = "opentelemetry-semantic-conventions" }, + { name = "opentelemetry-util-genai" }, ] [package.optional-dependencies] @@ -4416,6 +4417,7 @@ requires-dist = [ { name = "opentelemetry-api", git = "https://github.com/open-telemetry/opentelemetry-python?subdirectory=opentelemetry-api&branch=main" }, { name = "opentelemetry-instrumentation", editable = "opentelemetry-instrumentation" }, { name = "opentelemetry-semantic-conventions", git = "https://github.com/open-telemetry/opentelemetry-python?subdirectory=opentelemetry-semantic-conventions&branch=main" }, + { name = "opentelemetry-util-genai", editable = "util/opentelemetry-util-genai" }, ] provides-extras = ["instruments"] From 0d779138c89e34687bba757160afba9c4585de05 Mon Sep 17 00:00:00 2001 From: Teja Date: Sun, 15 Feb 2026 21:29:25 -0500 Subject: [PATCH 18/20] Enhance OpenAI response handling by adding new extraction and attribute-setting functions. --- .../openai_v2/patch_responses.py | 124 +++++++++++++++--- .../tests/test_responses.py | 34 +++++ 2 files changed, 142 insertions(+), 16 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index cc60b2c10a..5e44fce37e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Mapping, Optional from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, @@ -40,6 +40,10 @@ from opentelemetry.util.genai.handler import TelemetryHandler OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value +GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read.input_tokens" +GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = ( + "gen_ai.usage.cache_creation.input_tokens" +) def _extract_system_instruction(kwargs: dict): @@ -150,6 +154,86 @@ def _extract_output_parts(content_blocks, text_type): return parts +def _extract_finish_reasons(result: Any) -> list[str]: + """Extract finish reasons from Responses API output items.""" + output_items = getattr(result, "output", None) + if not output_items: + return [] + + finish_reasons = [] + for item in output_items: + if getattr(item, "type", None) != "message": + continue + finish_reasons.append( + _finish_reason_from_status(getattr(item, "status", None)) + ) + return finish_reasons + + +def _extract_output_type(kwargs: dict) -> Optional[str]: + """Extract output type from Responses API request text.format.""" + text_config = kwargs.get("text") + if not isinstance(text_config, Mapping): + return None + + format_config = text_config.get("format") + if isinstance(format_config, Mapping): + format_type = format_config.get("type") + else: + format_type = None + + if format_type == "json_schema": + return "json" + return format_type + + +def _get_field(obj: Any, key: str): + if isinstance(obj, Mapping): + return obj.get(key) + return getattr(obj, key, None) + + +def _set_optional_attribute( + invocation: "LLMInvocation", + result: Any, + source_name: str, + target_name: str, +): + value = getattr(result, source_name, None) + if value is not None: + invocation.attributes[target_name] = value + + +def _set_invocation_usage_attributes(invocation: "LLMInvocation", usage: Any): + input_tokens = _get_field(usage, "input_tokens") + if input_tokens is None: + input_tokens = _get_field(usage, "prompt_tokens") + invocation.input_tokens = input_tokens + + output_tokens = _get_field(usage, "output_tokens") + if output_tokens is None: + output_tokens = _get_field(usage, "completion_tokens") + invocation.output_tokens = output_tokens + + input_token_details = _get_field(usage, "input_tokens_details") + if input_token_details is None: + input_token_details = _get_field(usage, "prompt_tokens_details") + + cache_read_tokens = _get_field(input_token_details, "cached_tokens") + if cache_read_tokens is not None: + invocation.attributes[GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS] = ( + cache_read_tokens + ) + + cache_creation_tokens = _get_field( + input_token_details, "cache_creation_input_tokens" + ) + if cache_creation_tokens is not None: + invocation.attributes[GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS] = ( + cache_creation_tokens + ) + + # --------------------------------------------------------------------------- # Patch functions # --------------------------------------------------------------------------- @@ -174,6 +258,9 @@ def traced_method(wrapped, instance, args, kwargs): instance, operation_name, ) + output_type = _extract_output_type(kwargs) + if output_type: + span_attributes[GenAIAttributes.GEN_AI_OUTPUT_TYPE] = output_type request_model = str( span_attributes.get(GenAIAttributes.GEN_AI_REQUEST_MODEL) or "unknown" @@ -252,21 +339,26 @@ def _set_invocation_response_attributes( if getattr(result, "id", None): invocation.response_id = result.id - if getattr(result, "service_tier", None): - invocation.attributes[ - GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER - ] = result.service_tier - - if getattr(result, "usage", None): - input_tokens = getattr(result.usage, "input_tokens", None) - if input_tokens is None: - input_tokens = getattr(result.usage, "prompt_tokens", None) - invocation.input_tokens = input_tokens - - output_tokens = getattr(result.usage, "output_tokens", None) - if output_tokens is None: - output_tokens = getattr(result.usage, "completion_tokens", None) - invocation.output_tokens = output_tokens + _set_optional_attribute( + invocation, + result, + "service_tier", + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, + ) + _set_optional_attribute( + invocation, + result, + "system_fingerprint", + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT, + ) + + usage = getattr(result, "usage", None) + if usage: + _set_invocation_usage_attributes(invocation, usage) + + finish_reasons = _extract_finish_reasons(result) + if finish_reasons: + invocation.finish_reasons = finish_reasons if capture_content: output_messages = _extract_output_messages(result) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py index c14d5806f1..f82c3de958 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/test_responses.py @@ -13,14 +13,21 @@ # limitations under the License. import json +from types import SimpleNamespace import openai import pytest from packaging.version import Version +from opentelemetry.instrumentation.openai_v2.patch_responses import ( + GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS, + GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS, + _set_invocation_response_attributes, +) from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, ) +from opentelemetry.util.genai.types import LLMInvocation from .test_utils import assert_all_attributes @@ -367,3 +374,30 @@ def test_responses_stream_no_content_in_experimental_mode( # Basic span attributes should still be present assert GenAIAttributes.GEN_AI_RESPONSE_MODEL in span.attributes assert GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS in span.attributes + + +def test_set_invocation_response_attributes_sets_cache_token_attributes(): + invocation = LLMInvocation() + usage = SimpleNamespace( + input_tokens=12, + output_tokens=6, + input_tokens_details=SimpleNamespace( + cached_tokens=3, + cache_creation_input_tokens=2, + ), + ) + result = SimpleNamespace( + usage=usage, + output=[ + SimpleNamespace(type="message", status="completed"), + ], + ) + + _set_invocation_response_attributes( + invocation=invocation, + result=result, + capture_content=False, + ) + + assert invocation.attributes[GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS] == 3 + assert invocation.attributes[GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS] == 2 From a8c5f43044845c7de1072abec71a41a3b6eee294 Mon Sep 17 00:00:00 2001 From: Teja Date: Mon, 16 Feb 2026 08:29:23 -0500 Subject: [PATCH 19/20] Refactor OpenAI response handling by modularizing extraction and response wrapper functionalities. --- .../openai_v2/patch_responses.py | 424 +----------------- .../openai_v2/response_extractors.py | 262 +++++++++++ .../openai_v2/response_wrappers.py | 169 +++++++ 3 files changed, 451 insertions(+), 404 deletions(-) create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py create mode 100644 instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index 5e44fce37e..649816330e 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -12,227 +12,40 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING, Any, Mapping, Optional +from typing import TYPE_CHECKING from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, ) try: - from opentelemetry.util.genai.types import ( - Error, - InputMessage, - LLMInvocation, - OutputMessage, - Text, - ) + from opentelemetry.util.genai.types import Error, LLMInvocation except ( ModuleNotFoundError ): # pragma: no cover - optional dependency at import-time - Error = InputMessage = LLMInvocation = OutputMessage = Text = None # type: ignore[assignment,misc] - -from .utils import ( - get_llm_request_attributes, - is_streaming, + Error = LLMInvocation = None # type: ignore[assignment,misc] + +from .response_extractors import ( + GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS, + GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS, + OPENAI, + _extract_input_messages, + _extract_output_type, + _extract_system_instruction, + _set_invocation_response_attributes, ) +from .response_wrappers import ResponseStreamWrapper +from .utils import get_llm_request_attributes, is_streaming if TYPE_CHECKING: from opentelemetry.util.genai.handler import TelemetryHandler -OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value -GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read.input_tokens" -GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = ( - "gen_ai.usage.cache_creation.input_tokens" -) - - -def _extract_system_instruction(kwargs: dict): - """Extract system instruction from the ``instructions`` parameter.""" - if Text is None: - return [] - instructions = kwargs.get("instructions") - if instructions is None: - return [] - if isinstance(instructions, str): - return [Text(content=instructions)] - return [] - - -def _extract_input_messages(kwargs: dict): - """Extract input messages from Responses API kwargs. - - The Responses API ``input`` parameter can be: - - A string (simple text input) - - A list of message items (with role and content) - """ - if InputMessage is None or Text is None: - return [] - raw_input = kwargs.get("input") - if raw_input is None: - return [] - - if isinstance(raw_input, str): - return [InputMessage(role="user", parts=[Text(content=raw_input)])] - - messages = [] - if isinstance(raw_input, list): - for item in raw_input: - role = getattr(item, "role", None) or ( - item.get("role") if isinstance(item, dict) else None - ) - if not role: - continue - content = getattr(item, "content", None) or ( - item.get("content") if isinstance(item, dict) else None - ) - if isinstance(content, str): - messages.append( - InputMessage(role=role, parts=[Text(content=content)]) - ) - elif isinstance(content, list): - parts = [] - for part in content: - text = getattr(part, "text", None) or ( - part.get("text") if isinstance(part, dict) else None - ) - if text: - parts.append(Text(content=text)) - if parts: - messages.append(InputMessage(role=role, parts=parts)) - return messages - - -def _extract_output_messages(result: Any): - """Extract output messages from a Responses API result. - - The response ``output`` field is a list of output items. Items with - type ``"message"`` contain content blocks (output_text, refusal, etc.). - """ - if OutputMessage is None or Text is None: - return [] - if result is None: - return [] - - output_items = getattr(result, "output", None) - if not output_items: - return [] - - messages = [] - for item in output_items: - if getattr(item, "type", None) != "message": - continue - - role = getattr(item, "role", "assistant") - finish_reason = _finish_reason_from_status( - getattr(item, "status", None) - ) - parts = _extract_output_parts(getattr(item, "content", []), Text) - - messages.append( - OutputMessage(role=role, parts=parts, finish_reason=finish_reason) - ) - - return messages - - -def _finish_reason_from_status(status): - return "stop" if status == "completed" else (status or "stop") - - -def _extract_output_parts(content_blocks, text_type): - parts = [] - for block in content_blocks: - block_type = getattr(block, "type", None) - if block_type == "output_text": - text = getattr(block, "text", None) - if text: - parts.append(text_type(content=text)) - elif block_type == "refusal": - refusal = getattr(block, "refusal", None) - if refusal: - parts.append(text_type(content=refusal)) - return parts - - -def _extract_finish_reasons(result: Any) -> list[str]: - """Extract finish reasons from Responses API output items.""" - output_items = getattr(result, "output", None) - if not output_items: - return [] - - finish_reasons = [] - for item in output_items: - if getattr(item, "type", None) != "message": - continue - finish_reasons.append( - _finish_reason_from_status(getattr(item, "status", None)) - ) - return finish_reasons - - -def _extract_output_type(kwargs: dict) -> Optional[str]: - """Extract output type from Responses API request text.format.""" - text_config = kwargs.get("text") - if not isinstance(text_config, Mapping): - return None - - format_config = text_config.get("format") - if isinstance(format_config, Mapping): - format_type = format_config.get("type") - else: - format_type = None - - if format_type == "json_schema": - return "json" - return format_type - - -def _get_field(obj: Any, key: str): - if isinstance(obj, Mapping): - return obj.get(key) - return getattr(obj, key, None) - - -def _set_optional_attribute( - invocation: "LLMInvocation", - result: Any, - source_name: str, - target_name: str, -): - value = getattr(result, source_name, None) - if value is not None: - invocation.attributes[target_name] = value - - -def _set_invocation_usage_attributes(invocation: "LLMInvocation", usage: Any): - input_tokens = _get_field(usage, "input_tokens") - if input_tokens is None: - input_tokens = _get_field(usage, "prompt_tokens") - invocation.input_tokens = input_tokens - - output_tokens = _get_field(usage, "output_tokens") - if output_tokens is None: - output_tokens = _get_field(usage, "completion_tokens") - invocation.output_tokens = output_tokens - - input_token_details = _get_field(usage, "input_tokens_details") - if input_token_details is None: - input_token_details = _get_field(usage, "prompt_tokens_details") - - cache_read_tokens = _get_field(input_token_details, "cached_tokens") - if cache_read_tokens is not None: - invocation.attributes[GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS] = ( - cache_read_tokens - ) - - cache_creation_tokens = _get_field( - input_token_details, "cache_creation_input_tokens" - ) - if cache_creation_tokens is not None: - invocation.attributes[GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS] = ( - cache_creation_tokens - ) - +__all__ = [ + "responses_create", + "_set_invocation_response_attributes", + "GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS", + "GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS", +] # --------------------------------------------------------------------------- # Patch functions @@ -313,200 +126,3 @@ def traced_method(wrapped, instance, args, kwargs): raise return traced_method - - -# --------------------------------------------------------------------------- -# Response attribute extraction -# --------------------------------------------------------------------------- - - -def _set_invocation_response_attributes( - invocation: "LLMInvocation", - result: Any, - capture_content: bool, -): - if result is None: - return - - if getattr(result, "model", None) and ( - not invocation.request_model or invocation.request_model == "unknown" - ): - invocation.request_model = result.model - - if getattr(result, "model", None): - invocation.response_model_name = result.model - - if getattr(result, "id", None): - invocation.response_id = result.id - - _set_optional_attribute( - invocation, - result, - "service_tier", - GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, - ) - _set_optional_attribute( - invocation, - result, - "system_fingerprint", - GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT, - ) - - usage = getattr(result, "usage", None) - if usage: - _set_invocation_usage_attributes(invocation, usage) - - finish_reasons = _extract_finish_reasons(result) - if finish_reasons: - invocation.finish_reasons = finish_reasons - - if capture_content: - output_messages = _extract_output_messages(result) - if output_messages: - invocation.output_messages = output_messages - - -# --------------------------------------------------------------------------- -# Stream wrappers -# --------------------------------------------------------------------------- - - -class _ResponseProxy: - def __init__(self, response, finalize): - self._response = response - self._finalize = finalize - - def close(self): - try: - self._response.close() - finally: - self._finalize(None) - - def __getattr__(self, name): - return getattr(self._response, name) - - -class ResponseStreamWrapper: - """Wrapper for OpenAI Responses API streams using TelemetryHandler.""" - - def __init__( - self, - stream: Any, - handler: "TelemetryHandler", - invocation: "LLMInvocation", - capture_content: bool, - ): - self.stream = stream - self.handler = handler - self.invocation = invocation - self._capture_content = capture_content - self._finalized = False - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - try: - if exc_type is not None: - self._fail( - str(exc_val), type(exc_val) if exc_val else Exception - ) - finally: - self.close() - return False - - def close(self): - if hasattr(self.stream, "close"): - self.stream.close() - self._stop(None) - - def __iter__(self): - return self - - def __next__(self): - try: - event = next(self.stream) - self.process_event(event) - return event - except StopIteration: - self._stop(None) - raise - except Exception as error: - self._fail(str(error), type(error)) - raise - - def get_final_response(self): - if not hasattr(self.stream, "get_final_response"): - raise AttributeError("get_final_response is not available") - self.until_done() - return self.stream.get_final_response() - - def until_done(self): - for _ in self: - pass - return self - - def parse(self): - """Called when using with_raw_response with stream=True""" - return self - - def __getattr__(self, name): - return getattr(self.stream, name) - - @property - def response(self): - response = getattr(self.stream, "response", None) - if response is None: - return None - return _ResponseProxy(response, lambda *_: self._stop(None)) - - def _stop(self, result: Any): - if self._finalized: - return - _set_invocation_response_attributes( - self.invocation, result, self._capture_content - ) - self.handler.stop_llm(self.invocation) - self._finalized = True - - def _fail(self, message: str, error_type: type[BaseException]): - if self._finalized: - return - if Error is None: - raise ModuleNotFoundError( - "opentelemetry.util.genai.types is unavailable" - ) - - self.handler.fail_llm( - self.invocation, Error(message=message, type=error_type) - ) - self._finalized = True - - def process_event(self, event): - event_type = getattr(event, "type", None) - response = getattr(event, "response", None) - - if response and ( - not self.invocation.request_model - or self.invocation.request_model == "unknown" - ): - model = getattr(response, "model", None) - if model: - self.invocation.request_model = model - - if event_type == "response.completed": - self._stop(response) - return - - if event_type in {"response.failed", "response.incomplete"}: - _set_invocation_response_attributes( - self.invocation, response, self._capture_content - ) - self._fail(event_type, RuntimeError) - return - - if event_type == "error": - error_type = getattr(event, "code", None) or "response.error" - message = getattr(event, "message", None) or error_type - self._fail(message, RuntimeError) - return diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py new file mode 100644 index 0000000000..0ada4f7c20 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py @@ -0,0 +1,262 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Any, Mapping, Optional + +from opentelemetry.semconv._incubating.attributes import ( + gen_ai_attributes as GenAIAttributes, +) + +try: + from opentelemetry.util.genai.types import ( + InputMessage, + LLMInvocation, + OutputMessage, + Text, + ) +except ( + ModuleNotFoundError +): # pragma: no cover - optional dependency at import-time + InputMessage = LLMInvocation = OutputMessage = Text = None # type: ignore[assignment,misc] + +OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value +GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read.input_tokens" +GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS = ( + "gen_ai.usage.cache_creation.input_tokens" +) + + +def _extract_system_instruction(kwargs: dict): + """Extract system instruction from the ``instructions`` parameter.""" + if Text is None: + return [] + instructions = kwargs.get("instructions") + if instructions is None: + return [] + if isinstance(instructions, str): + return [Text(content=instructions)] + return [] + + +def _extract_input_messages(kwargs: dict): + """Extract input messages from Responses API kwargs.""" + if InputMessage is None or Text is None: + return [] + raw_input = kwargs.get("input") + if raw_input is None: + return [] + + if isinstance(raw_input, str): + return [InputMessage(role="user", parts=[Text(content=raw_input)])] + + messages = [] + if isinstance(raw_input, list): + for item in raw_input: + role = getattr(item, "role", None) or ( + item.get("role") if isinstance(item, dict) else None + ) + if not role: + continue + content = getattr(item, "content", None) or ( + item.get("content") if isinstance(item, dict) else None + ) + if isinstance(content, str): + messages.append( + InputMessage(role=role, parts=[Text(content=content)]) + ) + elif isinstance(content, list): + parts = [] + for part in content: + text = getattr(part, "text", None) or ( + part.get("text") if isinstance(part, dict) else None + ) + if text: + parts.append(Text(content=text)) + if parts: + messages.append(InputMessage(role=role, parts=parts)) + return messages + + +def _extract_output_messages(result: Any): + """Extract output messages from a Responses API result.""" + if OutputMessage is None or Text is None: + return [] + if result is None: + return [] + + output_items = getattr(result, "output", None) + if not output_items: + return [] + + messages = [] + for item in output_items: + if getattr(item, "type", None) != "message": + continue + + role = getattr(item, "role", "assistant") + finish_reason = _finish_reason_from_status( + getattr(item, "status", None) + ) + parts = _extract_output_parts(getattr(item, "content", []), Text) + + messages.append( + OutputMessage(role=role, parts=parts, finish_reason=finish_reason) + ) + + return messages + + +def _finish_reason_from_status(status): + return "stop" if status == "completed" else (status or "stop") + + +def _extract_output_parts(content_blocks, text_type): + parts = [] + for block in content_blocks: + block_type = getattr(block, "type", None) + if block_type == "output_text": + text = getattr(block, "text", None) + if text: + parts.append(text_type(content=text)) + elif block_type == "refusal": + refusal = getattr(block, "refusal", None) + if refusal: + parts.append(text_type(content=refusal)) + return parts + + +def _extract_finish_reasons(result: Any) -> list[str]: + """Extract finish reasons from Responses API output items.""" + output_items = getattr(result, "output", None) + if not output_items: + return [] + + finish_reasons = [] + for item in output_items: + if getattr(item, "type", None) != "message": + continue + finish_reasons.append( + _finish_reason_from_status(getattr(item, "status", None)) + ) + return finish_reasons + + +def _extract_output_type(kwargs: dict) -> Optional[str]: + """Extract output type from Responses API request text.format.""" + text_config = kwargs.get("text") + if not isinstance(text_config, Mapping): + return None + + format_config = text_config.get("format") + if isinstance(format_config, Mapping): + format_type = format_config.get("type") + else: + format_type = None + + if format_type == "json_schema": + return "json" + return format_type + + +def _get_field(obj: Any, key: str): + if isinstance(obj, Mapping): + return obj.get(key) + return getattr(obj, key, None) + + +def _set_optional_attribute( + invocation: "LLMInvocation", + result: Any, + source_name: str, + target_name: str, +): + value = getattr(result, source_name, None) + if value is not None: + invocation.attributes[target_name] = value + + +def _set_invocation_usage_attributes(invocation: "LLMInvocation", usage: Any): + input_tokens = _get_field(usage, "input_tokens") + if input_tokens is None: + input_tokens = _get_field(usage, "prompt_tokens") + invocation.input_tokens = input_tokens + + output_tokens = _get_field(usage, "output_tokens") + if output_tokens is None: + output_tokens = _get_field(usage, "completion_tokens") + invocation.output_tokens = output_tokens + + input_token_details = _get_field(usage, "input_tokens_details") + if input_token_details is None: + input_token_details = _get_field(usage, "prompt_tokens_details") + + cache_read_tokens = _get_field(input_token_details, "cached_tokens") + if cache_read_tokens is not None: + invocation.attributes[GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS] = ( + cache_read_tokens + ) + + cache_creation_tokens = _get_field( + input_token_details, "cache_creation_input_tokens" + ) + if cache_creation_tokens is not None: + invocation.attributes[GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS] = ( + cache_creation_tokens + ) + + +def _set_invocation_response_attributes( + invocation: "LLMInvocation", + result: Any, + capture_content: bool, +): + if result is None: + return + + if getattr(result, "model", None) and ( + not invocation.request_model or invocation.request_model == "unknown" + ): + invocation.request_model = result.model + + if getattr(result, "model", None): + invocation.response_model_name = result.model + + if getattr(result, "id", None): + invocation.response_id = result.id + + _set_optional_attribute( + invocation, + result, + "service_tier", + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER, + ) + _set_optional_attribute( + invocation, + result, + "system_fingerprint", + GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT, + ) + + usage = getattr(result, "usage", None) + if usage: + _set_invocation_usage_attributes(invocation, usage) + + finish_reasons = _extract_finish_reasons(result) + if finish_reasons: + invocation.finish_reasons = finish_reasons + + if capture_content: + output_messages = _extract_output_messages(result) + if output_messages: + invocation.output_messages = output_messages diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py new file mode 100644 index 0000000000..7812e18b01 --- /dev/null +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py @@ -0,0 +1,169 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import TYPE_CHECKING, Any + +try: + from opentelemetry.util.genai.types import Error +except ( + ModuleNotFoundError +): # pragma: no cover - optional dependency at import-time + Error = None # type: ignore[assignment,misc] + +from .response_extractors import _set_invocation_response_attributes + +if TYPE_CHECKING: + from opentelemetry.util.genai.handler import TelemetryHandler + from opentelemetry.util.genai.types import LLMInvocation + + +class _ResponseProxy: + def __init__(self, response, finalize): + self._response = response + self._finalize = finalize + + def close(self): + try: + self._response.close() + finally: + self._finalize(None) + + def __getattr__(self, name): + return getattr(self._response, name) + + +class ResponseStreamWrapper: + """Wrapper for OpenAI Responses API streams using TelemetryHandler.""" + + def __init__( + self, + stream: Any, + handler: "TelemetryHandler", + invocation: "LLMInvocation", + capture_content: bool, + ): + self.stream = stream + self.handler = handler + self.invocation = invocation + self._capture_content = capture_content + self._finalized = False + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + try: + if exc_type is not None: + self._fail( + str(exc_val), type(exc_val) if exc_val else Exception + ) + finally: + self.close() + return False + + def close(self): + if hasattr(self.stream, "close"): + self.stream.close() + self._stop(None) + + def __iter__(self): + return self + + def __next__(self): + try: + event = next(self.stream) + self.process_event(event) + return event + except StopIteration: + self._stop(None) + raise + except Exception as error: + self._fail(str(error), type(error)) + raise + + def get_final_response(self): + if not hasattr(self.stream, "get_final_response"): + raise AttributeError("get_final_response is not available") + self.until_done() + return self.stream.get_final_response() + + def until_done(self): + for _ in self: + pass + return self + + def parse(self): + """Called when using with_raw_response with stream=True.""" + return self + + def __getattr__(self, name): + return getattr(self.stream, name) + + @property + def response(self): + response = getattr(self.stream, "response", None) + if response is None: + return None + return _ResponseProxy(response, lambda *_: self._stop(None)) + + def _stop(self, result: Any): + if self._finalized: + return + _set_invocation_response_attributes( + self.invocation, result, self._capture_content + ) + self.handler.stop_llm(self.invocation) + self._finalized = True + + def _fail(self, message: str, error_type: type[BaseException]): + if self._finalized: + return + if Error is None: + raise ModuleNotFoundError( + "opentelemetry.util.genai.types is unavailable" + ) + + self.handler.fail_llm( + self.invocation, Error(message=message, type=error_type) + ) + self._finalized = True + + def process_event(self, event): + event_type = getattr(event, "type", None) + response = getattr(event, "response", None) + + if response and ( + not self.invocation.request_model + or self.invocation.request_model == "unknown" + ): + model = getattr(response, "model", None) + if model: + self.invocation.request_model = model + + if event_type == "response.completed": + self._stop(response) + return + + if event_type in {"response.failed", "response.incomplete"}: + _set_invocation_response_attributes( + self.invocation, response, self._capture_content + ) + self._fail(event_type, RuntimeError) + return + + if event_type == "error": + error_type = getattr(event, "code", None) or "response.error" + message = getattr(event, "message", None) or error_type + self._fail(message, RuntimeError) + return From f2f0b48da03d3f0c194bae25a5a2352caae346f5 Mon Sep 17 00:00:00 2001 From: Teja Date: Wed, 18 Feb 2026 07:11:33 -0500 Subject: [PATCH 20/20] Refactor OpenAI instrumentation to remove optional dependency handling for genai types, simplifying imports across multiple files. --- .../instrumentation/openai_v2/__init__.py | 8 +------- .../openai_v2/patch_responses.py | 8 +------- .../openai_v2/response_extractors.py | 18 ++++++------------ .../openai_v2/response_wrappers.py | 7 +------ .../instrumentation/openai_v2/utils.py | 8 +------- 5 files changed, 10 insertions(+), 39 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py index 2582bbce09..90f9cb235f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/__init__.py @@ -52,13 +52,7 @@ from opentelemetry.metrics import get_meter from opentelemetry.semconv.schemas import Schemas from opentelemetry.trace import get_tracer - -try: - from opentelemetry.util.genai.handler import TelemetryHandler -except ( - ModuleNotFoundError -): # pragma: no cover - optional dependency at import-time - TelemetryHandler = None # type: ignore[assignment,misc] +from opentelemetry.util.genai.handler import TelemetryHandler from .instruments import Instruments from .patch import ( diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py index 649816330e..c9e2910876 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch_responses.py @@ -17,13 +17,7 @@ from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, ) - -try: - from opentelemetry.util.genai.types import Error, LLMInvocation -except ( - ModuleNotFoundError -): # pragma: no cover - optional dependency at import-time - Error = LLMInvocation = None # type: ignore[assignment,misc] +from opentelemetry.util.genai.types import Error, LLMInvocation from .response_extractors import ( GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS, diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py index 0ada4f7c20..40ec2758e6 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_extractors.py @@ -17,18 +17,12 @@ from opentelemetry.semconv._incubating.attributes import ( gen_ai_attributes as GenAIAttributes, ) - -try: - from opentelemetry.util.genai.types import ( - InputMessage, - LLMInvocation, - OutputMessage, - Text, - ) -except ( - ModuleNotFoundError -): # pragma: no cover - optional dependency at import-time - InputMessage = LLMInvocation = OutputMessage = Text = None # type: ignore[assignment,misc] +from opentelemetry.util.genai.types import ( + InputMessage, + LLMInvocation, + OutputMessage, + Text, +) OPENAI = GenAIAttributes.GenAiSystemValues.OPENAI.value GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read.input_tokens" diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py index 7812e18b01..fb51646dd9 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/response_wrappers.py @@ -14,12 +14,7 @@ from typing import TYPE_CHECKING, Any -try: - from opentelemetry.util.genai.types import Error -except ( - ModuleNotFoundError -): # pragma: no cover - optional dependency at import-time - Error = None # type: ignore[assignment,misc] +from opentelemetry.util.genai.types import Error from .response_extractors import _set_invocation_response_attributes diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py index c2774c4dc5..ff52d120de 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py @@ -32,13 +32,7 @@ error_attributes as ErrorAttributes, ) from opentelemetry.trace.status import Status, StatusCode - -try: - from opentelemetry.util.genai.utils import should_capture_content -except ( - ModuleNotFoundError -): # pragma: no cover - optional dependency at import-time - should_capture_content = None # type: ignore[assignment,misc] +from opentelemetry.util.genai.utils import should_capture_content OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = ( "OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"