Automated AI Image Generation using Flash v2.0 and Replicate Polling - n8n Workflow

Use this robust n8n workflow to automate text-to-image generation via the Replicate API's Flash v2.0 model. Features intelligent polling and comprehensive error handling in your n8n setup.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI Developers: Individuals needing reliable automation to integrate external AI models into larger applications using an n8n workflow.
Digital Artists & Content Creators: Users looking for automated, high-volume generation of images without manual status checking.
n8n Automation Specialists: Users who want to study advanced asynchronous API polling techniques within an n8n node structure.
Technical Teams: Groups requiring production-ready n8n templates for handling long-running API tasks.

Overview

Generating complex images via powerful AI models like Flash v2.0 often involves asynchronous processing, meaning the initial request immediately returns a pending status, requiring subsequent checks (polling) until completion. This specific n8n workflow solves this complexity entirely. It utilizes several core n8n node types—including HTTP Request and If nodes—to initiate the prediction, wait, and repeatedly check the status until the image generation succeeds or fails. This makes the n8n templates extremely resilient and production-ready, ensuring that your automation handles API latency gracefully. This powerful n8n setup abstracts the complexity of manual status polling, providing a clean, final output URL or a structured error message.

How it Works

The process begins with the Manual Trigger, which acts as the starting n8n trigger for the execution.


  1. Configuration: The n8n workflow first executes two Set n8n node steps: one to securely define the Replicate API Token and another to configure all necessary generation parameters (like prompt, size, seed, etc.) for the Flash v2.0 model.

  2. Initiate Prediction: The Create Other Prediction n8n node, an HTTP Request type, sends a POST request to Replicate to start the generation process, receiving an immediate Prediction ID.

  3. Logging: A Code n8n node logs the request details for monitoring purposes.

  4. Initial Wait: The n8n workflow pauses briefly using the Wait 5s n8n node to allow the AI process to start.

  5. Polling Loop: The Check Status n8n node repeatedly polls the Replicate API using the Prediction ID. This is the heart of the asynchronous logic.

  6. Decision Points: The Is Complete? and Has Failed? If n8n nodes evaluate the status received from the API.

If the status is 'succeeded', the n8n workflow proceeds to Success Response.
If the status is 'failed', it proceeds to Error Response.
* If the status is still 'processing' or 'starting', the workflow hits the Wait 10s n8n node and loops back to Check Status.

  1. Final Output: Based on the outcome, either the Success Response or Error Response n8n node structures the final JSON output, which is then captured by the Display Result n8n node.

Installation Guide

To import and run this n8n workflow, follow these steps:


  1. Import: Copy the provided JSON code and paste it into your n8n instance using the 'New' menu > 'Import from JSON'. This imports the complete n8n templates.

  2. API Key Setup: Locate the Set API Token n8n node (position: -608,-80).

  3. Authentication: Replace the placeholder value YOURREPLICATEAPITOKEN with your actual Replicate API key. This is critical for the HTTP Request n8n node to function.

  4. Customize Parameters: Navigate to the Set Other Parameters n8n node.

Modify the prompt value (default: 'Create something amazing') to describe the image you wish to generate.
Adjust optional parameters like width, height, or aspect
ratio as needed.

  1. Activation: Ensure the n8n workflow is active and click the Manual Trigger to test the complete flow.

Node Details

This n8n workflow leverages multiple powerful n8n node components:

Manual Trigger (n8n trigger): Initiates the entire n8n workflow execution. Ideal for development and testing of n8n templates.
Set API Token (n8n node): A Set node responsible for storing the confidential Replicate API key, which is later used for authorization headers in the HTTP Request n8n node.
Set Other Parameters (n8n node): Configures all 20+ input parameters required by the settyan/flash-v2.0.0-beta.0 model, centralizing customization for this n8n workflow.
Create Other Prediction (n8n node - HTTP Request): Sends the initial generation request to Replicate. Key configuration includes the Authorization header using the api_token variable.
Wait 5s / Wait 10s (n8n node): Essential Wait nodes that manage the timing of the polling loop, preventing API rate limit issues while monitoring long-running tasks.
Check Status (n8n node - HTTP Request): An HTTP Request n8n node that performs continuous polling, retrieving the current status of the prediction using the Prediction ID.


  • Is Complete? / Has Failed? (n8n node - If): These critical If n8n nodes control the flow based on the returned status ('succeeded' or 'failed'), routing the execution to the appropriate response handling path in the n8n workflow.

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*