I’ve been working with Leonardo AI’s API, and I’ve successfully managed to:
Upload an image using the init-image endpoint.
Create images using models like Leonardo Phoenix or Leonardo Kino XL without any issues.
However, when I try to generate an image using an initial image as guidance (ControlNet) , I run into an issue.
The problem: Missing Prompt Error
When making an API call to generate an image with guidance, I follow these steps:
I upload an image and retrieve the initImageId.
I pass this initImageId into the JSON request body as per the official documentation.
I include the required parameters such as modelId, presetStyle, photoReal, controlnets, etc.
I send the API request to https://cloud.leonardo.ai/api/rest/v1/generations.
However, the response returns an error stating that the expected “prompt” is missing, even though I’ve included it in the request body.
What I’ve Tried
Checked the API documentation and formatted my request exactly as suggested.
Tested different JSON structures, ensuring that prompt is always included.
Tried different models (e.g., Leonardo Phoenix, Leonardo Kino XL ).
Experimented with different ways to pass initImageId, such as “initImageType”: “UPLOADED” or “initImageType”: “GENERATED”.
Tried sending the request in both Postman and Make.com – still the same issue.
My API Request JSON (Example)
{
“height”: 512,
“modelId”: “aa77f04e-3eec-4034-9c07-d0f619684628”,//Leonardo Kino XL
“prompt”: “A wistful young woman stands in the beaming doorway of a sunlit room”,
“presetStyle”:“CINEMATIC”,
“width”: 1024,
“photoReal”: true,
“photoRealVersion”:“v2”,
“alchemy”:true,
“controlnets”: [
{
“initImageId”: “{{70.id}}”,
“initImageType”: “UPLOADED”,
“preprocessorId”: 67,
“strengthType”: “High”,
“influence”: 0.64
}
]
}
Error Response:
[400] expecting a value for non-nullable variable: “prompt”
Has anyone successfully used image guidance (ControlNet) in Leonardo AI via API?
Is there a specific format or additional parameter required when using an initImageId?
Could this be a bug, or am I missing something crucial?
Would love to hear if anyone has found a fix for this! Thanks in advance.