Skip to content

Instantly share code, notes, and snippets.

@leifermendez
Created June 18, 2025 17:47
Show Gist options
  • Save leifermendez/d78185ca8563e5dc4b612c044993ddc1 to your computer and use it in GitHub Desktop.
Save leifermendez/d78185ca8563e5dc4b612c044993ddc1 to your computer and use it in GitHub Desktop.
workflow-veo-3.json
{
"name": "My workflow",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-880,
720
],
"id": "a89d22fb-dc80-4811-8d5d-994a731ad6b7",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"method": "POST",
"url": "https://api.replicate.com/v1/models/google/veo-3/predictions",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"input\": {\n \"prompt\": \"{{ $json.message.content.replace(/\\n/g, ' ').replace(/\\r/g, ' ').replace(/\"/g, '\\'')}}\",\n \"enhance_prompt\": true,\n \"aspect_ratio\": \"16:9\",\n \"duration\": \"8\"\n }\n}",
"options": {
"timeout": 60000
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
140,
800
],
"id": "9d2f0e95-e5f1-4ee3-bf38-b30198e42693",
"name": "Start Video Generation",
"credentials": {
"httpBearerAuth": {
"id": "amQBAGozJw8L5Rb8",
"name": "VEO"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "prediction-id",
"name": "prediction_id",
"value": "={{ $json.id }}",
"type": "string"
},
{
"id": "attempt-counter",
"name": "attempt_count",
"value": 0,
"type": "number"
},
{
"id": "max-attempts",
"name": "max_attempts",
"value": 120,
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
420,
800
],
"id": "8bf4177e-47ce-49f7-8b3b-f8eb2fb21438",
"name": "Store Prediction ID"
},
{
"parameters": {
"amount": 15
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
700,
800
],
"id": "eb0e9286-01a9-4505-a60c-b683d068439e",
"name": "Wait 15 seconds",
"webhookId": "9e760f89-80a8-42c1-ab67-0e4e6011e383"
},
{
"parameters": {
"url": "=https://api.replicate.com/v1/predictions/{{ $json.prediction_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"options": {
"timeout": 30000
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
980,
800
],
"id": "02c25b5a-5196-4b32-871f-6f3cd9a8e007",
"name": "Check Video Status",
"credentials": {
"httpBearerAuth": {
"id": "amQBAGozJw8L5Rb8",
"name": "VEO"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "video-ready",
"leftValue": "={{ $json.status }}",
"rightValue": "succeeded",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1260,
800
],
"id": "13369db9-7908-4db2-938d-5f253b694b3c",
"name": "Check if Complete"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 1
},
"conditions": [
{
"id": "success-condition",
"leftValue": "={{ $json.output }}",
"rightValue": "http",
"operator": {
"type": "string",
"operation": "contains"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1540,
720
],
"id": "3d299053-03c8-4bd6-a707-ca3d9950cfda",
"name": "Check if Succeeded"
},
{
"parameters": {
"url": "=https://api.replicate.com/v1/predictions/{{ $json.id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"options": {
"timeout": 30000
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1820,
640
],
"id": "6b140a12-d3c8-460a-87b5-02b36e60f400",
"name": "Download Video",
"credentials": {
"httpBearerAuth": {
"id": "amQBAGozJw8L5Rb8",
"name": "VEO"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "increment-counter",
"name": "attempt_count",
"value": "={{ $('Store Prediction ID').item.json.attempt_count + 1 }}",
"type": "number"
},
{
"id": "keep-prediction-id",
"name": "prediction_id",
"value": "={{ $('Store Prediction ID').item.json.prediction_id }}",
"type": "string"
},
{
"id": "keep-max-attempts",
"name": "max_attempts",
"value": "={{ $('Store Prediction ID').item.json.max_attempts }}",
"type": "number"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1540,
880
],
"id": "800ee6d2-22ee-441a-87ef-a3d16e71d6f7",
"name": "Increment Attempt Counter"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1820,
800
],
"id": "b0b14694-4491-4166-a29a-f2d3ce07ede5",
"name": "Error or Timeout"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "4f9d462d-fa0d-4dda-9288-99909169975b",
"name": "prompt",
"value": "un Youtuber caminando por Roma impresionado con el arte, comiendo un helado. Y hablando un poco de historia",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-520,
800
],
"id": "767a2c8b-651b-4561-993f-ee3e84a172ea",
"name": "Input Parameters1"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "chatgpt-4o-latest",
"mode": "list",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"messages": {
"values": [
{
"content": "You're an expert in creating prompts for AI-powered video generation. Your job is to transform user ideas into detailed, cinematic prompts.\n\nRequired structure:\n[Establishing shot description]: Close-up selfie video shot from handheld phone perspective, dynamic and shaky movement\n[Subject details + environment]: \n[Energy/mood description]: High-energy, urgent and exciting yet casual YouTuber vibe, contrasting modern social media personality with historical chaos\n[Environment details]: 18th century French street scene with cobblestones, burning barricades, period buildings, revolutionary soldiers in tricorn hats and uniforms, smoke and fire effects, flags and banners\n[Subject action description]: YouTuber while maintaining selfie angle, speaking directly to camera with animated expressions and gestures, occasionally glancing back at the action behind her\n[Lighting]: Natural daylight with dramatic orange glow from fires and smoke, creating cinematic contrast between bright selfie lighting on subject's face and darker, atmospheric battlefield lighting\n[Style]: Modern social media aesthetic mixed with cinematic historical drama, handheld phone camera quality with slight motion blur, vibrant colors for the YouTuber contrasting with muted historical tones\n\n- DO NOT use the following symbols \"{,}\"\n- DO NOT use emojis\n- DO NOT use line breaks or unusual characters\n- Always have the dialogue in Spanish, but the rest of the text in English.\nMaintain narrative coherence and make sure the prompt is specific but not excessively long.",
"role": "system"
},
{
"content": "=Crea un prompt detallado para video basado en: {{ $json.prompt }}"
}
]
},
"options": {
"maxTokens": 8000,
"temperature": 0.7
}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [
-240,
800
],
"id": "4328fdfc-4eba-4685-be6d-43c5c7b435c2",
"name": "Prompt Generator1",
"credentials": {
"openAiApi": {
"id": "zMH0DYDAkIwo0Adz",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"name": "={{ $json.output.split('/').pop() }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "1WtyTKvG3yW0yrbWKvDTN8q6KUx5gmeU4",
"mode": "list",
"cachedResultName": "VEO-3",
"cachedResultUrl": "https://drive.google.com/drive/folders/1WtyTKvG3yW0yrbWKvDTN8q6KUx5gmeU4"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
2280,
640
],
"id": "5b2a48cb-166e-499e-87b8-07268777c919",
"name": "Google Drive",
"credentials": {
"googleDriveOAuth2Api": {
"id": "xv4yTJK36pRTWbHM",
"name": "Google Drive account"
}
}
},
{
"parameters": {
"url": "={{ $json.output }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2080,
640
],
"id": "47347128-c7fc-4612-8ec8-a1ef0014f352",
"name": "HTTP Request",
"alwaysOutputData": false
}
],
"pinData": {},
"connections": {
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Input Parameters1",
"type": "main",
"index": 0
}
]
]
},
"Start Video Generation": {
"main": [
[
{
"node": "Store Prediction ID",
"type": "main",
"index": 0
}
]
]
},
"Store Prediction ID": {
"main": [
[
{
"node": "Wait 15 seconds",
"type": "main",
"index": 0
}
]
]
},
"Wait 15 seconds": {
"main": [
[
{
"node": "Check Video Status",
"type": "main",
"index": 0
}
]
]
},
"Check Video Status": {
"main": [
[
{
"node": "Check if Complete",
"type": "main",
"index": 0
}
]
]
},
"Check if Complete": {
"main": [
[
{
"node": "Check if Succeeded",
"type": "main",
"index": 0
}
],
[
{
"node": "Increment Attempt Counter",
"type": "main",
"index": 0
}
]
]
},
"Check if Succeeded": {
"main": [
[
{
"node": "Download Video",
"type": "main",
"index": 0
}
],
[
{
"node": "Error or Timeout",
"type": "main",
"index": 0
}
]
]
},
"Increment Attempt Counter": {
"main": [
[
{
"node": "Wait 15 seconds",
"type": "main",
"index": 0
}
]
]
},
"Input Parameters1": {
"main": [
[
{
"node": "Prompt Generator1",
"type": "main",
"index": 0
}
]
]
},
"Prompt Generator1": {
"main": [
[
{
"node": "Start Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Download Video": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "a1ea2516-d602-4362-b096-bcef8d943796",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "702bf4627950e0f2adc1b7b68ded8dc65bbdf4e5925aca9bc205d35a563dc1ad"
},
"id": "C04ENKd7IfnW0l2W",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment