Enhance Your Workflow with 2Ndmoises_Generator AI
This n8n workflow integrates with Replicateβs moicarmonas/2ndmoises_generator model to generate custom outputs based on your prompt. It handles authentication, triggers the prediction, monitors progress, and processes the final result automatically.
π Section 1: Trigger & Authentication
β‘ On Clicking βExecuteβ (Manual Trigger)
- Purpose: Start the workflow manually whenever you want to run it.
- Benefit: Great for testing or running on-demand without needing automation.
π Set API Key (Set Node)
- Purpose: Stores your Replicate API key in the workflow.
- How it works: Adds your API key as a variable that other nodes can reference.
- Benefit: Keeps credentials secure and reusable.
π Section 2: Sending the AI Request
π€ Create Prediction (HTTP Request Node)
π Extract Prediction ID (Code Node)
- Purpose: Pulls out the Prediction ID and status from the API response.
- Why important: The ID is required to check the jobβs progress later.
- Benefit: Automates polling without manual tracking.
π Section 3: Polling & Waiting
β³ Wait (Wait Node)
- Purpose: Adds a short pause (2 seconds) between checks.
- Benefit: Prevents hitting the API too quickly and avoids errors.
π Check Prediction Status (HTTP Request Node)
- Purpose: Calls Replicate again to ask if the prediction is finished.
- Benefit: Automates progress monitoring without manual refresh.
β
Check If Complete (If Node)
π Section 4: Handling the Result
π¦ Process Result (Code Node)
-
Purpose: Cleans up the final API response and extracts:
- Status
- Output (generated result)
- Metrics
- Timestamps (created_at / completed_at)
- Model info
-
Benefit: Provides a structured, ready-to-use output for other workflows or integrations.
π Workflow Overview Table
| Section |
Node Name |
Purpose |
| 1. Trigger & Auth |
On Clicking βExecuteβ |
Starts the workflow manually |
|
Set API Key |
Stores API credentials |
| 2. AI Request |
Create Prediction |
Sends request to Replicate |
|
Extract Prediction ID |
Gets prediction ID + status |
| 3. Polling |
Wait |
Adds delay before recheck |
|
Check Prediction Status |
Monitors progress |
|
Check If Complete |
Routes based on completion |
| 4. Result |
Process Result |
Extracts and cleans output |
| Notes |
Sticky Note |
Explains setup + model info |
π― Key Benefits
- π Secure authentication using Set node for API key storage.
- π€ Hands-free generation β just provide a prompt, the workflow handles everything else.
- π Automated polling ensures you always get the final result without manual checking.
- π¦ Clean structured output ready for downstream use in apps, dashboards, or notifications.