{
  "name": "Generate and Edit Images with OpenAI's GPT-Image-1 Model",
  "nodes": [
    {
      "id": "0e78a29e-87ba-4665-84c1-a413c45e25dc",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -420,
        -40
      ]
    },
    {
      "id": "fe7b054a-e0c9-4642-a97f-6bec60a1ec55",
      "name": "Edit Image (OpenAI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        -40
      ]
    },
    {
      "id": "1e1df05c-d8f9-4033-87ee-70be344ab961",
      "name": "Create image call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -120,
        -40
      ]
    },
    {
      "id": "4c44da91-0d12-4e7f-bc89-5accddd837d7",
      "name": "Convert json binary to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        200,
        -40
      ]
    },
    {
      "id": "3b8936b7-f0a2-4776-b10a-f06ceb9af31d",
      "name": "Convert json binary to File final",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        820,
        -40
      ]
    },
    {
      "id": "3d3238d5-6040-4b74-8e6a-9e1e64198099",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -200
      ],
      "parameters": {
        "width": null,
        "height": 320,
        "content": "### 🧪 Manual Trigger\nStarts the workflow manually. Ideal for testing and debugging purposes.\n"
      }
    },
    {
      "id": "c3378100-f688-4199-a038-83b9220afa91",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -320
      ],
      "parameters": {
        "width": 280,
        "height": 440,
        "content": "### 🎨 Image Generation (OpenAI)\nSends a POST request to the OpenAI `/v1/images/generations` endpoint.\n\n- Uses `gpt-image-1` model\n- Generates an image from a given prompt\n- Returns a base64-encoded im"
      }
    },
    {
      "id": "82a880de-74de-44e5-8448-f487c9376d0e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        -200
      ],
      "parameters": {
        "width": 280,
        "height": 320,
        "content": "### 🧾 Convert base64 to File\nConverts the `b64_json` field into a binary PNG file to use in the next step.\n\n📤 Output: Binary image under the `data` field\n"
      }
    },
    {
      "id": "42ccb29f-b820-4791-9683-4eb0f00ff2d3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        420,
        -320
      ],
      "parameters": {
        "width": 280,
        "height": 440,
        "content": "### ✏️ Image Editing (OpenAI)\nSends the binary image to OpenAI’s `/v1/images/edits` endpoint with a descriptive prompt.\n\n- Model: `gpt-image-1`\n- Format: `multipart/form-data`\n- Requires a real file ("
      }
    },
    {
      "id": "4c8846ab-b3f2-4c7c-9283-5a40a55b816d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -240
      ],
      "parameters": {
        "width": 280,
        "height": 360,
        "content": "### 🧾 Final Conversion (base64 → File)\nConverts the edited image (`b64_json`) into a downloadable or previewable PNG file.\n\n📤 Output: Final binary image\n"
      }
    },
    {
      "id": "2b2533f8-b7aa-4499-970e-9b0546b73c0e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1240,
        -860
      ],
      "parameters": {
        "width": 700,
        "height": 980,
        "content": "## 🧠 Image AI Workflow Overview\n\nThis workflow uses OpenAI's image generation and editing APIs with the `gpt-image-1` model.\n\n### 🔑 Requirements:\n- You **must use your own OpenAI API key** from https:"
      }
    }
  ],
  "connections": {
    "Create image call": {
      "main": [
        [
          {
            "node": "Convert json binary to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Image (OpenAI)": {
      "main": [
        [
          {
            "node": "Convert json binary to File final",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert json binary to File": {
      "main": [
        [
          {
            "node": "Edit Image (OpenAI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Create image call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}