Use this robust n8n workflow template to automate the creation of portrait image series from a single input using the Replicate API. Features resilient polling and error handling.
Download this n8n workflow template and start using it instantly.
This comprehensive n8n workflow provides a production-ready solution for leveraging powerful AI models on Replicate. Specifically, it targets the flux-kontext-apps/portrait-series model to generate multiple, high-quality portrait images from a single source input. Unlike simple synchronous calls, this n8n template manages the entire asynchronous lifecycle: initiating the prediction, logging the request ID, waiting, and repeatedly checking the status until the image generation succeeds or fails. This critical polling logic ensures that even long-running AI tasks are handled reliably within your n8n infrastructure. Every n8n node is configured for maximum efficiency, providing structured success and error responses, making this a highly valuable n8n workflow for image automation.
The process begins with the Manual Trigger, which acts as the initial n8n trigger for execution.
Set n8n node to define the required Replicate API token and another Set n8n node (Set Image Parameters) to configure inputs like the source inputimage, numimages, and background details for the AI model.Create Image Prediction HTTP Request n8n node sends a POST request to the Replicate API, starting the image generation task. It receives a prediction ID and logs it using the Log Request Code n8n node.Wait 5s n8n node. It then uses the Check Status HTTP Request n8n node to fetch the current status of the prediction using the received ID.Is Complete? If n8n node checks if the status is 'succeeded'. Success Response n8n node.Has Failed? If n8n node, checking for the 'failed' status.Error Response n8n node formats the failure message.Wait 10s n8n node before looping back to Check Status to poll again.Display Result n8n node, completing the execution of this complex n8n workflow.To deploy this powerful n8n workflow, follow these steps:
Set API Token n8n node. Edit this node and replace the placeholder YOURREPLICATEAPITOKEN with your actual Replicate API key. Ensure this key is correct, as it is essential for the Create Image Prediction n8n node.Set Image Parameters n8n node. Update the inputimage URL to point to the source image you wish to use. Adjust optional parameters like num_images (default 4) or background as needed. This n8n workflow utilizes several key n8n node types to achieve reliable asynchronous AI generation:
Manual Trigger: The starting n8n trigger point for manually executing the workflow.
Set API Token / Set Image Parameters (Set n8n node): Used for initializing variables, securely storing the API key, and setting the required model inputs (e.g., inputimage, numimages). This decoupling makes the n8n workflow easier to manage.
Create Image Prediction (HTTP Request n8n node): The core action n8n node that initiates the AI generation. Key configuration includes using the POST method, setting the Authorization: Bearer {{ $json.api_token }} header, and passing the dynamic image input parameters in the JSON body.
Log Request (Code n8n node): A utility n8n node used for monitoring and debugging, ensuring the prediction ID is logged after the initial API call.
Wait 5s / Wait 10s (Wait n8n node): Essential for managing the polling delay, ensuring the n8n workflow doesn't overwhelm the Replicate API while waiting for results.
Check Status (HTTP Request n8n node): Repeatedly polls the status URL (/v1/predictions/{{ id }}) using the prediction ID to monitor progress.
Is Complete? / Has Failed? (If n8n node): These conditional n8n nodes implement the core polling logic, directing the flow based on whether the AI job has 'succeeded', 'failed', or is still 'processing'.
Success Response / Error Response (Set n8n node): Used to structure the final output data, ensuring the consumer of this n8n workflow receives a clear, standardized JSON object detailing the result or the error.
Use this powerful n8n workflow template to automate AI image generation using the Replicate API and the paigedutcher2/paige model. Learn robust status polling using the n8n node structure.

Leverage this powerful n8n workflow to build a Spotify chat agent using GPT-4. Create custom playlists, control playback (pause, skip), and search tracks automatically using dedicated n8n templates.

Use this efficient n8n workflow to automatically generate highly personalized sales emails (subject and body) for leads stored in Google Sheets using the power of the Google Gemini AI model. Explore more n8n templates for AI operations.

Build a dynamic product satisfaction survey using this complex n8n workflow. It integrates Telegram, Google Sheets, Redis, and OpenAI/LangChain agents to ask follow-up questions for deeper insights.

Use this robust n8n workflow to automatically generate high-quality animated videos using Bytedance's Omni-Human AI via the Replicate API. Features smart polling and error handling. Find more n8n templates here.

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







































