8
n8n 中文网amn8n.com

香蕉

中级

这是一个Miscellaneous, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 If, Set, Wait, FormTrigger, HttpRequest 等节点。 使用KIE.AI Nano Banana API生成角色一致的AI图像

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "awXlFcUvfBcnAfxo",
  "meta": {
    "instanceId": "984a3a573b2ceefaa62e65118c88bad010712c3575386e48d0fa024f616c2747"
  },
  "name": "banana",
  "tags": [],
  "nodes": [
    {
      "id": "c9f57cdf-e8d4-4612-a015-005af994b753",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        16
      ],
      "parameters": {
        "width": 780,
        "height": 152,
        "content": "## 步骤 1 - 获取 API 密钥 (YOURAPIKEY)"
      },
      "typeVersion": 1
    },
    {
      "id": "42df80e0-3428-40f9-a951-9390723f4aaa",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        256
      ],
      "parameters": {
        "width": 780,
        "height": 212,
        "content": "## 步骤 2 - 使用流程"
      },
      "typeVersion": 1
    },
    {
      "id": "9dea92a7-21b2-42e7-96ce-714f5ea44024",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 3,
        "width": 956,
        "height": 1160,
        "content": "## 使用 KIE.AI Nano Banana API 生成角色一致的图像"
      },
      "typeVersion": 1
    },
    {
      "id": "5609cfa7-25e9-4f0e-908b-4fceb1fdd889",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        544
      ],
      "parameters": {
        "width": 780,
        "height": 568,
        "content": "## STEP 3 - Form Parameters\n1. **Prompt** \n    - Purpose: Describe the video content you want to generate.\n    - Example: \"A dog playing in a park\".\n    - Tips:\n    Be detailed and specific in describing image content.\n    More detailed descriptions lead to better results.\n2. **img_url** (Image-to-Image, Optional)\n    - Purpose: Provide an image URL for image-to-image generation. Note: If you are using text-to-image generation (google/nano-banana), please do not fill in this parameter.\n    - Example: https://file.example.com/your-image.jpg (single image) or https://file1.com/img1.jpg,https://file2.com/img2.jpg (multiple images)\n    - Tips:\n    Required for: google/nano-banana-edit (image-to-image).\n    Not needed for: google/nano-banana (text-to-image) - leave this field empty.\n    Use a clear and relevant image to guide the generation.\n    You can upload up to 5 images by separating multiple URLs with commas.\n3. **model (Model Type)** \n    - Purpose: Select the type of AI generation task you want to perform.\n    - Options: google/nano-banana (text-to-image)\ngoogle/nano-banana-edit (image-to-image)\n    - Tips:Choose google/nano-banana for text-to-image generation. Choose google/nano-banana-edit for image-to-image generation.\n4. **api_key** (API Key)\n    - This is what you get in the first step.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b41cc4b4-2927-4453-80fd-7252549af77e",
      "name": "获取生成状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        992,
        1184
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/playground/recordInfo",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "taskId",
              "value": "={{$json.data.taskId}}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{$node[\"Submit Text Prompt for image Generation\"].json[\"api_key\"]}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "421dd0c7-92c9-439e-a157-70d6120b6282",
      "name": "Submit Text Prompt for image Generation",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        320,
        1184
      ],
      "webhookId": "791b190b-2acc-4d10-b593-c1929e67686c",
      "parameters": {
        "options": {},
        "formTitle": "AI image generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "prompt"
            },
            {
              "fieldLabel": "img_url"
            },
            {
              "fieldLabel": "model"
            },
            {
              "fieldLabel": "api_key"
            }
          ]
        },
        "formDescription": "Please fill in the following information to generate your video"
      },
      "typeVersion": 2.2
    },
    {
      "id": "e8209f72-eb14-40e2-a4fa-19da7d6d5e6f",
      "name": "Send image Generation Request to KIE.AI API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        544,
        1184
      ],
      "parameters": {
        "url": "https://api.kie.ai/api/v1/playground/createTask",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"{{$json.model}}\",\n  \"callBackUrl\": \"https://your-domain.com/api/callback\",\n  \"input\": {\n    \"prompt\": \"{{$json.prompt}}\",\n    \"image_urls\": [{{$json.img_url ? $json.img_url.split(',').map(url => '\"' + url.trim() + '\"').join(',') : ''}}]\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{$json.api_key}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "87befe8e-1318-44c6-8600-a30f7d629f87",
      "name": "Wait for image Processing Completion",
      "type": "n8n-nodes-base.wait",
      "position": [
        784,
        1184
      ],
      "webhookId": "bb6c2821-9586-44b7-8606-2ee69a77ed75",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "63a42df0-8d20-47ac-a4f8-c8006ef985c7",
      "name": "Check if image Generation is Complete",
      "type": "n8n-nodes-base.if",
      "position": [
        832,
        1408
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "db9a5dec-997b-4c3f-9582-37c9bbeb19ff",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "=true",
              "rightValue": "={{ $json.data.state == 'success'}}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "a819dc4e-dcf2-463b-b0a5-daf38444edc9",
      "name": "Format and Display image Results",
      "type": "n8n-nodes-base.set",
      "position": [
        1200,
        1392
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e800cf57-0f11-448e-b86d-6454dced6c28",
              "name": "img",
              "type": "string",
              "value": "={{ $json.data.resultJson }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5a03f781-5476-497a-a705-8cc42d77ddff",
  "connections": {
    "Obtain the generated status": {
      "main": [
        [
          {
            "node": "Check if image Generation is Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for image Processing Completion": {
      "main": [
        [
          {
            "node": "Obtain the generated status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if image Generation is Complete": {
      "main": [
        [
          {
            "node": "Format and Display image Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for image Processing Completion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit Text Prompt for image Generation": {
      "main": [
        [
          {
            "node": "Send image Generation Request to KIE.AI API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send image Generation Request to KIE.AI API": {
      "main": [
        [
          {
            "node": "Wait for image Processing Completion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 杂项, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量10
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流