AI Image Generation and Polling using Replicate Flash V2 Model - n8n Workflow

Use this robust n8n workflow to automate asynchronous AI image generation with the Replicate Flash V2.0.1 model. This n8n template includes intelligent status polling and error handling.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI Developers & Automation Engineers: Seeking production-ready n8n templates for integrating third-party AI services like Replicate.

  • Content Creators: Requiring automated, scheduled generation of images or digital assets.

  • Users Familiar with n8n: Looking for examples of advanced flow control, like polling loops, within a custom n8n node setup.

Overview

Generating high-quality AI outputs often requires asynchronous processing, meaning you must initiate a request and then repeatedly check the status until completion. This specific n8n workflow solves this complexity by providing a complete, production-ready automation for accessing the settyan/flash-v2.0.1-beta.10 model on Replicate.

This robust n8n template streamlines the process from prompt input to final image URL, handling API configuration, prediction creation, necessary waiting periods, status polling via HTTP Request n8n node, and comprehensive success/failure reporting. Leveraging the power of n8n, this automation ensures reliability and resilience, making it a crucial component for any system that depends on external, resource-intensive AI models.

How it Works

This n8n workflow begins when the Manual Trigger n8n trigger is activated.


  1. Initialization: The 'Set API Token' n8n node securely injects the required Replicate API token into the workflow data stream. The subsequent 'Set Other Parameters' n8n node configures all necessary inputs for the AI model, including the prompt, dimensions (512x512 default), seed, and various generation parameters.

  2. Prediction Request: The 'Create Other Prediction' n8n node (an HTTP Request) sends a POST request to the Replicate API, initiating the image generation process using the specified Flash V2 model version. It immediately returns a prediction ID.

  3. Polling Loop Initiation: The 'Log Request' n8n node logs the prediction ID for monitoring, followed by a 'Wait 5s' n8n node, providing initial time for the model to start processing.

  4. Status Check & Loop: The 'Check Status' n8n node repeatedly queries the Replicate API using the prediction ID to fetch the current status. The 'Is Complete?' n8n node checks if the status is 'succeeded'.

  5. Flow Control:

If 'succeeded', the flow moves to the 'Success Response' n8n node to structure the final output, including the resulting image URL.
If not succeeded, the flow moves to 'Has Failed?'. If the status is 'failed', it generates an 'Error Response'.
* If the status is neither 'succeeded' nor 'failed' (meaning it is still processing), the flow enters the 'Wait 10s' n8n node before looping back to 'Check Status', implementing a persistent polling mechanism. This retry logic ensures the n8n workflow waits for the asynchronous process to complete.

  1. Final Output: The final result (success or error) is processed by the 'Display Result' n8n node.

Installation Guide

To deploy this powerful n8n workflow and generate AI images, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' button -> 'Import from JSON'. This imports the complete n8n template.

  2. Obtain Replicate Credentials: Sign up or log in to Replicate and retrieve your API token.

  3. Configure API Token: Navigate to the 'Set API Token' n8n node. Replace the placeholder value YOURREPLICATEAPI_TOKEN with your actual Replicate token.

  4. Customize Parameters: Open the 'Set Other Parameters' n8n node. Adjust the prompt and other optional parameters (like width, height, or seed) as required for your generation needs. This is a critical configuration step for this specific n8n node.

  5. Activate and Run: Set the n8n workflow to 'Active' and execute it manually via the 'Manual Trigger' n8n trigger for testing.

Node Details

Manual Trigger (n8n trigger): Initiates the n8n workflow upon manual click, ideal for testing and starting production runs.
Set API Token (n8n node): A crucial Set n8n node that securely stores the apitoken for Replicate, accessed by subsequent HTTP Request nodes for authorization.
Set Other Parameters (n8n node): Defines all input parameters required by the flash-v2.0.1-beta.10 model, including the core prompt, image dimensions, and advanced settings like guidancescale and numinferencesteps.
Create Other Prediction (HTTP Request n8n node): Sends the initial request to api.replicate.com/v1/predictions. Key configuration includes setting the Authorization header using the token from the previous n8n node.
Log Request (Code n8n node): Used for monitoring and debugging. It logs the prediction ID and timestamp, helping track the execution of this n8n workflow.
Wait 5s / Wait 10s (n8n node): Implements fixed delay periods, essential for managing the asynchronous nature of the Replicate API and preventing excessive polling before the AI process has started or advanced.
Check Status (HTTP Request n8n node): Performs the necessary polling by sending a GET request to retrieve the status of the prediction, forming the core logic loop of this n8n template.
Is Complete? / Has Failed? (If n8n node): These core logic n8n nodes control the flow based on the prediction status (checking specifically for 'succeeded' or 'failed'), directing the n8n workflow to the appropriate response handler.

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*