OpenAI CLIP Image and Text Embeddings via Replicate API - n8n Workflow

Automate generating OpenAI CLIP image and text embeddings using the Replicate API with this comprehensive n8n workflow. Includes polling, error handling, and structured results.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

AI Developers and Engineers needing automated embedding generation.
Data Scientists requiring scalable image and text processing.
Users looking for advanced n8n templates integrating external AI services.
Anyone needing a robust n8n workflow with built-in polling and error handling.

Overview

Generating vector embeddings for multimodal data (like images and text) is a foundational task in modern AI applications, especially for building RAG systems or similarity search. This specialized n8n workflow addresses the complexity of async API requests, specifically targeting the highly effective OpenAI CLIP model via the Replicate API.

This comprehensive n8n template handles the entire asynchronous process: initiating the prediction, logging the request, setting up polling via n8n node logic, and providing intelligent success or failure responses. By using this ready-made n8n workflow, users can save significant development time, ensuring reliable communication with the Replicate platform for all their embedding needs. This sophisticated automation guarantees that every request, managed by a dedicated n8n node, is tracked until completion, making the integration production-ready.

How it Works

The process is initiated by the Manual Trigger n8n trigger. The following steps execute the core logic:


  1. Configuration Setup: The n8n workflow first uses Set API Token to store the Replicate API key and Set Image Parameters to define the input image URL (e.g., https://picsum.photos/512/512) and text prompt, preparing the payload.

  2. Prediction Request: The Create Image Prediction n8n node (an HTTP Request) sends a POST request to Replicate to start the CLIP generation process, returning a prediction ID.

  3. Initial Wait: The Log Request n8n node records essential details, followed by a Wait 5s n8n node to give the service time to start processing.

  4. Polling Loop: The Check Status n8n node repeatedly queries the Replicate API using the received prediction ID to check the job's current status.

  5. Conditional Routing: The Is Complete? n8n node checks if the status is 'succeeded'. If not, the flow moves to the Has Failed? n8n node.

  6. Retry Mechanism: If the job is still running (not failed, not succeeded), the workflow uses the Wait 10s n8n node and loops back to Check Status, ensuring continuous polling until a result is returned.

  7. Final Response: Based on the outcome, the data is routed to either the Success Response or Error Response n8n node, which formats a clean JSON object containing the embeddings or error details. Finally, the Display Result n8n node concludes the n8n workflow execution.

Installation Guide

To use this n8n template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' button, then selecting 'Import Workflow from JSON'.

  2. Replicate API Key: Obtain a Replicate API token by signing up on their platform.

  3. Configure API Token: Locate the Set API Token n8n node and replace the placeholder YOURREPLICATEAPI_TOKEN with your actual Replicate secret key.

  4. Customize Parameters: Modify the Set Image Parameters n8n node to change the input image URL or the text prompt you wish to generate embeddings for.

  5. Activate and Test: Activate the n8n workflow and click the 'Manual Trigger' n8n trigger to test the end-to-end automation.

Node Details

Manual Trigger (n8n trigger): Initiates the generation of the embeddings whenever executed.
Set API Token (n8n node): Securely stores the Replicate API key, which is later referenced in HTTP requests using expressions.
Set Image Parameters (n8n node): Defines the multimodal inputs (text and image URL) necessary for the OpenAI CLIP model. This makes the n8n workflow flexible.
Create Image Prediction (n8n node - HTTP Request): Sends the initial asynchronous request to the Replicate API, starting the embedding generation job. It handles authorization using the Bearer token retrieved from the Set API Token n8n node.
Log Request (n8n node - Code): Used for debugging and monitoring, logging essential prediction details at the start of the process.
Wait 5s / Wait 10s (n8n node): Implement time delays critical for asynchronous polling loops, preventing rate limiting and optimizing resource usage within the n8n workflow.
Check Status (n8n node - HTTP Request): Repeatedly polls the status endpoint using the prediction ID until the job is complete.
Is Complete? / Has Failed? (n8n node - IF): Core flow control nodes that manage the retry logic. They check the status field to determine if the job succeeded, failed, or needs more time to run. This robust logic is central to this n8n template.


  • Success Response / Error Response (n8n node - Set): Standardizes the final JSON output, providing clear, actionable feedback regardless of whether the generation succeeded or failed.

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*