Get Generation
Retrieves the details and status of a generation job, including the generated images when complete.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
Inputs
- Connection Id (String) - Connection ID from the Connect node (optional if API Key credentials are provided directly).
- Generation Id (String) - ID of the generation to retrieve (from Create Generation node).
Options
- API Key - Leonardo AI API key (optional if using Connection ID).
Outputs
- Generation (Object) - Complete generation details including:
- Status (PENDING, COMPLETE, FAILED)
- Generated image URLs
- Generation parameters used
- Timestamps
- Image metadata
How It Works
The Get Generation node retrieves information about a generation job. When executed, the node:
- Validates the generation ID is not empty
- Sends a request to the Leonardo AI API to retrieve generation details
- Returns the complete generation object with status and images
Requirements
- Valid Leonardo AI API key (via Connection ID or credentials)
- Valid generation ID from a Create Generation node
Error Handling
The node will return specific errors in the following cases:
- Empty generation ID - "Generation ID cannot be empty. Please provide a valid generation ID."
- API error - "Failed to retrieve generation. API error
{status}:{details}" - Invalid generation ID - API will return error if generation doesn't exist
Usage Examples
Check Generation Status
Poll the generation status until complete:
- Create Generation and get the generation ID
- Wait a few seconds (use Delay node)
- Use Get Generation to check if status is "COMPLETE"
- If not complete, loop back to step 2
- When complete, extract image URLs from the output
Retrieve Generated Images
After generation completes:
- Use Get Generation with the generation ID
- Extract the image URLs from the output:
// Access generated images
const generation = $.generation;
const images = generation.generated_images;
const firstImageUrl = images[0].url; - Download images using the URLs
Generation in a Loop
When generating multiple images in a workflow:
- Create multiple generations with different prompts
- Store each generation ID in an array
- Loop through the IDs and get each generation
- Process completed generations, retry pending ones
Usage Notes
- Generations are asynchronous - they may take 10-60 seconds to complete
- Poll this node periodically to check status (recommended: every 5-10 seconds)
- The status field indicates: PENDING (processing), COMPLETE (done), or FAILED (error)
- Generated image URLs are temporary - download them promptly if needed
- The generation object contains all parameters used for the generation
- Use a loop or retry mechanism to wait for completion
- Failed generations will include error details in the output
- Image URLs in the response can be used directly or downloaded for storage