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

# Create Seedream images

> Use CometAPI POST /v1/images/generations for Seedream text-to-image and image-to-image generation — supports sequential multi-image output and reference images.

## Overview

Generate images using ByteDance's Seedream models through the standard OpenAI-compatible `/v1/images/generations` endpoint. Supports both **text-to-image** and **image-to-image** generation.

For the full model list, see the [Models page](/overview/models). For detailed parameter documentation from the provider, see the [VolcEngine documentation](https://www.volcengine.com/docs/6791/1541523).

<Note>
  When using sequential (multi-image) generation, set `sequential_image_generation` to `auto` and optionally configure `sequential_image_generation_options.max_images` to limit the number of output images. The total number of reference images plus generated images must be **≤ 15**.
</Note>

## Image-to-image

Pass one or more reference images via the `image` parameter (array of URLs or base64 data URIs) along with a text prompt. Supports up to 14 reference images.

## Returned URL gives AccessDenied?

<Warning>
  The returned `url` is a signed object-storage link that **contains `&` and other special characters**.\
  If you copy the raw JSON and paste it directly into a browser or script, shell escaping or terminal truncation may strip the signature parameters, resulting in:

  ```json theme={null}
  \{"Code":"AccessDenied","Message":"Access Denied","EC":"0003-00000015"\}
  ```

  **How to fix:**

  * **curl**: pipe through `| jq -r '.data[].url'` to extract the URL cleanly.
  * **Python**: use `result.data[0].url` or `image["url"]` — the string is already complete; pass it directly to `requests.get()` or `webbrowser.open()`.
  * **JavaScript**: same idea — `result.data[0].url`.
  * **General**: make sure `&` and `%` in the URL are not truncated or double-escaped.
</Warning>


## OpenAPI

````yaml api/openapi/image/seededit-seedream/post-bytedance-image-generation.openapi.json POST /v1/images/generations
openapi: 3.1.0
info:
  title: bytedance-image-generation(seedream) API
  version: 1.0.0
servers:
  - url: https://api.cometapi.com
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: bytedance-image-generation(seedream)
      operationId: bytedance_image_generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                Parameters for Seedream image generation (text-to-image and
                image-to-image).
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: >-
                    Model to use. See the [Models page](/overview/models) for
                    current Seedream model IDs.
                  default: doubao-seedream-5-0-260128
                prompt:
                  type: string
                  description: >-
                    Text prompt describing the image to generate. Supports both
                    Chinese and English. Recommended max 300 Chinese characters
                    or 1000 English characters.
                  default: a cat wearing a scarf sitting by the window
                response_format:
                  type: string
                  description: >-
                    Output format. `url` returns a temporary image link (valid
                    for 24 hours); `b64_json` returns base64-encoded image data.
                  default: url
                  enum:
                    - url
                    - b64_json
                size:
                  type: string
                  description: >-
                    Output resolution. Presets `2K`, `4K`, or exact pixels like
                    `2048x2048`, `2304x1728`, `2848x1600`, `1600x2848`, etc.
                    Default: `2048x2048`.
                  default: 2048x2048
                image:
                  type: array
                  items:
                    type: string
                  description: >-
                    Reference image(s) for image-to-image generation. Each item
                    is a public URL or base64 data URI
                    (`data:image/png;base64,...`). Supports up to 14 reference
                    images. Supported formats: jpeg, png, webp, bmp, tiff, gif.
                watermark:
                  type: boolean
                  description: >-
                    When `true`, adds an 'AI Generated' watermark to the
                    bottom-right corner of the output image.
                  default: true
                guidance_scale:
                  type: number
                  description: >-
                    Controls how closely the output follows the prompt. Higher
                    values increase adherence but may reduce naturalness. Range:
                    1.0–10.0. Not supported by Seedream 5.0 (ignored).
                  default: 2.5
                seed:
                  type: integer
                  description: >-
                    Random seed for reproducible outputs. Range: -1 to
                    2147483647. Use -1 (default) for random generation. Legacy
                    parameter — ignored by newer models.
                  default: -1
                sequential_image_generation:
                  type: string
                  description: >-
                    Controls sequential (multi-image) generation mode.

                    - `auto`: model decides whether to generate a sequence based
                    on the prompt

                    - `disabled`: always generate a single image
                  default: disabled
                  enum:
                    - auto
                    - disabled
                sequential_image_generation_options:
                  type: object
                  description: >-
                    Configuration for sequential (multi-image) generation. Only
                    effective when `sequential_image_generation` is `auto`.
                  properties:
                    max_images:
                      type: integer
                      description: >-
                        Maximum number of images to generate in this request.
                        Range: [1, 15]. Total reference images + generated
                        images must be ≤ 15.
                      default: 15
                output_format:
                  type: string
                  description: 'Output image file format. Options: `png`, `jpeg`.'
                  default: jpeg
                  enum:
                    - png
                    - jpeg
              default:
                model: doubao-seedream-5-0-260128
                prompt: a cat wearing a scarf sitting by the window
                response_format: url
                size: 2K
                watermark: false
            examples:
              Seedream 5.0 — Text to Image:
                summary: Seedream 5.0 — Text to Image
                value:
                  model: doubao-seedream-5-0-260128
                  prompt: >-
                    a cat wearing a scarf sitting by the window watching rain,
                    illustration style
                  size: 2K
                  response_format: url
                  watermark: false
              Seedream 5.0 — Image to Image:
                summary: Seedream 5.0 — Image to Image (single ref)
                value:
                  model: doubao-seedream-5-0-260128
                  prompt: transform into watercolor painting style, vibrant colors
                  image:
                    - https://example.com/photo.jpg
                  size: 2K
                  response_format: url
                  watermark: false
              Seedream 5.0 — Sequential (Multi-Image):
                summary: Seedream 5.0 — Sequential multi-image generation
                value:
                  model: doubao-seedream-5-0-260128
                  prompt: >-
                    a 4-panel comic strip of a cat's daily routine: waking up,
                    eating breakfast, playing, and sleeping
                  size: 2K
                  response_format: url
                  sequential_image_generation: auto
                  sequential_image_generation_options:
                    max_images: 4
                  watermark: false
              Seedream 4.5 — Text to Image:
                summary: Seedream 4.5 — Text to Image
                value:
                  model: doubao-seedream-4-5-251128
                  prompt: a futuristic cityscape at sunset with flying cars
                  size: 2K
                  response_format: url
                  watermark: false
              Seedream 4.0 — Text to Image:
                summary: Seedream 4.0 — Text to Image
                value:
                  model: doubao-seedream-4-0-250828
                  prompt: an oil painting of a mountain lake at dawn
                  size: 2K
                  response_format: url
                  watermark: false
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                required:
                  - created
                  - data
                  - usage
                properties:
                  model:
                    type: string
                    description: The model used for generation.
                  created:
                    type: integer
                    description: Unix timestamp (seconds) when the image was generated.
                  data:
                    type: array
                    description: Array of generated image objects.
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          description: >-
                            Signed download URL for the generated image (valid
                            for 24 hours). Returned when `response_format` is
                            `url`.
                        b64_json:
                          type: string
                          description: >-
                            Base64-encoded image data. Returned when
                            `response_format` is `b64_json`.
                        size:
                          type: string
                          description: >-
                            Pixel dimensions of the generated image, e.g.
                            `2048x2048`. Returned by some models.
                  usage:
                    type: object
                    description: Resource usage information for this request.
                    properties:
                      generated_images:
                        type: integer
                        description: Number of images successfully generated.
                      output_tokens:
                        type: integer
                        description: >-
                          Tokens consumed by the generated image(s). Calculated
                          as sum(width × height) / 256.
                      total_tokens:
                        type: integer
                        description: >-
                          Total tokens consumed (currently equals
                          output_tokens).
      x-codeSamples:
        - lang: Shell
          label: Text to Image (5.0)
          source: |
            curl -s https://api.cometapi.com/v1/images/generations \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "model": "doubao-seedream-5-0-260128",
                "prompt": "a cat wearing a scarf sitting by the window watching rain, illustration style",
                "size": "2K",
                "response_format": "url",
                "watermark": false
              }' | jq -r '.data[].url'
        - lang: Shell
          label: Image to Image (5.0)
          source: |
            curl -s https://api.cometapi.com/v1/images/generations \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "model": "doubao-seedream-5-0-260128",
                "prompt": "transform into watercolor painting style, vibrant colors",
                "image": ["https://example.com/photo.jpg"],
                "size": "2K",
                "response_format": "url",
                "watermark": false
              }' | jq -r '.data[].url'
        - lang: Shell
          label: Text to Image (4.5)
          source: |
            curl -s https://api.cometapi.com/v1/images/generations \
              -H "Authorization: Bearer $COMETAPI_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "model": "doubao-seedream-4-5-251128",
                "prompt": "a futuristic cityscape at sunset with flying cars",
                "size": "2K",
                "response_format": "url",
                "watermark": false
              }' | jq -r '.data[].url'
        - lang: Python
          label: Text to Image (5.0)
          source: |
            import os
            from openai import OpenAI

            client = OpenAI(
                base_url="https://api.cometapi.com/v1",
                api_key=os.environ["COMETAPI_KEY"],
            )

            result = client.images.generate(
                model="doubao-seedream-5-0-260128",
                prompt="a cat wearing a scarf sitting by the window watching rain, illustration style",
                size="2K",
                response_format="url",
                extra_body={"watermark": False},
            )

            for i, image in enumerate(result.data, 1):
                print(f"image_{i}: {image.url}")
        - lang: Python
          label: Image to Image (5.0)
          source: |
            import os
            from openai import OpenAI

            client = OpenAI(
                base_url="https://api.cometapi.com/v1",
                api_key=os.environ["COMETAPI_KEY"],
            )

            result = client.images.generate(
                model="doubao-seedream-5-0-260128",
                prompt="transform into watercolor painting style, vibrant colors",
                size="2K",
                response_format="url",
                extra_body={
                    "image": ["https://example.com/photo.jpg"],
                    "watermark": False,
                },
            )

            for i, image in enumerate(result.data, 1):
                print(f"image_{i}: {image.url}")
        - lang: Python
          label: Text to Image (4.5)
          source: |
            import os
            from openai import OpenAI

            client = OpenAI(
                base_url="https://api.cometapi.com/v1",
                api_key=os.environ["COMETAPI_KEY"],
            )

            result = client.images.generate(
                model="doubao-seedream-4-5-251128",
                prompt="a futuristic cityscape at sunset with flying cars",
                size="2K",
                response_format="url",
                extra_body={"watermark": False},
            )

            for i, image in enumerate(result.data, 1):
                print(f"image_{i}: {image.url}")
        - lang: JavaScript
          label: Text to Image (5.0)
          source: |
            import OpenAI from "openai";

            const client = new OpenAI({
              baseURL: "https://api.cometapi.com/v1",
              apiKey: process.env.COMETAPI_KEY,
            });

            const result = await client.images.generate({
              model: "doubao-seedream-5-0-260128",
              prompt:
                "a cat wearing a scarf sitting by the window watching rain, illustration style",
              size: "2K",
              response_format: "url",
              extra_body: { watermark: false },
            });

            result.data.forEach((image, i) => {
              console.log(`image_${i + 1}: ${image.url}`);
            });
        - lang: JavaScript
          label: Image to Image (5.0)
          source: |
            import OpenAI from "openai";

            const client = new OpenAI({
              baseURL: "https://api.cometapi.com/v1",
              apiKey: process.env.COMETAPI_KEY,
            });

            const result = await client.images.generate({
              model: "doubao-seedream-5-0-260128",
              prompt: "transform into watercolor painting style, vibrant colors",
              size: "2K",
              response_format: "url",
              extra_body: {
                image: ["https://example.com/photo.jpg"],
                watermark: false,
              },
            });

            result.data.forEach((image, i) => {
              console.log(`image_${i + 1}: ${image.url}`);
            });
        - lang: JavaScript
          label: Text to Image (4.5)
          source: |
            import OpenAI from "openai";

            const client = new OpenAI({
              baseURL: "https://api.cometapi.com/v1",
              apiKey: process.env.COMETAPI_KEY,
            });

            const result = await client.images.generate({
              model: "doubao-seedream-4-5-251128",
              prompt: "a futuristic cityscape at sunset with flying cars",
              size: "2K",
              response_format: "url",
              extra_body: { watermark: false },
            });

            result.data.forEach((image, i) => {
              console.log(`image_${i + 1}: ${image.url}`);
            });
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication. Use your CometAPI key.

````