Replicate AI Image Generation and Status Polling - n8n Workflow

Use this comprehensive n8n workflow to integrate Replicate's creativeathive/lemaar-door-mockedup AI model. Automate image generation, handle async processing via status polling, and manage structured success/error responses in n8n.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted text:
AI Developers needing to integrate complex, asynchronous AI models (like Replicate) into business processes.
Users looking for high-quality, production-ready n8n templates for image generation.
Engineers who require reliable polling logic within an n8n workflow to handle long-running API tasks.
Automation Specialists looking to customize the creativeathive/lemaar-door-mockedup model parameters via a low-code platform.

Overview

This specialized n8n workflow is designed to streamline the use of the Replicate API for AI content creation, specifically utilizing the creativeathive/lemaar-door-mockedup model. Since AI generation tasks are often asynchronous, this n8n template provides a robust solution for initiating the prediction and then continuously polling the API until the result is ready or the process fails. Unlike simple HTTP requests, this n8n workflow includes built-in retry logic and comprehensive success/error handling, making it a reliable foundation for any production environment. It starts by configuring your API token and generation parameters, allowing for highly customized inputs like prompt, image mask, and dimensions, before automating the entire polling cycle. This is a crucial n8n workflow for anyone working with modern AI services.

How it Works

The execution begins with the Manual Trigger, which acts as the starting point for this specific n8n workflow.


  1. Configuration: The flow first sets the required Replicate API token using the 'Set API Token' n8n node, followed by defining all image generation parameters (prompt, mask, seed, image URL, dimensions) in the 'Set Other Parameters' n8n node. This ensures the prediction request is fully formed.

  2. Initiation: The 'Create Other Prediction' HTTP Request n8n node sends a POST request to Replicate's predictions endpoint, initiating the AI generation process. It immediately returns a prediction ID.

  3. Polling Setup: The workflow logs the request and then enters a polling loop, starting with 'Wait 5s'.

  4. Status Check: The 'Check Status' HTTP Request n8n node uses the prediction ID to query the status of the generation task.

  5. Conditional Routing: The 'Is Complete?' If n8n node checks if the status is 'succeeded'.

If successful, it routes to 'Success Response' to format the output URL and completion details.
If not successful, it checks 'Has Failed?' for a 'failed' status.

  1. Failure/Retry: If the status is 'failed', the workflow routes to 'Error Response'. If the generation is still running, the flow loops back through 'Wait 10s' to introduce a delay before retrying the 'Check Status' n8n node, ensuring efficient resource usage while waiting for completion.

  2. Finalization: Both success and error paths lead to the 'Display Result' n8n node, providing a clean, structured JSON output for the final result.

Installation Guide

Markdown-formatted text:


  1. Import the n8n Workflow: Copy the provided JSON data and paste it directly into your n8n instance using the 'New' menu -> 'Import from JSON'.

  2. Configure Replicate Credentials:

Navigate to the 'Set API Token' n8n node.
Replace the placeholder YOURREPLICATEAPI_TOKEN value with your actual token obtained from your Replicate account settings.

  1. Adjust Parameters:

Open the 'Set Other Parameters' n8n node.
Modify inputs such as prompt, image, mask, width, and height to match your desired output for the creativeathive/lemaar-door-mockedup model.

  1. Execution: Click the 'Manual Trigger' n8n trigger node and run the n8n workflow to test the image generation and polling logic.

Node Details

Markdown-formatted text:
Manual Trigger: The starting n8n trigger. Initiates the AI generation process when executed manually.
Set API Token (Set n8n node): Stores the necessary API key (apitoken) required for authenticating requests to the Replicate service.
Set Other Parameters (Set n8n node): Central configuration point. Defines all input variables for the AI model, including prompt ("Create something amazing"), image (a placeholder URL), and various control parameters like width, height, and numinference_steps.
Create Other Prediction (HTTP Request n8n node): Submits the generation request to https://api.replicate.com/v1/predictions. It dynamically injects all parameters from the previous set node into the JSON body and uses the API token in the Bearer Authorization header.
Log Request (Code n8n node): Executes JavaScript code to log key details of the request (like the prediction ID and timestamp) for monitoring and debugging purposes within the n8n execution log.
Wait 5s / Wait 10s (Wait n8n node): Used to implement non-blocking delays in the polling loop. Ensures the workflow waits for the asynchronous AI process to make progress before checking the status again.
Check Status (HTTP Request n8n node): Performs a GET request using the prediction ID received earlier. This n8n node is central to the polling mechanism, fetching the current status of the AI job.
Is Complete? (If n8n node): Logic gate that checks if the returned status from Replicate is succeeded. Routes the n8n workflow down the success path if true.
Has Failed? (If n8n node): Logic gate that checks if the status is failed. Routes the n8n workflow to error handling if the generation job failed.
Success Response / Error Response (Set n8n node): These nodes structure the final output, providing a clear JSON response indicating success (with the result URL) or failure (with error details).

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*