Streaming Response
Seedream-5.0-lite/4.5/4.0 supports streaming output mode. When you call the image generation API and set stream to true, the server will push events to the client in real-time through Server-Sent Events (SSE) during the response generation process. This section describes the types of events that the server will push.
image_generation.partial_succeeded
Returned when any image generation succeeds in streaming response mode.
Parameter Description
type string
Should be image_generation.partial_succeeded.
model string
The model ID used for this request, in the format <model name>-<version>.
created integer
The Unix timestamp (seconds) of when this request was created.
image_index integer
The sequence number of the image corresponding to this event in the image generation request. Starts from 0 and increments regardless of whether the image generation succeeds or fails, i.e., it automatically increments by 1 in both image_generation.partial_succeeded and image_generation.partial_failed events.
url string
The download URL of the image corresponding to this event. Returned when the response_format field is configured as url in the request.
b64_json string
The Base64 encoding of the image corresponding to this event. Returned when the response_format field is configured as b64_json in the request.
size string
The width and height pixel values of the image, in the format <width pixels>x<height pixels>, e.g., 2048x2048.
image_generation.partial_failed
Returned when any image generation fails in streaming response mode.
- If the failure is due to review rejection: The next image generation task will continue, meaning it does not affect the generation process of other images in the same request.
- If the failure is due to internal server error (500): The next image generation task will not continue.
Parameter Description
type string
Should be image_generation.partial_failed.
model string
The model ID used for this request, in the format <model name>-<version>.
created integer
The Unix timestamp (seconds) of when this request was created.
image_index integer
The sequence number of the image corresponding to this event in the image generation request. Starts from 0 and increments regardless of whether the image generation succeeds or fails, i.e., it automatically increments by 1 in both image_generation.partial_succeeded and image_generation.partial_failed events.
error object
The error cause corresponding to this event in the image generation request.
Properties
error.codestring See Error Codes.error.messagestring Error prompt information.
image_generation.completed
Returned after all images in the request (whether successful or failed) have been processed. This is the last response event in the streaming response.
Parameter Description
type string
Should be image_generation.completed.
model string
The model ID used for this request, in the format <model name>-<version>.
created integer
The Unix timestamp (seconds) of when this request was created.
tools array of object
The tools called by the model configured in this request.
Properties
tools.typestring The type of tool configured to be called.web_search: Web search tool.
usage object
Usage information for this request.
Properties
usage.generated_imagesinteger The number of images successfully generated by the model, excluding failed images. Only successfully generated images are charged by the number of images.usage.input_imagesinteger (new, Seedream 5.0 pro only) The number of images input to the model.usage.output_tokensinteger The number of tokens consumed for image generation by the model. Calculation logic: sum(image width × image height)/256, then round to the nearest integer.usage.total_tokensinteger The total number of tokens consumed by this request. Currently, input tokens are not calculated, so it is the same as output_tokens.usage.tool_usageobject Usage information for tools used.usage.tool_usage.web_searchinteger Number of web search tool calls. Only returned when web search is enabled.
error
The error information corresponding to the error that occurred in this request.
Parameter Description
error object
The error information returned for the error in this request.
Properties
error.codestring See Error Codes.error.messagestring Error prompt information.
