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 就完全不用等。