使用Replicate上的OpenAI SORA-2将文本转换为UGC视频

高级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 21 个节点。主要使用 If、Set、Code、Wait、HttpRequest 等节点。 使用Replicate上的OpenAI SORA-2将文本转换为UGC视频

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "12e6f290a974a1eee154f8d915aade185e90e826260e6aeab8a087ba7386a1bc"
  },
  "nodes": [
    {
      "id": "a935b36c-4c47-423b-afbb-dc831fb66a0e",
      "name": "手动触发器",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1024,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ad8d0c58-ff3b-4dd3-baa2-1d0631edced7",
      "name": "设置 API 令牌",
      "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": "等待 5 秒",
      "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": "检查状态",
      "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": "是否完成?",
      "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": "是否失败?",
      "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": "**结果:** 整理好的商家电子邮件数据库,准备用于外联",
      "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": "错误响应",
      "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": "显示结果",
      "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": "记录请求",
      "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": "### 替换 Airtable 连接",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1952,
        -176
      ],
      "parameters": {
        "color": 4,
        "width": 804,
        "height": 432,
        "content": "将输出转换为 JSON"
      },
      "typeVersion": 1
    },
    {
      "id": "f77b44cc-bdc5-4ea6-b753-cd36a1364c70",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1920,
        288
      ],
      "parameters": {
        "color": 4,
        "width": 589,
        "height": 1958,
        "content": "### 🎬 SORA-2 文本转视频工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "be560461-94f0-442a-bd3d-eb3ee96911a6",
      "name": "创建视频",
      "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": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -144
      ],
      "parameters": {
        "height": 416,
        "content": "添加您的 Replicate API 和 OpenAI API 密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "de54d703-520f-4e4f-8875-67c2bca4dd88",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -176
      ],
      "parameters": {
        "height": 336,
        "content": "1- 添加您的种子图像链接。如果您没有,可以使用 OpenAI 或 Nano Banana 生成。确保图像尺寸为 1280x720"
      },
      "typeVersion": 1
    },
    {
      "id": "111ae174-e8d5-4ee3-b020-1050ed599345",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        176
      ],
      "parameters": {
        "height": 400,
        "content": "构建代币项目"
      },
      "typeVersion": 1
    },
    {
      "id": "f2b2bff0-557a-4041-a351-49ba20e8a668",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -928,
        1072
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "7a830ee6-ae1d-42bc-b2bc-cba7ae58277c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -208
      ],
      "parameters": {
        "height": 432,
        "content": "对于每个代币"
      },
      "typeVersion": 1
    },
    {
      "id": "54418cc7-b04d-46ac-a88e-3d956c83e10d",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        528
      ],
      "parameters": {
        "width": 544,
        "height": 752,
        "content": "抓取 CoinGecko (Decodo)"
      },
      "typeVersion": 1
    },
    {
      "id": "a5f1f8a7-a08d-478f-9e6e-85edd51dd2d7",
      "name": "解析代币指标 (LLM)",
      "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": "添加种子图像、提示词和时长(秒数)",
      "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
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

这是一个高级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量21
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Yaron Been

Yaron Been

@yaron-nofluff

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

外部链接
在 n8n.io 上查看 →

分享此工作流