Replicate AI Image Generation with Status Polling Loop - n8n Workflow

Automate AI media generation using the Settyan Flash V2.0.0 Beta.4 model on Replicate. This robust n8n workflow template uses status polling to reliably retrieve the final image output.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation engineers needing to integrate complex, time-consuming AI APIs.
Developers looking for a robust, production-ready n8n template for asynchronous tasks.
Content creators who want to automatically generate images using the Settyan Flash V2.0.0 Beta.4 model.
Users who want to understand how to build resilient polling logic within an n8n workflow.

Overview

Generating high-quality AI content, such as images using models like Settyan Flash V2.0.0 Beta.4, is often an asynchronous process. Standard HTTP requests fail because the server requires time to generate the output before returning a result. This specialized n8n workflow solves this challenge by implementing a reliable polling mechanism.

This robust n8n workflow first initiates the generation request via Replicate. It then enters a wait-check-loop structure, constantly querying the API for the current status of the prediction ID. This structure ensures that the n8n automation only proceeds to the final step once the image generation is successfully completed, providing a dependable solution for production-grade AI automation. This specific n8n workflow utilizes the power of several core n8n node types to achieve this complex logic seamlessly.

How it Works

The n8n workflow begins with a manual n8n trigger, allowing the user to initiate the process on demand.


  1. API Key Configuration: The first n8n node, 'Set API Key', defines the necessary Replicate API key, which is dynamically passed as a Bearer token in subsequent requests.

  2. Initiate Generation: The 'Create Prediction' n8n node uses an HTTP Request to POST to the Replicate API, specifying the settyan/flash-v2.0.0-beta.4 model and input parameters (like prompt, seed, width). This step receives a predictionId.

  3. Extract ID: The 'Extract Prediction ID' n8n node (a Code n8n node) parses the initial response, isolates the predictionId, and constructs the necessary polling URL.

  4. Polling Loop Initiation: The n8n workflow pauses for 2 seconds using the 'Wait' n8n node to prevent aggressive API calls.

  5. Check Status: The 'Check Prediction Status' n8n node polls the unique URL constructed earlier to retrieve the current status of the AI job.

  6. Conditional Check: The 'Check If Complete' n8n node evaluates the returned status. If the status is 'succeeded', the n8n workflow exits the loop and moves to 'Process Result'. If the status is anything else (e.g., 'processing'), the flow loops back to the 'Wait' n8n node, repeating the polling cycle until the image is ready.

  7. Final Processing: Once complete, the 'Process Result' n8n node extracts the final output URL and other metadata, completing this sophisticated n8n workflow template.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


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

  2. API Key Setup: Locate the 'Set API Key' n8n node. Replace the placeholder value YOURREPLICATEAPI_KEY with your actual API key obtained from Replicate.

  3. Credential Setup (Optional but Recommended): While the current n8n workflow uses the 'Set' node for the key, for production environments, you should create a dedicated Generic Credential within n8n and update the 'Create Prediction' and 'Check Prediction Status' n8n nodes to use this credential.

  4. Configure Input: Review the JSON body within the 'Create Prediction' n8n node. Update the prompt, seed, width, and height values to customize the image output you desire.

  5. Execution: Click the 'Save' button and then click the 'Execute Workflow' button (the manual n8n trigger) to test the entire polling sequence.

Node Details

This n8n workflow template uses several key n8n nodes to manage the asynchronous nature of Replicate's API:

On clicking 'execute' (Manual Trigger): The starting point, acting as the primary n8n trigger for this automation.
Set API Key (Set n8n Node): Crucial for defining environment variables, in this case, securely storing the replicateapikey for use in subsequent HTTP headers.
Create Prediction (HTTP Request n8n Node): Submits the generation request to Replicate. It uses dynamic authorization based on the API key set earlier. This n8n node defines the core parameters for the Settyan Flash model.
Extract Prediction ID (Code n8n Node): Executes custom JavaScript to parse the JSON response and extract the unique ID required for tracking the job status. This helps organize data flow within the n8n workflow.
Wait (Wait n8n Node): Provides essential flow control by pausing the n8n workflow for 2 seconds, which is standard practice in polling loops to avoid rate limiting.
Check Prediction Status (HTTP Request n8n Node): Performs the necessary polling, querying the specific prediction URL. This n8n node is the heart of the recursive loop.
Check If Complete (If n8n Node): The condition checker that controls the flow. It determines whether the status equals 'succeeded' or if the n8n workflow needs to repeat the wait-and-check cycle.
Process Result (Code n8n Node): The final transformation step, taking the completed AI output data and restructuring it into a cleaner format for downstream use.

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*