{
  "name": "AI Video Animation Batch Processor",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "animate-batch",
        "responseMode": "responseNode"
      },
      "id": "webhook-trigger",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all();\nconst data = items[0].json;\n\nconst batchSize = 10;\nconst batches = [];\nconst images = data.images || [];\n\nfor (let i = 0; i < images.length; i += batchSize) {\n  batches.push({\n    batch_id: Math.floor(i / batchSize) + 1,\n    images: images.slice(i, i + batchSize)\n  });\n}\n\nconst costPerImage = 0.05;\nconst totalCost = images.length * costPerImage;\n\nreturn {\n  job_id: 'anim_' + Date.now(),\n  total_images: images.length,\n  batches: batches,\n  estimated_cost: totalCost,\n  settings: data.settings || {}\n};"
      },
      "id": "batch-processor",
      "name": "Batch Processor",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "url": "YOUR_RUNPOD_ENDPOINT_URL",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_RUNPOD_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json }}"
      },
      "id": "runpod-request",
      "name": "RunPod Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json) }}"
      },
      "id": "webhook-response",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        900,
        300
      ]
    }
  ],
  "connections": {
    "webhook-trigger": {
      "main": [
        [
          {
            "node": "batch-processor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "batch-processor": {
      "main": [
        [
          {
            "node": "runpod-request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "runpod-request": {
      "main": [
        [
          {
            "node": "webhook-response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "timezone": "UTC",
    "executionTimeout": 3600
  }
}