Generate Images Using GPT1.5
Follow this recipes to generate images using the GPT1.5 model.
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.
Aspect Ratio Settings
| Aspect Ratio | Width | Height |
|---|---|---|
| 2:3 | 1024 | 1536 |
| 1:1 | 1024 | 1024 |
| 3:2 | 1536 | 1024 |
Cost
Pricing is a function of the base cost, input height, input 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.
Cost = Base * Height * Width * Quantity * Mode * Image Reference
Base = 0.0000123977
Parameter | Multiplier |
|---|---|
Height | The height setting itself. |
Width | The width setting itself. |
Quantity | The quantity setting itself. |
Mode | 1 if set to FAST |
Image Reference | 1 if there are no image references |
For example, assuming following settings:
{
"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"
}
]
}
}
}
Cost = 0.0000123977 * 1024 * 1024 * 2 * 2.92 * 1.2 = 92 API Credits (Rounded up to the nearest credit.)
Updated 21 days ago
