FLUX Schnell

This guide shows how to generate images using FLUX Schnell model via the Leonardo.AI REST API.

Sample Request

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '{
       "model": "flux-schnell",
       "parameters": {
           "width": 1024,
           "height": 1024,
           "prompt": "A photo of an orange cat playing with a tennis ball, cinematic lighting",
           "quantity": 4,
           "style_ids": [
               "111dc692-d470-4eec-b791-3475abac4c46"
           ]
       },
       "public": false
   }'

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.contentarrayOptional. Content reference (max 1) referencing the form and content of an input image. Each entry includes image.id, image.type (INIT, GENERATION, UPLOADED, GENERATED, VARIATION), and strength (LOW, MID, HIGH). Defaults to MID.
guidances.stylearrayOptional. Style reference (max 1) referencing the style of an input image. Each entry includes image.id, image.type (INIT, GENERATION, UPLOADED, GENERATED, VARIATION), and strength (LOW, MID, HIGH, ULTRA, MAX). Defaults to MID.
heightintegerOptional. Height of the image to generate in pixels. Supports 32 to 2048 in multiples of 8. Defaults to 1024.
modelstringRequired. Model identifier. Set to flux-schnell.
promptstringRequired. Text prompt describing what image you want the model to generate. Must be 1 to 2000 characters.
prompt_enhancestringOptional. Controls prompt enhancement. Accepts AUTO, ON, or OFF. Defaults to AUTO.
publicbooleanOptional. Boolean flag that determines whether the generation is public (true) or private (false).
quantityintegerOptional. Number of images to generate in a single request. Supports 1 to 8. Defaults to 4.
seedintegerOptional. Apply a fixed seed to maintain consistency across generation sets. Supports 0 to 2147483637.
style_idsarrayOptional. Array of style UUIDs used to apply a preset style to the output (limited to 1). Refer to the table below. Defaults to ["111dc692-d470-4eec-b791-3475abac4c46"] (Dynamic).
widthintegerOptional. Width of the image to generate in pixels. Supports 32 to 2048 in multiples of 8. Defaults to 1024.

List of Style IDs

Preset StyleUUID
3D Renderdebdf72a-91a4-467b-bf61-cc02bdeb69c6
Acrylic3cbb655a-7ca4-463f-b697-8a03ad67327c
Anime Generalb2a54a51-230b-4d4f-ad4e-8409bf58645f
Creative6fedbf1f-4a17-45ec-84fb-92fe524a29ef
Dynamic111dc692-d470-4eec-b791-3475abac4c46
Fashion594c4a08-a522-4e0e-b7ff-e4dac4b6b622
Game Concept09d2b5b5-d7c5-4c02-905d-9f84051640f4
Graphic Design 3D7d7c2bc5-4b12-4ac3-81a9-630057e9e89f
Illustration645e4195-f63d-4715-a3f2-3fb1e6eb8c70
None556c1ee5-ec38-42e8-955a-1e82dad0ffa1
Portraitab5a4220-7c42-41e5-a578-eddb9fed3d75
Portrait Cinematic4edb03c9-8a26-4041-9d01-f85b5d4abd71
Portrait Fashion0d34f8e1-46d4-428f-8ddd-4b11811fa7c9
Ray Tracedb504f83c-3326-4947-82e1-7fe9e839ec0f
Stock Photo5bdc3f2a-1be6-4d1c-8e77-992a30824a2c
Watercolor1db308ce-c7ad-4d10-96fd-592fa6b75cc4