Recraft V4.1
This guide shows how to generate images using the Recraft V4.1 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": "recraft/recraft-4.1",
"parameters": {
"width": 1024,
"height": 1024,
"prompt": "Flat vector illustration of a koala wearing a purple wizard hat, riding a skateboard, clean lines, minimal shading",
"quantity": 2,
"prompt_enhance": "AUTO",
"colors": ["#6B2FA3", "#F2C14E", "#3A3A3A"],
"background_color": "#FFFFFF"
},
"public": false
}'API Request Endpoint, Headers, Parameters
Endpoint
https://cloud.leonardo.ai/api/rest/v2/generationsHeaders
--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"Body Parameters
| Parameter | Type | Definition |
|---|---|---|
| background_color | string | Optional. Preferred background color for the image, as a #RRGGBB hex value. The model treats it as a hint. |
| colors | array | Optional. Preferred color palette for the image, as up to 5 unique #RRGGBB hex values. The model treats them as a hint and may not use every color. |
| height | integer | Optional. Height input resolution. Supports 768, 832, 896, 1024, 1152, 1216, 1280, 1344, 1536, 1664, 1792, 2048, 2304, 2432, 2560, 2688, or 3072. The combinations 2688 × 1536 and 1536 × 2688 (width × height) are not supported. Defaults to 1024. |
| model | string | Required. Model identifier. Set to recraft/recraft-4.1. |
| prompt | string | Required. Text prompt describing what image you want the model to generate. |
| prompt_enhance | string | Optional. Controls prompt enhancement. Supports AUTO, ON, or OFF. Defaults to AUTO. |
| public | boolean | Optional. Boolean flag that determines whether the generation is public (true) or private (false). |
| quantity | integer | Optional. Number of images to generate in a single request. Supports 1 to 8. Defaults to 4. |
| width | integer | Optional. Width input resolution. Supports 768, 832, 896, 1024, 1152, 1216, 1280, 1344, 1536, 1664, 1792, 2048, 2304, 2432, 2560, 2688, or 3072. The combinations 2688 × 1536 and 1536 × 2688 (width × height) are not supported. Defaults to 1024. |
Updated about 3 hours ago
Did this page help you?
