Implementation:Openai Openai python Response Image Gen Call Generating
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Responses_API |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete streaming event type for signaling that image generation is actively producing an image provided by the openai-python SDK.
Description
ResponseImageGenCallGeneratingEvent is a Pydantic model emitted when an image generation tool call is actively generating an image (intermediate state). It carries the item_id identifying the image generation item, the output_index locating it within the response output array, and a sequence_number for event ordering. The type field is always "response.image_generation_call.generating".
Usage
Import this type when building streaming event handlers that need to track the intermediate generating state of an image generation call, for example to display a progress indicator to the user.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/responses/response_image_gen_call_generating_event.py
Signature
class ResponseImageGenCallGeneratingEvent(BaseModel):
"""Emitted when an image generation tool call is actively generating an image (intermediate state)."""
item_id: str
output_index: int
sequence_number: int
type: Literal["response.image_generation_call.generating"]
Import
from openai.types.responses import ResponseImageGenCallGeneratingEvent
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| item_id | str | Yes | The unique identifier of the image generation item being processed. |
| output_index | int | Yes | The index of the output item in the response's output array. |
| sequence_number | int | Yes | The sequence number of the image generation item being processed. |
| type | Literal["response.image_generation_call.generating"] | Yes | The type of the event. Always response.image_generation_call.generating.
|
Usage Examples
import openai
client = openai.OpenAI()
stream = client.responses.create(
model="gpt-4o",
input="Generate an image of a sunset over mountains.",
stream=True,
)
for event in stream:
if event.type == "response.image_generation_call.generating":
print(f"Image is being generated for item {event.item_id}...")