Skip to main content

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:

  1. Validates the generation ID is not empty
  2. Sends a request to the Leonardo AI API to retrieve generation details
  3. 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:

  1. Create Generation and get the generation ID
  2. Wait a few seconds (use Delay node)
  3. Use Get Generation to check if status is "COMPLETE"
  4. If not complete, loop back to step 2
  5. When complete, extract image URLs from the output

Retrieve Generated Images

After generation completes:

  1. Use Get Generation with the generation ID
  2. Extract the image URLs from the output:
    // Access generated images
    const generation = $.generation;
    const images = generation.generated_images;
    const firstImageUrl = images[0].url;
  3. Download images using the URLs

Generation in a Loop

When generating multiple images in a workflow:

  1. Create multiple generations with different prompts
  2. Store each generation ID in an array
  3. Loop through the IDs and get each generation
  4. 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