n8n × PopNow

n8n で AI 画像と動画を生成する

インストール不要です。n8n 標準の HTTP Request ノードから PopNow API を直接呼び出せるので、n8n Cloud でもセルフホストでも動きます。ワークフローを貼り付けてキーを設定すれば実行できます。

4ステップで設定

  1. n8n で Header Auth の認証情報を追加します。Name は Authorization、Value は Bearer、半角スペース、続けて sk-popnow- で始まるキーです。
  2. 下のワークフローをコピーし、空のキャンバスに Ctrl + V(Mac は Cmd + V)で貼り付けます。
  3. Create task ノードを開いて認証情報を選び、モデルとプロンプトを変更します。
  4. 実行します。最後のノードがファイルの URL を返すので、後ろに 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 用のキーに1日の上限と使えるモデルを設定しておきましょう。ループが暴走しても上限で止まり、残高を使い切ることはありません。

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:// 参照を使います。

1回の実行でいくらかかりますか?

サイトと同じクレジットで、呼び出しごとの課金です。Nano Banana の画像なら数クレジット、動画は秒単位で課金されます。失敗したタスクは返金されます。

1回の実行にどれくらいかかりますか?

画像はたいてい1分以内、動画は数分です。待機ループは5秒ごとに確認します。callBackUrl を使えば待つ必要はありません。