Automated AI Image Generation using Lorealcantara and Replicate - n8n Workflow

Deploy this n8n workflow to automate AI image generation using the Replicate API (ligua033/lorealcantara model). Features robust polling, error handling, and customized parameters.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content creators needing high volumes of custom, AI-generated images.

  • Developers building applications that require integrating powerful AI models via API.

  • Automation specialists looking for robust n8n templates for handling asynchronous API polling.

  • Users of n8n who want to leverage the Replicate platform for generative AI tasks efficiently.

Overview

This sophisticated n8n workflow provides a reliable method for leveraging the ligua033/lorealcantara image generation model on Replicate. Since AI generation tasks are asynchronous, this n8n workflow template is crucial as it includes an intelligent polling mechanism. It solves the common challenge of integrating long-running API tasks by initiating the prediction, waiting a set time, and then continuously checking the status until the image is successfully generated or fails. This robust approach ensures high reliability, making this one of the most effective n8n templates for generative AI projects. Using this specific n8n node structure, users can configure parameters like the creative prompt, dimensions, and seed, receiving a structured JSON output with the resulting image URL or detailed error messages. This n8n workflow ensures a hands-off, dependable generation process.

How it Works

This automated n8n workflow begins with the Manual Trigger, the designated n8n trigger for starting the process, often used when testing n8n templates.


  1. Configuration: The flow first uses two Set n8n node blocks to define necessary credentials (the Replicate API token) and all specific image generation parameters (e.g., prompt, width, height, seed).

  2. Initiate Prediction: The Create Other Prediction n8n node (an HTTP Request) sends a POST request to the Replicate API, initiating the job for the lorealcantara model and receiving a prediction ID.

  3. Logging & Wait: The request is briefly logged using a Code n8n node for monitoring, followed by an initial Wait 5s n8n node.

  4. Polling Loop: The Check Status HTTP Request n8n node polls Replicate using the prediction ID to retrieve the current job status. The subsequent Is Complete? n8n node checks if the status is "succeeded."

  5. Success Path: If the generation is successful, the flow proceeds to the Success Response n8n node, which extracts the final image URL ($json.output) and prepares a structured success response object.

  6. Failure/Retry Logic: If not complete, the Has Failed? n8n node checks for definitive failure. If failed, it routes to Error Response. If still running (processing), it enters a retry loop via the Wait 10s n8n node, which loops back to the Check Status n8n node.

  7. Final Output: The Display Result n8n node delivers the final, structured JSON outcome, detailing the success or failure of the AI generation request. This complete process makes this n8n workflow highly resilient and production-ready.

Installation Guide

To deploy and use this n8n workflow template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON code and import it directly into your n8n instance.

  2. Obtain Credentials: Sign up for an account on Replicate and obtain your personal API token.

  3. Configure API Key: Locate the Set API Token n8n node. Replace the placeholder value YOURREPLICATEAPI_TOKEN with your actual Replicate API token.

  4. Customize Parameters: Navigate to the Set Other Parameters n8n node. Adjust the prompt, width, height, and other advanced generation settings to match your specific requirements. The default prompt is "Create something amazing."

  5. Test Execution: Run the n8n workflow by clicking the Manual Trigger n8n trigger to test the complete asynchronous loop.

  6. Activate: Once testing is complete and successful, activate the n8n workflow.

Node Details

Manual Trigger (n8n trigger): The entry point of this n8n workflow, enabling manual initiation for rapid development and testing.
Set API Token (n8n node): A configuration n8n node where the crucial Replicate API authorization token is defined, ensuring secure access to the AI model.
Set Other Parameters (n8n node): Configures all input variables for the AI model. Key Configuration includes defining the prompt, image width (default 512), and height (default 512).
Create Other Prediction (HTTP Request n8n node): Sends the initial, asynchronous generation request to https://api.replicate.com/v1/predictions. Key Configuration: Uses Method POST and passes dynamically mapped generation parameters from the preceding n8n node.
Check Status (HTTP Request n8n node): Polls the Replicate prediction endpoint for status updates. Key Configuration: URL uses an expression to dynamically reference the prediction ID: =https://api.replicate.com/v1/predictions/{{ $('Create Other Prediction').item.json.id }}.
Is Complete? / Has Failed? (If n8n node): Core flow control nodes that evaluate the returned status field from Replicate, controlling the polling and exit paths of the n8n workflow.
Wait 5s / Wait 10s (Wait n8n node): Implements time delays necessary for asynchronous polling, preventing rate-limiting issues on the Replicate API.
Success Response / Error Response (Set n8n node): These n8n nodes ensure the final output is standardized, providing clear results (success with URL) or comprehensive error messages for easier downstream integration of this n8n workflow.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Building AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host If you need any help with Automations, feel free to reach out via linkedin: https://www.linkedin.com/in/yaronbeen/ And check out my Youtube channel: https://www.youtube.com/@YaronBeen/videos

Featured*