> ## Documentation Index
> Fetch the complete documentation index at: https://docs.powertokens.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Streaming Response

> Seedream-5.0/4.5/4.0 supports streaming output mode. When you call the Image Generation API with **stream** set to `true`, the server will push events to the client in real time via Server-Sent Events (SSE) during the generation process. This section describes the various events the server will push.



## OpenAPI

````yaml api-reference/en/zmodelImage/byteplus/seedream/seedream-streaming.json POST /byteplus/api/v3/images/generations
openapi: 3.0.1
info:
  title: Streaming Response
  version: 1.0.0
  description: >-
    Seedream-5.0/4.5/4.0 supports streaming output mode. When you call the Image
    Generation API with **stream** set to `true`, the server will push events to
    the client in real time via Server-Sent Events (SSE) during the generation
    process. This section describes the various events the server will push.
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API service endpoint
security: []
tags:
  - name: Seedream API Compat
    description: Seedream Streaming Response
paths:
  /byteplus/api/v3/images/generations:
    post:
      tags:
        - Seedream API Compat
      summary: Streaming Response Events
      description: >-
        Seedream-5.0/4.5/4.0 supports streaming output mode. When you call the
        Image Generation API with **stream** set to `true`, the server will push
        events to the client in real time via Server-Sent Events (SSE) during
        the generation process. This section describes the various events the
        server will push.
      operationId: seedreamStreaming
      responses:
        '200':
          description: >-
            SSE streaming response. The response type is `text/event-stream`.


            ## image_generation.partial_succeeded


            > Currently only Seedream-5.0/4.5/4.0 support streaming response.


            Returned when any image generation succeeds in streaming response
            mode.


            **type** `string`


            This 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 the creation time for this request.


            ---


            **image_index** `integer`


            The index of the image corresponding to this event in the current
            image generation request.

            Starting from `0`, it increments by 1 regardless of whether the
            image generation succeeds or fails, i.e., it auto-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 `response_format` is set to `url` in the request.


            ---


            **b64_json** `string`


            The Base64 encoding of the image corresponding to this event.
            Returned when `response_format` is set to `b64_json` in the request.


            ---


            **size** `string`


            The pixel dimensions of the image, in the format `<width>×<height>`,
            e.g., `2048×2048`.


            ---


            ### Response Example


            ```Shell

            {
              "type": "image_generation.partial_succeeded",
              "model": "doubao-seedream-5-0-260128",
              "created": 1589478378,
              "image_index": 0,
              "url": "https://...",
              "size": "2048×2048"
            }

            ```


            ---


            ## image_generation.partial_failed


            > Currently only Seedream-5.0/4.5/4.0 support streaming response.


            Returned when any image generation fails in streaming response mode.


            - If the failure reason is content moderation rejection: It will
            continue to request the next image generation task, meaning it does
            not affect the generation flow of other images within the same
            request.

            - If the failure reason is an internal service error (500): It will
            not continue to request the next image generation task.


            **type** `string`


            This 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 the creation time for this request.


            ---


            **image_index** `integer`


            The index of the image corresponding to this event in the current
            image generation request.

            Starting from `0`, it increments by 1 regardless of whether the
            image generation succeeds or fails, i.e., it auto-increments by 1 in
            both `image_generation.partial_succeeded` and
            `image_generation.partial_failed` events.


            ---


            **error** `object`


            The error reason for this event in the current image generation
            request.


            error. **code** `string`


            Error code.


            error. **message** `string`


            Error message.


            ### Response Example


            ```Shell

            {
              "type": "image_generation.partial_failed",
              "model": "doubao-seedream-5-0-260128",
              "created": 1589478378,
              "image_index": 2,
              "error": {
                  "code":"OutputImageSensitiveContentDetected",
                  "message":"The request failed because the output image may contain sensitive information."
              }
            }

            ```


            ---


            ## image_generation.completed


            > Currently only Seedream-5.0/4.5/4.0 support streaming response.


            Returned after all images (whether successful or failed) in the
            request have been processed. This is the last response event of the
            streaming response.


            **type** `string`


            This 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 the creation time for this request.


            ---


            **tools** `array of object`


            Configured model tools for this request.


            tools. **type** `string`


            The configured tool type.


            - web_search: Web search tool.


            ---


            **usage** `object`


            Usage information for this request.


            usage. **generated_images** `integer`


            The number of successfully generated images. Images that failed to
            generate are not included. Billing is based on the number of
            successfully generated images.


            usage. **output_tokens** `integer`


            Number of tokens spent on the generated image. Calculation logic:
            `sum(image_width * image_height) / 256`, then rounded.


            usage. **total_tokens** `integer`


            Total number of tokens consumed for this request. Input tokens are
            not currently counted, so this matches the **output_tokens** value.


            usage. **tool_usage** `object`


            Usage information for tools used.


            usage.tool_usage. **web_search** `integer`


            The number of times the web search tool was called. Only returned
            when web search is enabled.


            ### Response Example


            ```Shell

            {
              "type": "image_generation.completed",
              "model": "doubao-seedream-5-0-260128",
              "created": 1589478378,
              "tools": [
                     {
                         "type": "web_search",
                     }
                 ],
              "usage": {
                  "generated_images": 2,
                  "output_tokens": xx,
                  "total_tokens": xx,
                  "tool_usage":{
                    "web_search":1
                }
              }
            }

            ```


            ---


            ## error


            Error information for this request, if an error occurred.


            **error** `object`


            The error message returned for this request error.


            error. **code** `string`


            Error code.


            error. **message** `string`


            Error message.


            ### Response Example


            ```Shell

            "error": {
              "code":"BadRequest",
              "message":"The request failed because it is missing one or multiple required parameters. Request ID: {id}"
            }

            ```
          content:
            text/event-stream:
              schema:
                type: string
                description: ''
              examples:
                seedream-5.0-streaming-output:
                  summary: seedream-5.0-streaming-output
                  value: >
                    event: image_generation.partial_succeeded

                    data:
                    {"type":"image_generation.partial_succeeded","model":"seedream-5-0-260128","created":1757396757,"image_index":0,"url":"https://...","size":"2496x1664"}


                    event: image_generation.partial_succeeded

                    data:
                    {"type":"image_generation.partial_succeeded","model":"seedream-5-0-260128","created":1757396785,"image_index":1,"url":"https://...","size":"2496x1664"}


                    event: image_generation.partial_succeeded

                    data:
                    {"type":"image_generation.partial_succeeded","model":"seedream-5-0-260128","created":1757396825,"image_index":2,"url":"https://...","size":"2496x1664"}


                    event: image_generation.completed

                    data:
                    {"type":"image_generation.completed","model":"seedream-5-0-260128","created":1757396825,"usage":{"generated_images":3,"output_tokens":48672,"total_tokens":48672}}


                    data: [DONE]

````