Replicate AI Content Generation with Status Polling - n8n Workflow

Use this robust n8n workflow to automate AI content generation via the Replicate API's moicarmonas/2ndmoises_generator model, including asynchronous status polling and comprehensive error handling. This n8n template simplifies complex AI tasks.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI Developers needing a reliable n8n template for asynchronous Replicate tasks.

  • Content Creators looking to scale image or content generation using a customizable n8n workflow.

  • Automation Engineers requiring production-ready solutions with built-in polling logic in n8n.

  • Users of the Replicate platform seeking seamless integration within their existing n8n environment.

Overview

Generating large AI outputs often requires asynchronous processing, meaning you submit a request and must poll the API until the job is complete. This complex task is expertly managed by this n8n workflow, which specifically interfaces with the moicarmonas/2ndmoises_generator model on Replicate.

This n8n template provides a complete, production-ready solution that handles authentication, configures numerous generation parameters (like prompt, size, seed, and quality), submits the prediction request, and crucially, manages the polling loop using dedicated n8n node components. The workflow ensures that whether the generation succeeds or fails, a clear, structured JSON response is provided, making it an essential automation tool for leveraging external AI APIs in n8n.

How it Works

This n8n workflow follows a reliable pattern for asynchronous API handling:


  1. Trigger and Setup: The process begins with the Manual Trigger n8n trigger. Initial nodes (Set API Token and Set Other Parameters) securely inject the Replicate API key and define all parameters (prompt, image settings, etc.) necessary for the AI generation.

  2. Prediction Request: The Create Other Prediction n8n node uses an HTTP Request to initiate the generation process on Replicate, receiving a unique Prediction ID for tracking.

  3. Logging and Initial Wait: A code n8n node logs the request details, followed by the Wait 5s n8n node, which ensures a short delay before polling begins.

  4. Status Polling Loop: The Check Status HTTP Request n8n node queries the Replicate API using the Prediction ID to fetch the current job status.

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

If Succeeded: The workflow routes to Success Response, formatting the output URL and prediction data.
If Not Complete: The Has Failed? n8n node checks for a failed status.
If Failed: It routes to Error Response to capture and report the failure details.
If Still Processing: It routes to the Wait 10s n8n node and then loops back to Check Status, repeating the polling cycle until completion.

  1. Final Result: The final Display Result n8n node consolidates the success or error object for clear output.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


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

  2. Replicate API Key: Obtain your API token from Replicate.com.

  3. Configure Credentials: Locate the Set API Token n8n node. Replace the placeholder value YOURREPLICATEAPI_TOKEN with your actual Replicate API key. Ensure this credential is never publicly exposed.

  4. Customize Parameters: Review the Set Other Parameters n8n node. Adjust the prompt, width, height, and other model-specific parameters to fit your generation requirements. This n8n node contains all inputs for the AI model.

  5. Activate: Save and activate the n8n workflow. Run it by clicking the 'Manual Trigger' n8n trigger to test the automation.

Node Details

Manual Trigger (n8n trigger): Initiates the execution of the entire n8n workflow, typically used for testing or when the workflow is manually triggered.
Set API Token (n8n node): A crucial step to store the private Replicate API key securely, referenced by subsequent HTTP Request nodes for authentication.
Set Other Parameters (n8n node): Gathers and configures all necessary inputs for the moicarmonas/2ndmoisesgenerator model, including the prompt, seed, aspectratio, and output_format.
Create Other Prediction (HTTP Request n8n node): Sends the initial POST request to the Replicate API to start the asynchronous AI generation process. It uses the authorization token set earlier.
Wait 5s / Wait 10s (n8n node): Implements time delays necessary for asynchronous polling, preventing immediate re-checks and managing API rate limits effectively within this n8n template.
Check Status (HTTP Request n8n node): Periodically checks the status of the prediction job using the prediction ID returned in the initial request.


  • Is Complete? / Has Failed? (If n8n node): These core logic n8n nodes control the flow, checking the job status (succeeded, failed, or processing) to determine whether to exit with a result, an error, or retry the status check.

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*