Generate Images Using GPT1.5


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,
    "guidances": {
      "image_reference": [
        {
          "image": {
            "id": "00000000-0000-0000-0000-000000000001",
            "type": "UPLOADED"
          },
          "strength": 0.5,
          "prompt_enhance": "OFF"
        }
      ]
    }
  }
}
'

Parameters

  • model - Set to gpt-image-1.5
  • height - Supports 1024 and 1536
  • width - Supports 1024 and 1536
  • quantity - Number of images generated
  • mode - FAST, QUALITY, ULTRA
  • guidances.image_reference - List of image references up to 6. Supports uploaded images and images generated on the Leonardo platform.
  • seed - Randomisation parameter. The maximum seed number is 4294967295

Aspect Ratio Settings

Aspect RatioWidthHeight
2:310241536
1:110241024
3:215361024

Cost

Pricing is a based on the input height, width, quantity, mode and whether or not image references were used. Refer to the calculation below to get the API credit cost based on your settings.


Base cost = 1.23977e-5

ImageRef = 1.2 if request has image guidance

Quality = 2.92 for Medium or 10.538 for High

Cost = Quantity * BaseCost * Height*Width * Quality * ImageRef


MultiplierNotesCost
FAST113 token for 1024x1024 t2i13
QUALITY2.92Based on 1024x1024 output38
ULTRA10.538Based on 1024x1024 output137
QuantitySelf
Height*WidthSelf
Image References1.2flat 20% increase regardless of number input images