
Transform Text to UGC Videos with OpenAI SORA-2 on Replicate
่ชฌๆ
Categories
๐ค AI & Machine Learning
Nodes Used
n8n-nodes-base.ifn8n-nodes-base.ifn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.coden8n-nodes-base.waitn8n-nodes-base.wait
Price็กๆ
Views0
ๆ็ตๆดๆฐ11/28/2025
workflow.json
{
"meta": {
"instanceId": "12e6f290a974a1eee154f8d915aade185e90e826260e6aeab8a087ba7386a1bc"
},
"nodes": [
{
"id": "a935b36c-4c47-423b-afbb-dc831fb66a0e",
"name": "Manual Trigger",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1024,
-80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ad8d0c58-ff3b-4dd3-baa2-1d0631edced7",
"name": "Set API Token",
"type": "n8n-nodes-base.set",
"position": [
-656,
-48
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "api_token",
"name": "replicate_api_token",
"type": "string",
"value": "=YOUR_REPLICATE_API_KEY"
},
{
"id": "e743e552-bf98-47bd-a510-14e32b4d85ab",
"name": "OPENAI_API_TOKE",
"type": "string",
"value": "YOUR_OPENAI_API_KEY"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "4582cccc-b221-4719-932b-8d6e4af3edcd",
"name": "Wait 5s",
"type": "n8n-nodes-base.wait",
"position": [
240,
-32
],
"webhookId": "995d4d71-efe0-4ba6-8c74-d203adedf9b3",
"parameters": {
"unit": "seconds",
"amount": 5
},
"typeVersion": 1
},
{
"id": "dbdd529c-3a58-4d36-b25b-9aaa2e4d0b17",
"name": "Check Status",
"type": "n8n-nodes-base.httpRequest",
"position": [
432,
-32
],
"parameters": {
"url": "=https://api.replicate.com/v1/predictions/{{ $('Create Video').item.json.id }}",
"options": {
"response": {
"response": {
"neverError": true,
"responseFormat": "json"
}
}
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('Set API Token').item.json.replicate_api_token }}"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "9c416352-e0cb-4ceb-ada5-b780f954daec",
"name": "Is Complete?",
"type": "n8n-nodes-base.if",
"position": [
672,
-112
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "c93d7ba1-0ef9-4087-aa10-389cb2a2c6bd",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "succeeded"
}
]
}
},
"typeVersion": 2
},
{
"id": "99985ab7-1ccf-43ec-a197-2e531f1bd9f0",
"name": "Has Failed?",
"type": "n8n-nodes-base.if",
"position": [
928,
16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "d1bfd044-3a07-4c18-b55f-72d192596139",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "failed"
}
]
}
},
"typeVersion": 2
},
{
"id": "ce412a60-5a6a-46be-b138-cd97c9d9c11e",
"name": "Success Response",
"type": "n8n-nodes-base.set",
"position": [
912,
-224
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "success-response",
"name": "response",
"type": "object",
"value": "={{ { success: true, result_url: $json.output, prediction_id: $json.id, status: $json.status, message: 'Other generated successfully' } }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "61e366f6-ab7e-4416-bb22-7f8de22cc8b3",
"name": "Error Response",
"type": "n8n-nodes-base.set",
"position": [
1424,
240
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "error-response",
"name": "response",
"type": "object",
"value": "={{ { success: false, error: $json.error || 'Other generation failed', prediction_id: $json.id, status: $json.status, message: 'Failed to generate other' } }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "b7342030-e8ae-486d-8a97-d73e12b708e9",
"name": "Display Result",
"type": "n8n-nodes-base.set",
"position": [
1728,
-80
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "final-result",
"name": "final_result",
"type": "object",
"value": "={{ $json.response }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "5de44d2f-ce27-4eb7-a0fd-82c457b71e3d",
"name": "Log Request",
"type": "n8n-nodes-base.code",
"position": [
240,
-224
],
"parameters": {
"jsCode": "// Log generation details for monitoring\nconst data = $input.all()[0].json;\n\nconsole.log('digitalhera/heranathalie Request:', {\n timestamp: new Date().toISOString(),\n prediction_id: data.id,\n model_type: 'other'\n});\n\nreturn $input.all();"
},
"typeVersion": 2
},
{
"id": "a28fa7bb-ec7c-4799-9818-d157ff40b8bc",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1952,
-176
],
"parameters": {
"color": 4,
"width": 804,
"height": 432,
"content": "=======================================\n IMAGE TO VIDEO GENERATOR\n=======================================\nFor any questions or support, please contact:\n [email protected]\n\nExplore more tips and tutorials here:\n - YouTube: https://www.youtube.com/@YaronBeen/videos\n - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n\n๐ Need a scalable solution for generating \n and automating media buying?\n Check out ROASPIG.com\n======================================="
},
"typeVersion": 1
},
{
"id": "f77b44cc-bdc5-4ea6-b753-cd36a1364c70",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1920,
288
],
"parameters": {
"color": 4,
"width": 589,
"height": 1958,
"content": "### ๐ฌ SORA-2 TEXT-TO-VIDEO WORKFLOW\n\n๐ฅ **Replicate API + n8n automation**\n\n**Model**\n- Owner: `openai`\n- Model: `sora-2` (text โ video)\n- Endpoint: `https://api.replicate.com/v1/models/openai/sora-2/predictions`\n\n**What it does:** \nTurns a text prompt into a short video. \nPerfect for rapid ad creative iteration.\n\n---\n\n### ๐งฉ Required Input\n\n- `prompt` *(string)* โ describe the scene and motion \n- `seconds` *(int)* โ 4, 8, or 12\n- Seed image\n\n- `aspect_ratio`: `\"landscape\"`\n- `openai_api_key`: forwarded to model\n\n---\n\n### ๐ Workflow Steps\n\n1. Manual Trigger \n2. Set API Token \n3. Add Prompt & Seconds \n4. Create Video (POST) \n5. Log Request \n6. Wait 5s \n7. Check Status \n8. If `succeeded` โ โ
Success Response \n9. If `failed` โ โ Error Response \n10. Else โ Wait 90s โ Check Status (loop)\n\n---\n\n### ๐ค Success Output\n\n```json\n{\n \"success\": true,\n \"result_url\": \"...\",\n \"prediction_id\": \"...\",\n \"status\": \"succeeded\",\n \"message\": \"Video generated successfully\"\n}\n```\n\n---\n\n### ๐ ๏ธ Tips\n\n- Keep prompts JSON-safe (single line).\n- Be specific about motion and camera.\n- Shorter videos test faster and cheaper.\n- Use n8n Credentials for keys.\n- Monitor usage and billing on Replicate.\n\n---\n\n"
},
"typeVersion": 1
},
{
"id": "be560461-94f0-442a-bd3d-eb3ee96911a6",
"name": "Create Video",
"type": "n8n-nodes-base.httpRequest",
"position": [
-96,
-48
],
"parameters": {
"url": "https://api.replicate.com/v1/models/openai/sora-2/predictions",
"method": "POST",
"options": {
"response": {
"response": {
"neverError": true,
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"input\": {\n \"prompt\": \"{{ $json.Prompt }}\",\n \"seconds\":{{ $json['seconds (4,8 or 12)'] }} ,\n \"aspect_ratio\": \"landscape\",\n \"openai_api_key\": \"{{ $('Set API Token').item.json.OPENAI_API_TOKE }}\"\n }\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $('Set API Token').item.json.replicate_api_token }}"
},
{
"name": "Prefer",
"value": "wait"
}
]
}
},
"typeVersion": 4.1
},
{
"id": "1071fd1a-4a7d-45bb-9e16-5368f69dd636",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
-144
],
"parameters": {
"height": 416,
"content": "Add Your Replicate API and OpenAI api key"
},
"typeVersion": 1
},
{
"id": "de54d703-520f-4e4f-8875-67c2bca4dd88",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
-176
],
"parameters": {
"height": 336,
"content": "1- Add a link to your Seed image. If you dont have one, you can generate it using OpenAI or Nano Banana. Make sure the image is 1280x720\n\n\n\n\n"
},
"typeVersion": 1
},
{
"id": "111ae174-e8d5-4ee3-b020-1050ed599345",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-416,
176
],
"parameters": {
"height": 400,
"content": "\n\n## ๐ **PROMPT WRITING GUIDELINES**\n\n### โ **AVOID These Characters:**\n- Double quotes (`\"`) - Will break JSON parsing\n- Backslashes (`\\`) - Can cause escape sequence issues\n- Line breaks/Enter key - Makes JSON invalid\n"
},
"typeVersion": 1
},
{
"id": "f2b2bff0-557a-4041-a351-49ba20e8a668",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-928,
1072
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "7a830ee6-ae1d-42bc-b2bc-cba7ae58277c",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1680,
-208
],
"parameters": {
"height": 432,
"content": "Connect this node to your storage in order to save the predictions\n"
},
"typeVersion": 1
},
{
"id": "54418cc7-b04d-46ac-a88e-3d956c83e10d",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1216,
528
],
"parameters": {
"width": 544,
"height": 752,
"content": "## Batch Processing Guide\n\n## ๐ Optional: Generate Multiple Videos\n\nConnect the \"Batch Process Videos\" node after \"Set API Token\" for bulk generation.\n\n### Three Options:\n\n**Option 1: Same Image + Same Prompt = Multiple Videos**\n- Get different variations from identical inputs\n- Example: 1 product photo โ 5 unique videos\n\n**Option 2: Same Image + Different Prompts = Multiple Videos**\n- Test different animations on one image \n- Example: 1 photo with 10 different prompts\n\n**Option 3: Different Images + Different Prompts = Multiple Videos**\n- Bulk create unique content\n- Example: 50 products, each with custom prompt"
},
"typeVersion": 1
},
{
"id": "a5f1f8a7-a08d-478f-9e6e-85edd51dd2d7",
"name": "Wait 90s",
"type": "n8n-nodes-base.wait",
"position": [
800,
224
],
"webhookId": "2e60a799-64fd-49ce-8a21-e69ab2568e0f",
"parameters": {
"unit": "seconds",
"amount": 90
},
"typeVersion": 1
},
{
"id": "31634b3e-09c6-4b29-b1f2-002f7e41ce97",
"name": "Add Seed Image, Prompt and amount of seconds",
"type": "n8n-nodes-base.set",
"position": [
-352,
-32
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "924b6590-46a4-4ad5-b58d-0804991c633e",
"name": "Seed_image",
"type": "string",
"value": "https://replicate.delivery/pbxt/NllgibhEDDtjRmPSLSDvXnkiobQCJDeoI4PwWdJ0bdXIeZbP/AG1_1.png"
},
{
"id": "76ad3bd8-da89-413b-b5ab-f031d4d221f4",
"name": "Prompt",
"type": "string",
"value": "5-Second AG1 'Game Changer' Video Prompt Scene Setup: Woman in modern kitchen (white cropped hoodie, olive green leggings), holding AG1 package with both hands at chest level, green smoothie in blender visible to the side Action (0-5 seconds): 0-1 sec: Start with her looking down at the AG1 package 1-2 sec: She looks up at camera with growing smile (like discovering something amazing) 2-4 sec: Holds package up slightly higher, direct eye contact: 'This is an absolute GAME changer!' 4-5 sec: Quick confident nod while bringing package back to chest level, maintaining smile Camera: Static shot or very subtle push-in Frame from waist up (like reference photo) Bright, natural lighting Kitchen background slightly blurred for focus on her and product Energy: Authentic excitement, like she's sharing a secret with her best friend - natural, not overly polished"
},
{
"id": "c88da8c2-ccb0-4325-9aed-6ed9e1d4fd13",
"name": "seconds (4,8 or 12)",
"type": "number",
"value": 4
}
]
}
},
"typeVersion": 3.4
}
],
"pinData": {},
"connections": {
"Wait 5s": {
"main": [
[
{
"node": "Check Status",
"type": "main",
"index": 0
}
]
]
},
"Wait 90s": {
"main": [
[
{
"node": "Check Status",
"type": "main",
"index": 0
}
]
]
},
"Has Failed?": {
"main": [
[
{
"node": "Error Response",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait 90s",
"type": "main",
"index": 0
}
]
]
},
"Log Request": {
"main": [
[
{
"node": "Wait 5s",
"type": "main",
"index": 0
}
]
]
},
"Check Status": {
"main": [
[
{
"node": "Is Complete?",
"type": "main",
"index": 0
}
]
]
},
"Create Video": {
"main": [
[
{
"node": "Log Request",
"type": "main",
"index": 0
}
]
]
},
"Is Complete?": {
"main": [
[
{
"node": "Success Response",
"type": "main",
"index": 0
}
],
[
{
"node": "Has Failed?",
"type": "main",
"index": 0
}
]
]
},
"Set API Token": {
"main": [
[
{
"node": "Add Seed Image, Prompt and amount of seconds",
"type": "main",
"index": 0
}
]
]
},
"Display Result": {
"main": [
[]
]
},
"Error Response": {
"main": [
[
{
"node": "Display Result",
"type": "main",
"index": 0
}
]
]
},
"Manual Trigger": {
"main": [
[
{
"node": "Set API Token",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Success Response": {
"main": [
[
{
"node": "Display Result",
"type": "main",
"index": 0
}
]
]
},
"Add Seed Image, Prompt and amount of seconds": {
"main": [
[
{
"node": "Create Video",
"type": "main",
"index": 0
}
]
]
}
}
}