{
  "id": 7502,
  "name": "Manage Google Cloud Storage with AI image generation using GPT-4 Mini",
  "description": "# Beginner\u2019s Tutorial: Manage Google Cloud Storage Buckets and Objects with n8n\n### Watch the demo video below:\n[![Watch the video](https://s3.ap-southeast-1.amazonaws.com/automatewith.me/manage-google-cloud-storage-with-ai-image-generation-using-gpt-41-mini.jpg)](https://www.youtube.com/watch?v=2iJfmQgVL6E)\n## **Who\u2019s it for**\n- Beginners who want to learn how to automate Google Cloud Storage (GCS) operations with n8n.  \n- Developers who want to combine **AI image generation** with **cloud storage management**.  \n- Anyone looking for a simple introduction to working with **Buckets** and **Objects** in GCS.  \n\n## **How it works / What it does**\nThis workflow demonstrates end-to-end usage of **Google Cloud Storage** with AI integration:  \n\n1. **Trigger:** Start manually by clicking *Execute Workflow*.  \n2. **Edit Fields:** Provide input values (e.g., bucket name or image description).  \n3. **List Buckets:** Retrieve all existing buckets in the project (branch: view only).  \n4. **Create Bucket:** If needed, create a new bucket to store objects.  \n5. **Prompt Generation Agent:** Use an AI model to generate a creative text prompt.  \n6. **Generate Image:** Convert the AI-generated prompt into an image.  \n7. **Upload Object:** Store the generated image as an object in the selected bucket.  \n8. **Delete Object:** Clean up by removing the uploaded object if required.  \n\nThis shows the full lifecycle: *Bucket \u2192 Object (Create/Upload/Delete)* combined with AI image generation.  \n\n## **How to set up**\n1. **Trigger the workflow:** Use the *When clicking Execute workflow* node to start manually.  \n2. **Provide inputs:** In *Edit Fields*, specify details such as bucket name or description text for the image.  \n3. **List buckets:** Use the *List Buckets* node to see what exists.  \n4. **Create a bucket:** Use *Create Bucket* if you want a new storage bucket.  \n5. **Generate prompt & image:**  \n   - The *Prompt Generation Agent* uses an OpenAI Chat Model to create an image prompt.  \n   - The *Generate an Image* node turns this prompt into an actual image.  \n6. **Upload to bucket:** Use *Create Object* to upload the generated image into your GCS bucket.  \n7. **Delete object (optional):** Use *Delete Object* to remove the file from the bucket as a cleanup step.  \n\n## **Requirements**\n- An active **Google Cloud account** with **Cloud Storage API enabled**.  \n- A **Service Account Key (JSON)** credential added in n8n for GCS.  \n- An **OpenAI API Key** configured in n8n for the prompt and image generation nodes.  \n- Basic familiarity with running workflows in n8n.  \n  \n## **How to customize the workflow**\n- **Different object types:** Instead of images, upload PDFs, logs, or text files.  \n- **Automatic cleanup:** Skip the delete step if you want objects to persist.  \n- **Schedule trigger:** Replace manual execution with a weekly or daily schedule.  \n- **Dynamic prompts:** Accept user input from a form or webhook to generate images.  \n- **Multi-bucket management:** Extend the logic to manage multiple buckets across projects.  \n- **Notifications:** Add a Slack/Email step after upload to notify your team with the object URL.  \n\n\u2705 By the end of this tutorial, you\u2019ll understand how to:  \n- Work with **Buckets** (list, create).  \n- Work with **Objects** (upload, delete).  \n- Integrate **AI image generation** with Google Cloud Storage.  ",
  "categories": [
    {
      "id": 36,
      "name": "File Management"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 740,
  "createdAt": "2025-08-17T07:56:19.333Z",
  "workflow": {
    "id": "nSlsWDi56czfBf3u",
    "meta": {
      "instanceId": "4a2e6764ba7a6bc9890d9225f4b21d570ce88fc9bd57549c89057fcee58fed0f",
      "templateCredsSetupCompleted": true
    },
    "name": "Beginner\u2019s Tutorial: Manage Google Cloud Storage Buckets and Objects with n8n",
    "tags": [
      {
        "id": "NacOgNreMya1Dsve",
        "name": "google cloud",
        "createdAt": "2025-08-17T07:30:47.533Z",
        "updatedAt": "2025-08-17T07:30:47.533Z"
      }
    ],
    "nodes": [
      {
        "id": "45a84f10-bd83-4896-8419-1e7ef93377c5",
        "name": "OpenAI Chat Model",
        "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
        "position": [
          448,
          248
        ],
        "parameters": {
          "model": {
            "__rl": true,
            "mode": "list",
            "value": "gpt-4.1-mini"
          },
          "options": {}
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1.2
      },
      {
        "id": "9ba48335-7513-4c59-a727-c2bdb45241aa",
        "name": "Generate an image",
        "type": "@n8n/n8n-nodes-langchain.openAi",
        "position": [
          752,
          24
        ],
        "parameters": {
          "prompt": "={{ $json.output }}",
          "options": {},
          "resource": "image"
        },
        "credentials": {
          "openAiApi": {
            "id": "credential-id",
            "name": "openAiApi Credential"
          }
        },
        "typeVersion": 1.8
      },
      {
        "id": "bb4afa1e-8c09-402c-bc36-ba6f4f973a48",
        "name": "Prompt Generation Agent",
        "type": "@n8n/n8n-nodes-langchain.agent",
        "position": [
          352,
          24
        ],
        "parameters": {
          "text": "=You're prompt generator agent, you will create prompt for the open-ai image generation model with a random topic among:\n- Education\n- Science \n- Sport\n- Economy\n- Health\nOutput the prompt only, nothing else",
          "options": {},
          "promptType": "define"
        },
        "typeVersion": 2.1
      },
      {
        "id": "127f18fb-aba1-4524-9ffe-874571d0e1cc",
        "name": "When clicking \u2018Execute workflow\u2019",
        "type": "n8n-nodes-base.manualTrigger",
        "position": [
          -320,
          -124
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "b985d495-9156-4b5b-9042-163c13095bd0",
        "name": "Edit Fields",
        "type": "n8n-nodes-base.set",
        "position": [
          -96,
          -124
        ],
        "parameters": {
          "options": {},
          "assignments": {
            "assignments": [
              {
                "id": "af3e6c69-fbfe-49f4-9c29-3a68a821c5a6",
                "name": "project_id",
                "type": "string",
                "value": "n8n-project-467007"
              },
              {
                "id": "1a693ae0-2ba0-4b1b-a00a-4399a8d3ab57",
                "name": "location",
                "type": "string",
                "value": "asia-southeast1"
              }
            ]
          }
        },
        "typeVersion": 3.4
      },
      {
        "id": "771db667-e53d-44da-9493-62aac39fbf6c",
        "name": "Get a list of Buckets for a given project",
        "type": "n8n-nodes-base.googleCloudStorage",
        "position": [
          128,
          -272
        ],
        "parameters": {
          "projectId": "={{ $json.project_id }}",
          "requestOptions": {}
        },
        "credentials": {
          "googleCloudStorageOAuth2Api": {
            "id": "credential-id",
            "name": "googleCloudStorageOAuth2Api Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "cc89fc60-4a79-45f9-af40-99425e9eb1e9",
        "name": "Create a new Bucket",
        "type": "n8n-nodes-base.googleCloudStorage",
        "position": [
          128,
          24
        ],
        "parameters": {
          "createAcl": {},
          "operation": "create",
          "projectId": "={{ $json.project_id }}",
          "bucketName": "=bucket{{ $workflow.id.toLowerCase() }}{{ $now.format('hhmm') }}",
          "createBody": {
            "dataLocations": "=[ {{ $json.location }}]"
          },
          "requestOptions": {}
        },
        "credentials": {
          "googleCloudStorageOAuth2Api": {
            "id": "credential-id",
            "name": "googleCloudStorageOAuth2Api Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "b23df0ef-1fa9-41b4-97dd-9493f58ca7af",
        "name": "No Operation, do nothing",
        "type": "n8n-nodes-base.noOp",
        "position": [
          440,
          -272
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "bbda235c-aecb-4d0b-9174-eb5046017402",
        "name": "Create an object",
        "type": "n8n-nodes-base.googleCloudStorage",
        "position": [
          976,
          24
        ],
        "parameters": {
          "resource": "object",
          "operation": "create",
          "bucketName": "={{ $('Create a new Bucket').item.json.name }}",
          "createData": {},
          "objectName": "=object_{{ $now.format('yyyyMMdd') }}.{{ $json.fileExtension }}",
          "createQuery": {},
          "requestOptions": {},
          "encryptionHeaders": {}
        },
        "credentials": {
          "googleCloudStorageOAuth2Api": {
            "id": "credential-id",
            "name": "googleCloudStorageOAuth2Api Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "4c62f2ea-3891-46fd-bd3c-f3b9cabe2566",
        "name": "Delete an object from a bucket",
        "type": "n8n-nodes-base.googleCloudStorage",
        "position": [
          1200,
          24
        ],
        "parameters": {
          "resource": "object",
          "operation": "delete",
          "bucketName": "={{ $json.bucket }}",
          "objectName": "={{ $json.name }}",
          "getParameters": {},
          "requestOptions": {}
        },
        "credentials": {
          "googleCloudStorageOAuth2Api": {
            "id": "credential-id",
            "name": "googleCloudStorageOAuth2Api Credential"
          }
        },
        "typeVersion": 1
      },
      {
        "id": "0f7d43ea-ca03-4fb5-a13c-ce238a16158d",
        "name": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -1680,
          -640
        ],
        "parameters": {
          "width": 1200,
          "height": 1280,
          "content": "# Beginner\u2019s Tutorial: Manage Google Cloud Storage Buckets and Objects with n8n\n\n## **Who\u2019s it for**\n- Beginners who want to learn how to automate Google Cloud Storage (GCS) operations with n8n.  \n- Developers who want to combine **AI image generation** with **cloud storage management**.  \n- Anyone looking for a simple introduction to working with **Buckets** and **Objects** in GCS.  \n\n## **How it works / What it does**\nThis workflow demonstrates end-to-end usage of **Google Cloud Storage** with AI integration:  \n\n1. **Trigger:** Start manually by clicking *Execute Workflow*.  \n2. **Edit Fields:** Provide input values (e.g., bucket name or image description).  \n3. **List Buckets:** Retrieve all existing buckets in the project (branch: view only).  \n4. **Create Bucket:** If needed, create a new bucket to store objects.  \n5. **Prompt Generation Agent:** Use an AI model to generate a creative text prompt.  \n6. **Generate Image:** Convert the AI-generated prompt into an image.  \n7. **Upload Object:** Store the generated image as an object in the selected bucket.  \n8. **Delete Object:** Clean up by removing the uploaded object if required.  \n\nThis shows the full lifecycle: *Bucket \u2192 Object (Create/Upload/Delete)* combined with AI image generation.  \n\n## **How to set up**\n1. **Trigger the workflow:** Use the *When clicking Execute workflow* node to start manually.  \n2. **Provide inputs:** In *Edit Fields*, specify details such as bucket name or description text for the image.  \n3. **List buckets:** Use the *List Buckets* node to see what exists.  \n4. **Create a bucket:** Use *Create Bucket* if you want a new storage bucket.  \n5. **Generate prompt & image:**  \n   - The *Prompt Generation Agent* uses an OpenAI Chat Model to create an image prompt.  \n   - The *Generate an Image* node turns this prompt into an actual image.  \n6. **Upload to bucket:** Use *Create Object* to upload the generated image into your GCS bucket.  \n7. **Delete object (optional):** Use *Delete Object* to remove the file from the bucket as a cleanup step.  \n\n## **Requirements**\n- An active **Google Cloud account** with **Cloud Storage API enabled**.  \n- A **Service Account Key (JSON)** credential added in n8n for GCS.  \n- An **OpenAI API Key** configured in n8n for the prompt and image generation nodes.  \n- Basic familiarity with running workflows in n8n.  \n  \n## **How to customize the workflow**\n- **Different object types:** Instead of images, upload PDFs, logs, or text files.  \n- **Automatic cleanup:** Skip the delete step if you want objects to persist.  \n- **Schedule trigger:** Replace manual execution with a weekly or daily schedule.  \n- **Dynamic prompts:** Accept user input from a form or webhook to generate images.  \n- **Multi-bucket management:** Extend the logic to manage multiple buckets across projects.  \n- **Notifications:** Add a Slack/Email step after upload to notify your team with the object URL.  \n\n\u2705 By the end of this tutorial, you\u2019ll understand how to:  \n- Work with **Buckets** (list, create).  \n- Work with **Objects** (upload, delete).  \n- Integrate **AI image generation** with Google Cloud Storage.  "
        },
        "typeVersion": 1
      },
      {
        "id": "583e8c1e-2656-4826-a44f-3473e2ce63df",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -400,
          -304
        ],
        "parameters": {
          "width": 352,
          "height": 112,
          "content": "### 1. Start the Workflow\nBegin by manually executing the workflow. This helps you test and understand each step before automating it with a schedule."
        },
        "typeVersion": 1
      },
      {
        "id": "93a9d84f-15ee-4abc-88b2-2ded850d044d",
        "name": "Sticky Note2",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -176,
          48
        ],
        "parameters": {
          "height": 128,
          "content": "### 2. Provide Input Fields\nFill in the required fields such as the bucket name and image description. These inputs will guide how the workflow runs."
        },
        "typeVersion": 1
      },
      {
        "id": "54648e02-71b1-4cb9-93c1-0911a8752a27",
        "name": "Sticky Note3",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          96,
          -512
        ],
        "parameters": {
          "height": 192,
          "content": "### 3. List all the current Google Cloud Storage buckets \nList all the current Google Cloud Storage buckets in your project. This lets you see what\u2019s already available before creating new ones.\n\n"
        },
        "typeVersion": 1
      },
      {
        "id": "2102a37c-3c07-4629-b31e-24b1d093973d",
        "name": "Sticky Note4",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          80,
          240
        ],
        "parameters": {
          "height": 128,
          "content": "### 4. Create a New Bucket\nIf the bucket you want does not exist, the workflow can create a new bucket for you automatically."
        },
        "typeVersion": 1
      },
      {
        "id": "401fb591-bb05-484c-8b50-48ad51f68e60",
        "name": "Sticky Note5",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          352,
          -144
        ],
        "parameters": {
          "width": 496,
          "content": "\n### 5. Generate an AI Prompt\n- Use the AI agent to turn your simple input into a more descriptive or creative prompt. This will be used for image generation.\n- Send the AI-generated prompt to the image generation node and produce an image file."
        },
        "typeVersion": 1
      },
      {
        "id": "8129411b-27a2-4d11-ab54-e73a7af4042c",
        "name": "Sticky Note6",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          912,
          240
        ],
        "parameters": {
          "height": 144,
          "content": "### 7. Upload the Image to a Bucket\nTake the generated image and upload it as an object inside your chosen Google Cloud Storage bucket."
        },
        "typeVersion": 1
      },
      {
        "id": "a6246de7-0736-4040-af21-18b337e3e524",
        "name": "Sticky Note7",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          1184,
          -176
        ],
        "parameters": {
          "content": "### 8. Delete the Object (Optional)\nIf you no longer need the file, the workflow can also remove the object from the bucket to keep storage clean."
        },
        "typeVersion": 1
      }
    ],
    "active": false,
    "pinData": {},
    "settings": {
      "executionOrder": "v1"
    },
    "versionId": "3f6f80f3-c6fd-4640-b5c2-2f3c89eec940",
    "connections": {
      "Edit Fields": {
        "main": [
          [
            {
              "node": "Get a list of Buckets for a given project",
              "type": "main",
              "index": 0
            },
            {
              "node": "Create a new Bucket",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Create an object": {
        "main": [
          [
            {
              "node": "Delete an object from a bucket",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Generate an image": {
        "main": [
          [
            {
              "node": "Create an object",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "OpenAI Chat Model": {
        "ai_languageModel": [
          [
            {
              "node": "Prompt Generation Agent",
              "type": "ai_languageModel",
              "index": 0
            }
          ]
        ]
      },
      "Create a new Bucket": {
        "main": [
          [
            {
              "node": "Prompt Generation Agent",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Prompt Generation Agent": {
        "main": [
          [
            {
              "node": "Generate an image",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "When clicking \u2018Execute workflow\u2019": {
        "main": [
          [
            {
              "node": "Edit Fields",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "Get a list of Buckets for a given project": {
        "main": [
          [
            {
              "node": "No Operation, do nothing",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 18,
    "nodeTypes": {
      "n8n-nodes-base.set": {
        "count": 1
      },
      "n8n-nodes-base.noOp": {
        "count": 1
      },
      "n8n-nodes-base.stickyNote": {
        "count": 8
      },
      "n8n-nodes-base.manualTrigger": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.agent": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.openAi": {
        "count": 1
      },
      "n8n-nodes-base.googleCloudStorage": {
        "count": 4
      },
      "@n8n/n8n-nodes-langchain.lmChatOpenAi": {
        "count": 1
      }
    }
  },
  "nodes": [
    "OpenAI Chat Model",
    "Generate an image",
    "Prompt Generation Agent",
    "When clicking \u2018Execute workflow\u2019",
    "Edit Fields",
    "Get a list of Buckets for a given project",
    "Create a new Bucket",
    "No Operation, do nothing",
    "Create an object",
    "Delete an object from a bucket",
    "Sticky Note",
    "Sticky Note1",
    "Sticky Note2",
    "Sticky Note3",
    "Sticky Note4",
    "Sticky Note5",
    "Sticky Note6",
    "Sticky Note7"
  ],
  "nodeTypes": [
    "@n8n/n8n-nodes-langchain.agent",
    "n8n-nodes-base.noOp",
    "n8n-nodes-base.stickyNote",
    "@n8n/n8n-nodes-langchain.openAi",
    "n8n-nodes-base.manualTrigger",
    "n8n-nodes-base.googleCloudStorage",
    "n8n-nodes-base.set",
    "@n8n/n8n-nodes-langchain.lmChatOpenAi"
  ]
}