AI Image Generation and Polling using Replicate (Paige Model) - n8n Workflow

Use this powerful n8n workflow template to automate AI image generation using the Replicate API and the paigedutcher2/paige model. Learn robust status polling using the n8n node structure.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI Developers and Engineers needing reliable, automated image generation.

  • Creators utilizing Replicate's specialized AI models like paigedutcher2/paige.

  • n8n users seeking advanced examples of asynchronous API request handling and polling logic.

  • System integrators looking to embed custom image generation capabilities into larger applications.

Overview

Handling asynchronous APIs—like those used in complex AI generation—requires robust status checking. This powerful n8n workflow template solves this challenge by implementing a complete status polling loop for the Replicate API.

This specific n8n workflow is designed to interact with the paigedutcher2/paige model, known for stylized image generation. The automation begins by securely setting the Replicate API token and configuring over 20 detailed generation parameters (prompt, seed, dimensions, etc.). It then sends the initial prediction request. Because AI image generation takes time, the n8n node structure includes a dedicated polling mechanism using Wait and If nodes to periodically check the prediction status until it is successfully completed or fails. This comprehensive approach ensures that every request is tracked and results are provided in a structured JSON response, making this an ideal, production-ready n8n template for AI automation.

How it Works

The automated process starts with the Manual Trigger n8n node, initiating the generation process instantly upon request.


  1. Configuration: The workflow first runs through two Set n8n node steps: one to securely load the Replicate API token and another to define all necessary AI generation parameters (such as prompt, width, height, and model version) which are later passed to the HTTP Request n8n node.

  2. Initial Request: The Create Other Prediction HTTP Request n8n node sends a POST request to Replicate’s prediction endpoint. This action is asynchronous, meaning it returns an ID immediately, and the prediction begins in the background.

  3. Logging and Initial Wait: A custom Code n8n node logs the request details, followed by a Wait 5s n8n node to give the service time to start processing.

  4. Status Polling Loop: The workflow enters a critical loop: the Check Status HTTP Request n8n node uses the prediction ID to GET the current status from Replicate.

  5. Decision Making: The Is Complete? If n8n node checks if the status equals 'succeeded'. If true, the workflow proceeds to the Success Response n8n node.

  6. Failure/Retry Logic: If not succeeded, the flow checks the Has Failed? If n8n node. If failed, it moves to Error Response. If neither succeeded nor failed (meaning it is still processing), it waits 10 seconds via the Wait 10s n8n node and loops back to the Check Status n8n node to re-poll.

  7. Final Output: The result (either the successful image URL or a detailed error message) is compiled in a structured object and presented by the final Display Result n8n node.

Installation Guide

To implement this powerful n8n workflow, follow these steps:


  1. Import: Copy the entire n8n workflow JSON and paste it directly into your n8n instance via the 'New' menu and selecting 'Import from JSON'. This is a ready-to-use n8n template.

  2. API Key Setup: Locate the Set API Token n8n node. Replace the placeholder value YOURREPLICATEAPI_TOKEN with your actual token obtained from Replicate (https://replicate.com/account/api-tokens).

  3. Customize Parameters: Navigate to the Set Other Parameters n8n node. Here, you can adjust the prompt, image URL (for image-to-image tasks), width, and other detailed settings for the paigedutcher2/paige model.

  4. Testing: Click the Manual Trigger n8n trigger to execute the workflow manually and confirm that the API connection and polling logic function correctly.

  5. Activation: Once testing is complete, remember to set the workflow to 'Active' to enable execution via webhooks or external triggers if desired (though this example uses a manual n8n trigger).

Node Details

This reliable n8n workflow utilizes several key n8n node types for flow control and API interaction:

Manual Trigger (n8n trigger): Serves as the starting point for manual testing and execution of the n8n workflow.
Set API Token (Set n8n node): Essential for security, this node stores the Replicate API Bearer token, which is referenced by subsequent HTTP Request n8n nodes.
Set Other Parameters (Set n8n node): Configures all input parameters (like prompt, seed, aspect_ratio) for the AI model using expressions referencing data passed from previous nodes.
Create Other Prediction (HTTP Request n8n node): This core n8n node sends the asynchronous POST request to the Replicate API to start the image generation. It uses dynamic JSON body data mapped from the 'Set Other Parameters' n8n node.
Log Request (Code n8n node): A utility n8n node that logs generation details to the console for monitoring and debugging purposes, a great feature for production-ready n8n templates.
Wait 5s / Wait 10s (Wait n8n node): Controls the pacing of the polling loop, ensuring the workflow doesn't overwhelm the API with status checks.
Check Status (HTTP Request n8n node): This n8n node continuously polls the API using the prediction ID to retrieve the job's status.
Is Complete? / Has Failed? (If n8n node): These conditional n8n nodes manage the polling logic, routing the flow based on the returned status ('succeeded', 'failed', or 'processing').

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*