Image Generator using IBM Granite Vision 3.3 2B via Replicate - n8n Workflow

Use this advanced n8n workflow to generate high-quality images using the IBM Granite Vision 3.3 2B model via Replicate. Easily set up these powerful n8n templates for automated AI art generation.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Developers and creators who require integration of cutting-edge AI image generation models like IBM Granite into their applications.

  • Users looking for robust n8n templates that demonstrate advanced API polling and flow control.

  • Automation specialists needing a reliable n8n workflow for long-running, asynchronous tasks.

Overview

Generating complex AI outputs, especially images, often requires an asynchronous process where the initial API call returns an ID, and the application must continuously poll until the result is ready. This n8n workflow is a perfect example of handling such complex asynchronous operations reliably.

This specific n8n workflow uses a manual n8n trigger to initiate the process. It securely sets the necessary API key and then initiates the image generation request to the Replicate API, specifically targeting the IBM Granite Vision 3.3 2B model. By implementing a polling loop using the n8n node system (Wait and If nodes), this automation ensures that the n8n workflow only proceeds once the image is fully generated, preventing timeouts and ensuring stable operation when dealing with external AI services. This structure makes these n8n templates highly valuable for production environments.

How it Works

The n8n workflow begins with the 'On clicking 'execute'' n8n trigger, allowing the user to start the generation process manually.


  1. Key Setup: The 'Set API Key' n8n node securely stores the necessary Replicate API key for subsequent requests.

  2. Initiate Generation: The 'Create Prediction' HTTP Request n8n node sends a POST request to Replicate's prediction endpoint, requesting image generation using the specified model version (ibm-granite/granite-vision-3.3-2b).

  3. Extraction: The 'Extract Prediction ID' code n8n node parses the initial response to obtain the unique predictionId and constructs the necessary polling URL.

  4. Polling Loop Initiation: The n8n workflow enters a control loop, starting with the 'Wait' n8n node, which pauses execution for 2 seconds.

  5. Status Check: The 'Check Prediction Status' HTTP Request n8n node uses the prediction ID to query the current status of the AI job.

  6. Flow Control: The 'Check If Complete' If n8n node evaluates the status. If the status is 'succeeded', the flow proceeds to processing the output. If the status is anything else (e.g., 'processing', 'starting'), the n8n workflow loops back to the 'Wait' n8n node to pause and re-check the status, ensuring the process is robust.

  7. Final Output: Once successful, the 'Process Result' code n8n node extracts the final generated image URL and related metadata, completing the entire n8n workflow run.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Configure Credentials: This n8n workflow requires credentials for Replicate.

- Create an account on Replicate and obtain your API key.
- In the 'Set API Key' n8n node, replace YOURREPLICATEAPI_KEY with your actual key. While this template uses a Set node for simplicity, it is highly recommended to configure a secure Generic Credential within n8n and use the expression {{ $('Replicate Credential Name').key }} in the HTTP Request nodes for better security.

  1. Run: Click the 'Execute Workflow' button in the n8n interface to test the manual n8n trigger.

Node Details


  • On clicking 'execute' (Manual Trigger): The starting point, acting as the primary n8n trigger for the entire generation process.

  • Set API Key (Set n8n node): Temporarily stores the Replicate API key (replicateapikey) to be referenced dynamically in the subsequent HTTP requests.

  • Create Prediction (HTTP Request n8n node): Initiates the AI generation job. It posts the configuration parameters to the Replicate API, leveraging the API key set in the previous n8n node for authorization.

  • Extract Prediction ID (Code n8n node): Essential for asynchronous handling. This custom n8n node extracts the unique id returned by the initial request and defines the URL for status polling.

  • Wait (Wait n8n node): Enforces a 2-second delay between status checks, preventing excessive API calls and respecting rate limits during the polling process of this n8n workflow.

  • Check Prediction Status (HTTP Request n8n node): Queries the status of the job using the generated prediction ID URL, continuing the polling loop.

  • Check If Complete (If n8n node): The core logic of the loop. It checks if the returned status equals 'succeeded'. If true, the n8n workflow finishes; otherwise, it loops back to the 'Wait' n8n node.

  • Process Result (Code n8n node): The final step in this n8n workflow, which takes the successful job data and structures the output, isolating the final image_url for further 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*