GPT Image-1.5

This guide shows how to generate images using GPT Image-1.5 model via the Leonardo.AI REST API.

This guide shows how to generate images using GPT Image-1.5 model via the Leonardo.AI REST API.

Sample Request

curl --location 'https://cloud.leonardo.ai/api/rest/v2/generations' \
     --header 'authorization: Bearer {api-key}' \
     --header 'Content-Type: application/json' \
     --data '{
       "public": false,
       "model": "gpt-image-1.5",
       "parameters": {
           "mode": "QUALITY",
           "prompt": "Koala with purple hat",
           "quantity": 2,
           "width": 1024,
           "height": 1024,
           "seed": 4294967295,
           "prompt_enhance": "OFF"
           "guidances": {
               "image_reference": [
                   {
                       "image": {
                       "id": "00000000-0000-0000-0000-000000000001",
                       "type": "UPLOADED"
                       },
                       "strength": "MID",
                   }
               ]
           }
        }
     }'

Recipe

API Request Endpoint, Headers, Parameters

Endpoint

https://cloud.leonardo.ai/api/rest/v2/generations

Headers

--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"

Body Parameters

ParameterTypeDefinition
guidancesobjectOptional. Object defining image guidance inputs that influence the generated result.
guidances.image_referencearrayOptional. Array of up to 6 reference images. Each reference includes image.id, image.type (GENERATED or UPLOADED), and strength (LOW, MID, HIGH).
heightintegerOptional. Height input resolution.
modestringOptional. Accepts FAST, QUALITY, or ULTRA.
modelstringRequired. Model identifier. Set to gpt-image-1.5
promptstringRequired. Text prompt describing what image you want the model to generate.
prompt_enhancestringOptional. Enables prompt enhancement when set to "ON"; disabled when set to "OFF".
publicbooleanOptional. Boolean flag that determines whether the generation is public (true) or private (false).
quantityintegerOptional. Number of images to generate in a single request.
seedintegerOptional. Apply a fixed seed to maintain consistency across generation sets.
widthintegerOptional. Width input resolution.

Aspect Ratio Settings

Aspect RatioWidthHeight
2:310241536
1:110241024
3:215361024