使用Kling API为服装生成360°虚拟试穿视频
高级
这是一个Design, AI, Marketing领域的自动化工作流,包含 16 个节点。主要使用 If, Set, Wait, Switch, HttpRequest 等节点,结合人工智能技术实现智能自动化。 使用Kling API为服装生成360°虚拟试穿视频(非官方)
前置要求
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "xQ0xqhNzFeEdBpFK",
"meta": {
"instanceId": "1e003a7ea4715b6b35e9947791386a7d07edf3b5bf8d4c9b7ee4fdcbec0447d7"
},
"name": "使用 Kling API 为服装生成 360° 虚拟试穿视频",
"tags": [],
"nodes": [
{
"id": "978b4ac4-0357-4d2b-8a02-7da04e6f3f1f",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
160,
140
],
"parameters": {},
"typeVersion": 1
},
{
"id": "54d1c23f-3a13-4ec0-9b3b-3806e5faae18",
"name": "Kling 虚拟试穿任务",
"type": "n8n-nodes-base.httpRequest",
"position": [
620,
140
],
"parameters": {
"url": "https://api.piapi.ai/api/v1/task",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"kling\",\n \"task_type\": \"ai_try_on\",\n \"input\": {\n \"model_input\": \"{{ $json.model_input }}\",\n \"dress_input\": \"{{ $json.dress_input }}\",\n \"upper_input\": \"{{ $json.upper_input }}\",\n \"lower_input\": \"{{ $json.lower_input }}\",\n \"batch_size\": 1\n }\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $json['x-api-key'] }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "5be9d932-c102-4a7e-b995-09c6bf17026c",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
960,
200
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5f61ee56-4ebe-411f-95e6-b47d9741e7a2",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "completed"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "cdda4f40-1580-4a5a-a7f4-f1e4fbf7ceb4",
"name": "获取 Kling 视频任务",
"type": "n8n-nodes-base.httpRequest",
"position": [
1180,
440
],
"parameters": {
"url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
"options": {},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $('Preset Parameters').item.json['x-api-key'] }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "3e794d14-b55f-4936-90af-8237977d6635",
"name": "生成 kling 视频",
"type": "n8n-nodes-base.httpRequest",
"position": [
1140,
200
],
"parameters": {
"url": "https://api.piapi.ai/api/v1/task",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"kling\",\n \"task_type\": \"video_generation\",\n \"input\": {\n \"version\": \"1.6\",\n \"image_url\": \"{{ $json.data.output.works[0].image.resource }}\",\n \"prompt\": \"{{ $('Preset Parameters').item.json.generate_video_prompt }}\"\n }\n} ",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $('Preset Parameters').item.json['x-api-key'] }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "3ae849b2-4bd4-454f-a759-e44a9736100d",
"name": "预设参数",
"type": "n8n-nodes-base.set",
"position": [
380,
140
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"x-api-key\":\"\",\n \"model_input\": \"\",\n \"dress_input\": \"\",\n \"upper_input\":\"\",\n \"lower_input\":\"\",\n \"generate_video_prompt\": \"Walk on the catwalk, turn around, and finally stand still and pose\"\n}\n"
},
"typeVersion": 3.4
},
{
"id": "18c606e3-82e2-4c09-a87e-6bbc71363c1c",
"name": "获取 Kling 虚拟试穿任务",
"type": "n8n-nodes-base.httpRequest",
"position": [
420,
460
],
"parameters": {
"url": "=https://api.piapi.ai/api/v1/task/{{ $json.data.task_id }}",
"options": {},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $('Preset Parameters').item.json['x-api-key'] }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "becf3d7b-d468-4b4a-b22f-d6d747e52664",
"name": "检查数据状态",
"type": "n8n-nodes-base.if",
"position": [
640,
460
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "e97a02cc-8d1d-4500-bce5-0a296c792b76",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "completed"
},
{
"id": "50b63a7a-52b5-4766-a859-96ac1ff949ec",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "failed"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "d8ec251d-d47c-4341-909d-abdea385c1f9",
"name": "等待图像生成",
"type": "n8n-nodes-base.wait",
"position": [
160,
460
],
"webhookId": "af79053d-1291-4dd2-889e-4593dbbb2512",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "88e3067f-0b1f-472a-937b-926c6d208453",
"name": "等待视频生成",
"type": "n8n-nodes-base.wait",
"position": [
920,
440
],
"webhookId": "af79053d-1291-4dd2-889e-4593dbbb2512",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "36d75678-918f-42c5-97a7-7a13d1eacbd4",
"name": "检查视频数据状态",
"type": "n8n-nodes-base.switch",
"position": [
1560,
180
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5f61ee56-4ebe-411f-95e6-b47d9741e7a2",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "completed"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "7356d963-83c0-47a1-a728-9191f66d2f57",
"name": "获取视频数据状态",
"type": "n8n-nodes-base.if",
"position": [
1400,
440
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "e97a02cc-8d1d-4500-bce5-0a296c792b76",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "completed"
},
{
"id": "50b63a7a-52b5-4766-a859-96ac1ff949ec",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.data.status }}",
"rightValue": "failed"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "9ef52637-ccc9-4817-8c14-5c54fa0af178",
"name": "获取最终视频 URL",
"type": "n8n-nodes-base.set",
"position": [
1760,
180
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "={\n \"video_url\": \"{{ $json.data.output.video_url }}\"\n}\n "
},
"typeVersion": 3.4
},
{
"id": "9a0194bd-59a5-45b1-a6e2-db0605eb4d7a",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
140,
-120
],
"parameters": {
"width": 460,
"height": 220,
"content": "## 使用 Kling API(非官方)为服装生成 360° 虚拟试穿视频"
},
"typeVersion": 1
},
{
"id": "629697ae-cd49-4e8e-953d-a2f091ed9202",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
120,
700
],
"parameters": {
"width": 340,
"height": 200,
"content": "## 生成虚拟试穿图像"
},
"typeVersion": 1
},
{
"id": "710bd0f0-8b5a-469a-8b31-b6f738dc7f79",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1640,
460
],
"parameters": {
"width": 340,
"content": "## 生成最终视频"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "97ee31dd-b8be-4b37-bbed-363ac35d5268",
"connections": {
"Switch": {
"main": [
[
{
"node": "Generate kling video",
"type": "main",
"index": 0
}
]
]
},
"Check Data Status": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Image Generation",
"type": "main",
"index": 0
}
]
]
},
"Preset Parameters": {
"main": [
[
{
"node": "Kling Virtual Try-On Task",
"type": "main",
"index": 0
}
]
]
},
"Generate kling video": {
"main": [
[
{
"node": "Wait for Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Get Kling Video Task": {
"main": [
[
{
"node": "Get Video Data Status",
"type": "main",
"index": 0
}
]
]
},
"Get Video Data Status": {
"main": [
[
{
"node": "Check Video Data Status",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for Video Generation",
"type": "main",
"index": 0
}
]
]
},
"Check Video Data Status": {
"main": [
[
{
"node": "Get Final Video URL",
"type": "main",
"index": 0
}
]
]
},
"Kling Virtual Try-On Task": {
"main": [
[
{
"node": "Wait for Image Generation",
"type": "main",
"index": 0
}
]
]
},
"Wait for Image Generation": {
"main": [
[
{
"node": "Get Kling Virtual Try-On Task",
"type": "main",
"index": 0
}
]
]
},
"Wait for Video Generation": {
"main": [
[
{
"node": "Get Kling Video Task",
"type": "main",
"index": 0
}
]
]
},
"Get Kling Virtual Try-On Task": {
"main": [
[
{
"node": "Check Data Status",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Preset Parameters",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 设计, 人工智能, 营销
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 GPT-4o-mini、Midjourney、Kling 和 Creatomate API 创建动画故事
使用 GPT-4o-mini、Midjourney、Kling 和 Creatomate API 创建动画故事
If
Set
Code
+5
51 节点PiAPI
工程
使用Midjourney、GPT-4o-mini和Canvas API生成图形壁纸
通过Midjourney、GPT-4o-mini和Canvas API生成图形壁纸
If
Set
Code
+5
14 节点PiAPI
设计
使用 Midjourney 和 Kling API 生成的运动插画工作流
使用 Midjourney 和 Kling API 从文本提示创建动画插画
If
Code
Wait
+3
13 节点PiAPI
设计
(未发布)三视图正交投影到动态视频转换
使用GPT-4o-Image和Kling API将三视图转换为360°视频
If
Set
Code
+3
13 节点PiAPI
设计
使用AI、ElevenLabs和多平台发布创建和审批POV视频
使用AI、ElevenLabs和多平台发布创建和审批POV视频(TikTok/IG/YT)
If
Set
Code
+20
60 节点Immanuel
设计
使用OpenAI脚本、Leonardo图像和HeyGen虚拟形象创建AI视频
使用OpenAI脚本、Leonardo图像和HeyGen虚拟形象创建AI视频
If
Set
Code
+15
68 节点Adam Crafts
设计