Skip to content
Primary navigation

Image Streaming

Stream image generation and editing in real time with server-sent events. Learn more about image streaming.

Image edit streaming events

image_edit.partial_image

Emitted when a partial image is available during image editing streaming.

b64_json: string

Base64-encoded partial image data, suitable for rendering as an image.

background: "transparent" or "opaque" or "auto"

The background setting for the requested edited image.

Accepts one of the following:
"transparent"
"opaque"
"auto"
created_at: number

The Unix timestamp when the event was created.

output_format: "png" or "webp" or "jpeg"

The output format for the requested edited image.

Accepts one of the following:
"png"
"webp"
"jpeg"
partial_image_index: number

0-based index for the partial image (streaming).

quality: "low" or "medium" or "high" or "auto"

The quality setting for the requested edited image.

Accepts one of the following:
"low"
"medium"
"high"
"auto"
size: "1024x1024" or "1024x1536" or "1536x1024" or "auto"

The size of the requested edited image.

Accepts one of the following:
"1024x1024"
"1024x1536"
"1536x1024"
"auto"
type: "image_edit.partial_image"

The type of the event. Always image_edit.partial_image.

image_edit.completed

Emitted when image editing has completed and the final image is available.

b64_json: string

Base64-encoded final edited image data, suitable for rendering as an image.

background: "transparent" or "opaque" or "auto"

The background setting for the edited image.

Accepts one of the following:
"transparent"
"opaque"
"auto"
created_at: number

The Unix timestamp when the event was created.

output_format: "png" or "webp" or "jpeg"

The output format for the edited image.

Accepts one of the following:
"png"
"webp"
"jpeg"
quality: "low" or "medium" or "high" or "auto"

The quality setting for the edited image.

Accepts one of the following:
"low"
"medium"
"high"
"auto"
size: "1024x1024" or "1024x1536" or "1536x1024" or "auto"

The size of the edited image.

Accepts one of the following:
"1024x1024"
"1024x1536"
"1536x1024"
"auto"
type: "image_edit.completed"

The type of the event. Always image_edit.completed.

usage: object { input_tokens, input_tokens_details, output_tokens, total_tokens }

For the GPT image models only, the token usage information for the image generation.

input_tokens: number

The number of tokens (images and text) in the input prompt.

input_tokens_details: object { image_tokens, text_tokens }

The input tokens detailed information for the image generation.

image_tokens: number

The number of image tokens in the input prompt.

text_tokens: number

The number of text tokens in the input prompt.

output_tokens: number

The number of image tokens in the output image.

total_tokens: number

The total number of tokens (images and text) used for the image generation.