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 Ratio | Width | Height |
|---|---|---|
| 2:3 | 1024 | 1536 |
| 1:1 | 1024 | 1024 |
| 3:2 | 1536 | 1024 |
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
| Multiplier | Notes | Cost | |
|---|---|---|---|
| FAST | 1 | 13 token for 1024x1024 t2i | 13 |
| QUALITY | 2.92 | Based on 1024x1024 output | 38 |
| ULTRA | 10.538 | Based on 1024x1024 output | 137 |
| Quantity | Self | ||
| Height*Width | Self | ||
| Image References | 1.2 | flat 20% increase regardless of number input images |
Updated about 16 hours ago
