Generate Images Using Seedream 4.0

Follow this recipes to generate images using the Seedream 4.0 model.


The guide will recreate the following functionality in the Web UI via API.

Sample Request

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '
{
    "model": "seedream-4.0",
    "parameters": {
        "width": 1920,
        "height": 1080,
        "prompt": "Koala with purple wizard hat on a skateboard",
        "quantity": 2,
        "guidances": {
            "image_reference": [
                {
                    "image": {
                        "id": "YOUR_UPLOADED_IMAGE_ID",
                        "type": "UPLOADED"
                    },
                    "strength": "MID"
                }
            ]
        },
        "style_ids": [
            "111dc692-d470-4eec-b791-3475abac4c46"
        ]
    },
    "public": false
}
'
📘

Note: This model is using the V2 endpoint: https://cloud.leonardo.ai/api/rest/v2/generations.

Input Uploaded Image

Lucid Origin with the prompt "a portrait-style photograph featuring a fox with a slender build and delicate features sitting against a navy blue background that is smooth and untextured. The fox has soft, fluffy orange fur with a lighter patch on its chest and around its nose. Its ears are large and pointed, with a slight perkiness. The eyes are a bright, piercing yellow with a sharp, intelligent glint. The lighting is soft and warm, highlighting the texture of the fur.

Sample Output


Required Parameters

  • modelId

    ModelmodelId
    Seedream 4.0seedream-4.0
  • prompt - Text prompt to use for generation.


Supported Parameters

  • prompt_enhance - Boolean to enable AI prompt enhancement

  • height - Height input resolution (default: 1024).

  • width - Width input resolution (default: 1024).

  • quantity - Number of images, default: 1, max: 8.

  • guidances - Object containing image references.

  • guidances.image_reference - Max 6 items.

    References an existing image in Leonardo's system:

    image:
    id- UUID of the image (must already exist in Leonardo in their account)

    type- Where the image comes from:

    "GENERATED" - Image created by Leonardo AI

    "UPLOADED" - Image uploaded by user

    "INIT" - Initial/seed image

    "GENERATION" - From a generation

  • strength - Controls how much the reference image influences the output:

    "LOW" - Subtle influence

    "MID" - Medium influence

    "HIGH" - Strong influence

  • style_ids (Preset Style)

    Preset StyleUUID
    Cinematica5632c7c-ddbb-4e2f-ba34-8456ab3ac436
    Creative6fedbf1f-4a17-45ec-84fb-92fe524a29ef
    Dynamic111dc692-d470-4eec-b791-3475abac4c46
    Fashion594c4a08-a522-4e0e-b7ff-e4dac4b6b622
    Portraitab5a4220-7c42-41e5-a578-eddb9fed3d75
    Stock Photo5bdc3f2a-1be6-4d1c-8e77-992a30824a2c
    Vibrantdee282d3-891f-4f73-ba02-7f8131e5541b

📘

Note

If using the seed parameter, the maximum seed number is 2147483638.

Cost

28 API credits per image