AI Image Generation Pipeline using IBM Granite Vision and Replicate - n8n Workflow

Use this powerful n8n workflow to generate high-quality AI images instantly using the IBM Granite Vision 3.3 2B model via the Replicate API. Features asynchronous polling and robust error handling.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI Developers and Engineers: Seeking pre-built n8n templates for integrating advanced vision models into applications.
Automation Specialists: Users needing a robust, production-ready n8n workflow for long-running API tasks.
Content Creators: Individuals or teams who require automated, on-demand image generation capabilities.
n8n Users: Anyone looking for examples of implementing API polling logic within a complex n8n node sequence.

Overview

Generating high-resolution AI images often involves asynchronous API calls, requiring continuous polling to determine completion status. This complex logic can be challenging to implement reliably. This specific n8n workflow solves this by providing a complete, ready-to-use automation pipeline that utilizes the powerful IBM Granite Vision 3.3 2B model hosted on Replicate.

The n8n templates here handle the entire lifecycle: authentication, parameter setup, initiating the prediction, logging the request, setting up a wait-and-check polling loop, and finally delivering a structured success or failure response. By using this n8n automation, you ensure resilient and efficient integration of high-end image generation capabilities into any larger business process or application.

How it Works

This n8n workflow operates using an asynchronous polling strategy, beginning with the Manual Trigger n8n trigger.


  1. Initialization: The n8n workflow starts by securing the Replicate API Key using the Set API Token n8n node and defining all required AI image generation parameters (like prompt, seed, and image dimensions) in the Set Image Parameters n8n node.

  2. Prediction Initiation: The Create Image Prediction n8n node sends a POST request to the Replicate API, requesting generation using the specified IBM model version. Since generation is asynchronous, this step immediately returns a unique prediction ID.

  3. Logging: The Log Request n8n node logs the prediction ID for monitoring purposes.

  4. Polling Loop: The n8n workflow enters a status check loop. It first waits for 5 seconds (Wait 5s) and then executes the Check Status n8n node (an HTTP Request) to query Replicate using the prediction ID.

  5. Conditional Routing: The Is Complete? n8n node checks if the status is 'succeeded'. If true, the n8n workflow routes to Success Response. If not succeeded, it checks if the request Has Failed?.

  6. Retry Logic: If the status is still 'processing' or 'starting', the n8n workflow routes to Wait 10s, implementing a 10-second delay before looping back to Check Status for another attempt.

  7. Final Output: Upon success, the Success Response n8n node formats a structured JSON object containing the output image URL. Failures are handled by the Error Response n8n node, which returns detailed error information before the final Display Result n8n node showcases the outcome.

Installation Guide

To deploy and use this n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and import it into your self-hosted or cloud n8n instance via the Workflows section. This provides you with the complete n8n templates structure.

  2. Obtain API Credentials: Sign up for an account at Replicate and retrieve your API token.

  3. Configure API Key: Locate the Set API Token n8n node. Replace the placeholder value YOURREPLICATEAPI_TOKEN with your actual token.

  4. Customize Parameters: Navigate to the Set Image Parameters n8n node. Here you can adjust key inputs such as the prompt, seed, or other model-specific configurations before running the n8n workflow.

  5. Execute: Click the 'Manual Trigger' n8n trigger to run a test execution. Monitor the execution steps to ensure all API calls are successful. This fully functional n8n template is now ready for production use.

Node Details

Manual Trigger (n8n trigger): This is the starting n8n node, used primarily for manual testing and demonstration of the n8n workflow.
Set API Token (n8n node): A Set n8n node responsible for securely injecting the Replicate API token into the data stream for subsequent HTTP requests.
Set Image Parameters (n8n node): Configures inputs for the IBM Granite Vision model, including defaults for seed, image, and prompt used in the AI generation request.
Create Image Prediction (n8n node): An HTTP Request n8n node that sends the initial POST request to Replicate, triggering the asynchronous image generation process and obtaining the unique prediction ID.
Wait 5s / Wait 10s (n8n node): These Wait n8n nodes implement necessary delays (5s initially, then 10s for retries) to manage the polling frequency and prevent rate limiting while waiting for the AI process to complete.
Check Status (n8n node): An HTTP Request n8n node configured to poll the Replicate prediction status endpoint using the ID generated earlier. It determines if the image generation is complete.


  • Is Complete? / Has Failed? (n8n node): These IF n8n nodes manage the core flow control, checking the status field from the API response to route the n8n workflow to either success, failure, or back into the polling loop.

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*