Recraft V4
This guide shows how to generate images using the Recraft V4 model via the Leonardo.AI Production REST API.
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": "recraft-v4",
"parameters": {
"prompt": "A kangaroo eating pizza on a beach",
"prompt_enhance": "OFF",
"quantity": 2,
"width": 1024,
"height": 1024
}
}'Recipe
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 |
|---|---|---|
model | string | Required. Set to recraft-v4. |
public | boolean | Optional. Whether the generation is publicly visible. Use false for private generations. |
parameters.prompt | string | Required. Text prompt describing the desired image. |
parameters.prompt_enhance | string | Optional. "ON" or "OFF". |
parameters.quantity | integer | Optional. Number of images per request: 1–6; for more than 6 images, send multiple requests. |
parameters.width | integer | Required. Must match one of the fixed resolutions below for the chosen aspect ratio (see table below). |
parameters.height | integer | Required. Must match one of the fixed resolutions below for the chosen aspect ratio (see table below). |
Aspect Ratio Settings
Use exactly these sizes for Recraft V4. Custom resolutions are not supported.
| Aspect Ratio | Width | Height |
|---|---|---|
1:1 | 1024 | 1024 |
2:1 | 1536 | 768 |
1:2 | 768 | 1536 |
3:2 | 1280 | 832 |
2:3 | 832 | 1280 |
4:3 | 1216 | 896 |
3:4 | 896 | 1216 |
5:4 | 1152 | 896 |
4:5 | 896 | 1152 |
6:10 | 832 | 1344 |
14:10 | 1280 | 896 |
10:14 | 896 | 1280 |
16:9 | 1344 | 768 |
9:16 | 768 | 1344 |
Updated about 1 hour ago
