Generate Images Using FLUX.2 Pro
Follow this recipe to generate images using the Flux model.
Generate with Flux Pro 2.0 Model Using Uploaded Image
Open Recipe
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": "flux-pro-2.0",
"parameters": {
"prompt": "A cat wearing a hat",
"quantity": 1,
"width": 1440,
"height": 1440,
"seed": 4294967295,
"guidances": {
"image_reference": [
{ "image": { "id": "00000000-0000-0000-0000-000000000001", "type": "GENERATED" } },
{ "image": { "id": "00000000-0000-0000-0000-000000000002", "type": "UPLOADED" } },
{ "image": { "id": "00000000-0000-0000-0000-000000000003", "type": "GENERATED" } },
{ "image": { "id": "00000000-0000-0000-0000-000000000004", "type": "UPLOADED" } }
]
}
}
}
'
Parameters
- model - Set to
flux-pro-2.0 - height - Supports 256 to 1440
- width - Supports 256 to 1440
- quantity - Number of images generated
- guidances.image_reference - List of image references up to 4. 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 | 960 | 1440 |
| 1:1 | 1440 | 1440 |
| 16:9 | 1440 | 810 |
| 9:16 | 810 | 1440 |
Cost
Pricing is a based on the input height, width, quantity, and whether or not image references were used. Refer to the calculation below to get the API credit cost based on your settings.
Without Image Reference
API Credit Cost = 0.000027 * height * width * quantity
For example, one 1440x1440 image is 0.000027 * 1440 * 1440 * 1 or 56 API Credits.
With Image Reference
API Credit Cost = 0.000027 * height * width * quantity * 1.5
For example, one 1440x1440 image with 4 image reference is is 0.000027 * 1440 * 1440 * 1 * 1.5 or 84 API Credits.
Updated 4 days ago
