AI Image/Content Generation with Replicate and Flash V2 - n8n Workflow

Automate AI image and content generation using the powerful Flash V2.0.0 model via Replicate. This robust n8n workflow template includes intelligent status checking 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 integrating Replicate models into production applications.

  • Content creators needing programmatic access to advanced image generation capabilities.

  • Users looking for advanced examples of robust polling loops within an n8n workflow.

  • n8n automation specialists building reliable, scalable content pipelines.

Overview

This robust n8n workflow provides a complete solution for asynchronously running complex AI generation tasks using the Replicate platform. The challenge with most text-to-image models is the waiting time; this n8n template solves that by implementing an intelligent polling mechanism. It starts the generation using the settyan/flash-v2.0.0-beta.9 model via a dedicated HTTP Request n8n node, records the prediction ID, and then continually checks the status until the image generation is complete or fails. This is a crucial n8n workflow pattern for dealing with long-running API operations, ensuring high reliability, proper logging, and structured error handling.

How it Works

The n8n workflow is initiated by the Manual Trigger n8n trigger.


  1. Configuration Setup: The flow begins by using two dedicated Set n8n nodes to configure the Replicate API token and all necessary model parameters (such as prompt, width, height, and generation settings).

  2. Initiate Generation: The Create Other Prediction HTTP Request n8n node sends a POST request to Replicate's prediction endpoint, starting the Flash V2.0.0 generation process. It uses the configured Bearer token and dynamically injects all input parameters, receiving a prediction ID in response.

  3. Monitor & Log: A Code n8n node (Log Request) captures the initial prediction details for debugging before an initial 5-second wait period (Wait 5s).

  4. Polling Loop: The Check Status HTTP Request n8n node uses the prediction ID to query the status of the job from the Replicate API. This is the core of the monitoring loop.

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

If successful, the n8n workflow routes to Success Response, which formats the final output, including the result URL.
If not successful, it moves to the Has Failed? If n8n node.

  1. Failure Handling: If the status is 'failed', the workflow routes to Error Response to return structured error details.

  2. Retry Logic: If the status is neither 'succeeded' nor 'failed' (meaning it is 'processing' or 'starting'), the n8n workflow enters a retry loop via the Wait 10s n8n node, looping back to Check Status to continue monitoring the job status.

  3. Final Output: Both success and failure paths conclude by passing the structured data to the Display Result n8n node for final display or subsequent steps.

Installation Guide

To start using this powerful n8n workflow, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data. Navigate to your n8n instance, click "+ New", and select "Import from JSON" to load this n8n template.

  2. Get Replicate Credentials: Obtain an API key from your Replicate account.

  3. Set API Key: Locate the Set API Token n8n node. Replace the placeholder value YOURREPLICATEAPI_TOKEN with your actual Replicate API key. This is essential for the HTTP Request n8n nodes to authenticate.

  4. Customize Parameters: Review the Set Other Parameters n8n node. Adjust the prompt (e.g., "A cyberpunk cityscape at sunset"), image dimensions (width, height), or other advanced generation parameters as required for the settyan/flash-v2.0.0-beta.9 model.

  5. Execution: Save the n8n workflow and click "Execute Workflow" or trigger the Manual Trigger n8n trigger to run the generation process.

Node Details

Manual Trigger (n8n trigger): The starting point, used to execute the image generation n8n workflow on demand.
Set API Token (Set n8n node): Configures and securely passes the Replicate Bearer API token for authentication in subsequent HTTP Request n8n nodes.
Set Other Parameters (Set n8n node): A centralized configuration hub defining over 20 parameters for the AI model, including the core prompt, aspectratio, and technical settings like numinference_steps.
Create Other Prediction (HTTP Request n8n node): Sends the asynchronous generation request to the Replicate API endpoint, initiating the job and returning a unique prediction ID.
Log Request (Code n8n node): Used for internal monitoring and debugging. Logs the request timestamp and prediction ID, demonstrating best practices within an n8n workflow.
Wait 5s / Wait 10s (Wait n8n node): Implements crucial waiting periods to manage API call frequency during the asynchronous polling process.
Check Status (HTTP Request n8n node): The key component of the polling loop. This n8n node repeatedly checks the status of the prediction using the ID retrieved earlier.
Is Complete? / Has Failed? (If n8n node): These flow control n8n nodes determine the status branching, routing the n8n workflow based on whether the job succeeded (status == 'succeeded') or failed (status == 'failed').


  • Success Response / Error Response (Set n8n node): Formats the final output structure, providing a clean JSON response containing either the result URL or specific error messages, concluding the n8n workflow execution.

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*