n8n × PopNow

在 n8n 里生成 AI 图片和视频

什么都不用装:n8n 自带的 HTTP Request 节点直接调用 PopNow API,n8n Cloud 和自托管都能用。粘贴工作流,填上密钥就能运行。

四步配好

  1. 在 n8n 里新建一个 Header Auth 凭据。Name 填 Authorization,Value 填 Bearer、一个空格,再加上你以 sk-popnow- 开头的密钥。
  2. 复制下面的工作流,在空白画布上按 Ctrl + V(Mac 上是 Cmd + V)粘贴。
  3. 打开 Create task 节点,选上刚建的凭据,再改模型和提示词。
  4. 运行。最后一个节点会给出文件地址;在后面接一个 Google Drive、Slack 或 S3 节点把文件存下来。

工作流

建任务、等待、查询,没完成就循环,完成后把文件链接交给下一个节点。

  1. Start
  2. Create task
  3. Wait 5 seconds
  4. Check task
  5. Done?
  6. File URL

↺ Done? → Wait 5 seconds

popnow-workflow.json
{
  "name": "PopNow: generate and get the file",
  "nodes": [
    {
      "id": "b1f0c1a2-0001-4c55-9a10-000000000001",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "b1f0c1a2-0002-4c55-9a10-000000000002",
      "name": "Create task",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        0
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.popnow.ai/api/v1/jobs/createTask",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $execution.id }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"model\": \"google/nano-banana-2.1/text-to-image\",\n  \"input\": {\n    \"prompt\": \"A ceramic teapot on a linen cloth, soft window light, muted palette\",\n    \"aspect_ratio\": \"16:9\",\n    \"resolution\": \"1k\",\n    \"output_format\": \"png\"\n  }\n}",
        "options": {}
      }
    },
    {
      "id": "b1f0c1a2-0003-4c55-9a10-000000000003",
      "name": "Wait 5 seconds",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        440,
        0
      ],
      "parameters": {
        "amount": 5
      },
      "webhookId": "4d3c2b1a-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
    },
    {
      "id": "b1f0c1a2-0004-4c55-9a10-000000000004",
      "name": "Check task",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        0
      ],
      "parameters": {
        "url": "https://api.popnow.ai/api/v1/jobs/recordInfo",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "taskId",
              "value": "={{ $('Create task').item.json.data.taskId }}"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "b1f0c1a2-0005-4c55-9a10-000000000005",
      "name": "Done?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        880,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c0ffee00-0000-4000-8000-000000000001",
              "leftValue": "={{ ['succeeded','failed','canceled','expired'].includes($json.data.state) && !($json.data.output?.assets ?? []).some(a => a.pending && !a.unavailable) }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "b1f0c1a2-0006-4c55-9a10-000000000006",
      "name": "File URL",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1100,
        -100
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c0ffee00-0000-4000-8000-000000000002",
              "name": "state",
              "value": "={{ $json.data.state }}",
              "type": "string"
            },
            {
              "id": "c0ffee00-0000-4000-8000-000000000003",
              "name": "fileUrl",
              "value": "={{ $json.data.output?.assets?.[0]?.url ?? '' }}",
              "type": "string"
            },
            {
              "id": "c0ffee00-0000-4000-8000-000000000004",
              "name": "error",
              "value": "={{ $json.data.errorMessage ?? '' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Create task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create task": {
      "main": [
        [
          {
            "node": "Wait 5 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 5 seconds": {
      "main": [
        [
          {
            "node": "Check task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check task": {
      "main": [
        [
          {
            "node": "Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Done?": {
      "main": [
        [
          {
            "node": "File URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 5 seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}

标准的 n8n JSON。模型和 input 都取自本页,原样就能通过校验。

要改哪几处

控制花费. 在控制台里给 n8n 用的密钥单独设每日上限和允许的模型。万一循环失控,到上限就会停下,不会把余额花光。

model
模型的调用名。API 版块里每个模型页都有,带复制按钮。
input
这个模型的提示词和选项。模型的 API 页列出了每个字段的范围和默认值。
callBackUrl
可选。指向一个 n8n Webhook 节点,就可以去掉等待循环:任务完成后我们会把结果发过去。
Idempotency-Key
已经设成执行 ID,节点重试时不会为同一次运行重复扣费。

适合起步的模型

速度快、价格合适,适合做自动化。点进去能看到调用名、参数和价格。

n8n 常见问题

需要装 PopNow 的社区节点吗?

不需要。这个工作流只用 n8n 自带的节点:Manual Trigger、HTTP Request、Wait、If 和 Edit Fields。n8n Cloud 和自托管都能运行。

怎么用前面节点里的图片?

在图片字段里传一个公开的 https 链接。如果文件只在 n8n 里,先通过 API 上传,再用返回的 popnow:// 引用。

跑一次要多少钱?

按次扣积分,和网站同一份积分。一张 Nano Banana 图片只要几个积分,视频按秒计费。失败的任务会退还积分。

跑一次要多久?

图片通常一分钟内完成,视频几分钟。等待循环每五秒查一次;用 callBackUrl 就完全不用等。