Generate Image
AI-generatedOverview
This node generates high-quality AI images using Leonardo's powerful models. It allows users to create images from text prompts with extensive customization options, including image dimensions, number of images, model selection, and advanced generation parameters. It supports both synchronous (polling) and asynchronous (webhook) response modes, making it suitable for fast or slow image generation workflows. Practical use cases include creating artwork, concept designs, avatars, and other AI-generated visuals.
Use Case Examples
- Generate a single image of a fantasy landscape using a selected Leonardo model with default settings.
- Create multiple images of character portraits with custom dimensions and advanced options like tiling and transparency.
- Submit an image generation request asynchronously and receive the completed image via webhook for long-running tasks.
Properties
| Name | Meaning |
|---|---|
| Prompts | The prompt to generate the image from. |
| Width | The width of the generated image (min 32px, max 4096px). |
| Height | The height of the generated image (min 32px, max 4096px). |
| Number of Images | The number of images to generate. |
| Model Selection Method | Choose between selecting a model from the list or entering a custom model ID. |
| Model | The model to use for image generation when selecting from the list. |
| Custom Model ID | Enter the UUID of the model you want to use (found in Leonardo.ai interface or API docs). |
| Response Mode | Whether to wait for the image (polling) or return immediately with the generation ID for webhook-based completion. Use async to avoid timeouts on slow generations. |
| Advanced Options | Whether to set advanced image generation options. |
Output
JSON
success- Indicates if the image generation was successful.generationId- The unique identifier for the image generation job.status- The current status of the image generation job (e.g., PENDING, COMPLETE).apiCreditCost- The cost in API credits for the generation (available in async mode).request- The original request body sent for image generation (available in async mode).rawResponse- The raw API response from Leonardo.ai.prompt- The prompt used for image generation.modelId- The model ID used for image generation.imageCount- The number of images generated.images- Array of generated images with details including id, url, nsfw flag, width, and height.imageUrl- URL of the first generated image (if available).error- Error message if the image generation failed.
Dependencies
- Leonardo.ai API key credential
Troubleshooting
- Ensure the API key credential is correctly configured and has sufficient permissions.
- If using async mode, set up an n8n Webhook node to receive the finished image callback from Leonardo.ai.
- Check that the prompt and other required parameters are correctly set and within allowed ranges.
- If image generation times out, increase the 'Generation Timeout' parameter or use async mode to avoid timeouts.
- Errors about missing 'generationId' or 'status' fields indicate unexpected API responses; verify API availability and request correctness.
Links
- Leonardo.ai API Documentation - Official documentation for getting started with Leonardo.ai image generation API.
