{
  "name": "Generate & edit images with OpenAI GPT-Image-1 and share via Telegram",
  "nodes": [
    {
      "id": "0b66ad6f-d216-41f3-a6dc-61cf15a2044a",
      "name": "Set Access Permissions",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -2220,
        -1000
      ]
    },
    {
      "id": "724b14c0-6763-47f5-87a1-ed0dde7e8a9e",
      "name": "Edit Image (OpenAI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3060,
        -1000
      ]
    },
    {
      "id": "071f9711-3b73-411d-9962-b540f0b418c7",
      "name": "Convert json binary to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -2740,
        -620
      ]
    },
    {
      "id": "e22377ef-1bbf-4288-a625-d07a97d5667d",
      "name": "Convert json binary to File final",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -2740,
        -1000
      ]
    },
    {
      "id": "5aabd61e-5407-4be7-b6c9-ab77c7cadad7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3140,
        -780
      ],
      "parameters": {
        "width": 280,
        "height": 340,
        "content": "### 🎨 Image Generation (OpenAI)\nSends a POST request to the OpenAI `/v1/images/generations` endpoint.\n\n- Uses `gpt-image-1` model"
      }
    },
    {
      "id": "93be8801-7fb4-42d7-af2d-1047b8c60d6e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2840,
        -1200
      ],
      "parameters": {
        "width": 300,
        "height": 760,
        "content": "### 🧾 Convert base64 to File\nConverts the `b64_json` field into a binary PNG file to use in the next step.\n\n📤 Output: Final binary image\n"
      }
    },
    {
      "id": "aeafd971-28ad-4c5c-8d26-0d81f82fac01",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3140,
        -1200
      ],
      "parameters": {
        "width": 280,
        "height": 360,
        "content": "### ✏️ Image to image generation (OpenAI)\nSends the binary image to OpenAI’s `/v1/images/edits` endpoint with a descriptive prompt.\n\n- Model: `gpt-image-1`"
      }
    },
    {
      "id": "930bba79-34c4-40da-b22f-4f42b9894705",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -3860,
        -840
      ]
    },
    {
      "id": "abb8a008-0dcb-427c-a00a-7c850790cf4f",
      "name": "Upload Result Image to imgbb",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2220,
        -640
      ]
    },
    {
      "id": "ec0fc073-15f9-4cdf-a2f4-19de2c2b3261",
      "name": "Upload Result Image to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -2440,
        -1000
      ]
    },
    {
      "id": "7487229b-5e94-48d4-b84c-a5725e529e23",
      "name": "File Link",
      "type": "n8n-nodes-base.set",
      "position": [
        -2020,
        -1000
      ]
    },
    {
      "id": "f4f2a07d-4a5e-45d9-96d6-0f5eb1359d6f",
      "name": "Get Input Image by URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3360,
        -840
      ]
    },
    {
      "id": "613aa7b5-8f63-490f-9026-de4971619e41",
      "name": "SETUP API KEY",
      "type": "n8n-nodes-base.set",
      "position": [
        -2440,
        -640
      ]
    },
    {
      "id": "5e276d4c-05c0-4aa2-9f3c-88669c2d259a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2500,
        -1200
      ],
      "parameters": {
        "width": 640,
        "height": 760,
        "content": "## Upload result file to Google Drive OR to [imgbb](https://api.imgbb.com/)"
      }
    },
    {
      "id": "38760191-c39a-4a62-a222-324e5cd83590",
      "name": "Image Generation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3060,
        -620
      ]
    },
    {
      "id": "6abaccab-b49b-41ab-86cd-8bf562472f9d",
      "name": "File Link1",
      "type": "n8n-nodes-base.set",
      "position": [
        -2000,
        -640
      ]
    },
    {
      "id": "7443a6f2-3d0c-4fef-9dbe-56948ea8c17c",
      "name": "Send to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1740,
        -840
      ]
    },
    {
      "id": "efe008a1-1dea-41f8-8778-1556cf0bbbea",
      "name": "Switch Mode",
      "type": "n8n-nodes-base.switch",
      "position": [
        -3640,
        -840
      ]
    }
  ],
  "connections": {
    "File Link": {
      "main": [
        [
          {
            "node": "Send to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Link1": {
      "main": [
        [
          {
            "node": "Send to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Mode": {
      "main": [
        [
          {
            "node": "Edit Image (OpenAI)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Input Image by URL",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Image Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SETUP API KEY": {
      "main": [
        [
          {
            "node": "Upload Result Image to imgbb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Generation": {
      "main": [
        [
          {
            "node": "Convert json binary to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Switch Mode",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Image (OpenAI)": {
      "main": [
        [
          {
            "node": "Convert json binary to File final",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Input Image by URL": {
      "main": [
        [
          {
            "node": "Edit Image (OpenAI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Access Permissions": {
      "main": [
        [
          {
            "node": "File Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert json binary to File": {
      "main": [
        [
          {
            "node": "SETUP API KEY",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Result Image to imgbb": {
      "main": [
        [
          {
            "node": "File Link1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert json binary to File final": {
      "main": [
        [
          {
            "node": "Upload Result Image to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Result Image to Google Drive": {
      "main": [
        [
          {
            "node": "Set Access Permissions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}