AI-Enhanced Image Generation with GPT-4.1: Auto-Expand Prompts to Google Drive & Slack
Short subject → AI-expanded image prompt → OpenAI image generation → Google Drive save → Slack notification
- Who
- Content operators or developers who need automated image generation in n8n with team distribution
- You get
- Turn a one-line subject into a high-quality AI image with cloud storage and instant notification
- You need
- n8n · slack · google-drive
Constraints
Prerequisites: n8n instance; five credentials required—OpenAI API (for image generation), OpenRouter API (for GPT-4.1 prompt expansion), Slack API (for channel notifications), Google Drive OAuth2 (for file storage), HTTP Header Auth (attached to HTTP Request node). Input form: set string variable `subject` in the 'Set image subject' node. Cost conditions: OpenAI image generation billed per call; OpenRouter billed per GPT-4.1 token; services charged at official rates.
What they did
kean published an n8n official template demonstrating how to take a short subject, auto-expand it into a professional image prompt via GPT-4.1, generate an image using OpenAI's gpt-image-1 model, save it to Google Drive, and notify the team via Slack.
How it went
The template describes the expected flow: after entering a subject, the system automatically completes expansion, generation, storage, and notification. No author-reported performance or success rate data (author_report).
Worth knowing
The Slack channelId 'C08QZPHUN1Y' and Google Drive folderId '13INQR6dKeD3YOEILFNb9mOXG4-eDj1ZM' in the template are example values and must be replaced with actual values to run. The default subject 'A monkey holding a banana in cartoon style' in 'Set image subject' is for demonstration only. The OpenRouter node uses model='openai/gpt-4.1'; the image generation node uses model='gpt-image-1' (called directly via OpenAI API, not OpenRouter). The HTTP Request node also has httpHeaderAuth configured but the actual request uses predefinedCredentialType=openAiApi.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- httpRequest node: connect HTTP/API keys per node headers or query params.
- slack node: connect Slack OAuth / Bot Token.
- googleDrive node: connect Google Drive OAuth2 credentials.
Configuration to replace
- Source template is n8n public workflow #11459 (~15 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Trigger the workflow
Click 'Execute workflow' in the n8n editor to trigger manually, or replace with a Schedule/Webhook trigger. Data then flows into the 'Set image subject' node.
Set the image subject
In the 'Set image subject' node (Edit Fields/Set node), set variable `subject` to your desired image theme. The template default is 'A monkey holding a banana in cartoon style'; replace with your actual subject.
AI expands the image prompt
The 'Image Prompt' node (AI Agent, promptType=define) receives `{{ $json.subject }}` as input, calling the connected 'GPT 4.1' node (OpenRouter Chat Model, model='openai/gpt-4.1'). The systemMessage instructs the model to expand a simple concept into a professional image prompt covering subject, environment, art style, mood/lighting, and specific details.
Execution prompt · Source text。Image Prompt node (AI Agent) Options > System Message field
= You are a specialist in crafting high-quality image prompts. Your task is to take a simple concept and expand it into a fully detailed prompt suitable for text-to-image generation models. Prompt Requirements Your expanded prompt must explicitly cover: 1. Primary Subject: The central figure, object, or scene. 2. Environment/Setting: The surrounding context, location, or background activity. 3. Art Style: The visual treatment (e.g., hyper-realistic, digital illustration, watercolor, anime, 3D render). 4. Mood & Lighting: The emotional tone and lighting conditions (e.g., warm sunrise, dramatic shadows, neon glow). 5. Specific Details: Any notable elements such as colors, textures, props, clothing, or defining features. Output Format • Start with a polished, coherent descriptive prompt that naturally incorporates all elements. • Write it as if instructing an AI to generate a professional, visually rich image. • Do not repeat the input phrase; reinterpret it as a vivid scene. • Use detailed, evocative language. Example Input: “A futuristic city” Output: “A vast nighttime metropolis illuminated by blue and purple neon. Sleek glass skyscrapers stretch into a misty sky while streams of flying vehicles weave between them. Crowded streets glow with holographic ads and pedestrians in advanced techwear. Digital-painting style, cinematic detail, moody atmosphere with neon reflections shimmering across wet pavement.”
Generate image
The 'Generate Image' node (HTTP Request) sends a POST request to `https://api.openai.com/v1/images/generations`. The body includes model='gpt-image-1', prompt='={{ $json.output.replace(/"/g, '') }}' (the expanded prompt with quotes removed), and size='1024x1024'. Requires openAiApi credential.
Convert and save to Google Drive
The 'Convert to File' node converts `data[0].b64_json` from the HTTP response to binary; the 'Save image to Drive' node (Google Drive) saves it as `={{ $('Set image subject').item.json.subject }}.png` to a specified Google Drive folder. Requires googleDriveOAuth2Api credential; replace folderId with your actual folder ID.
Slack notification
The 'Send a message' node (Slack) sends a Block Kit message to the specified channel with image name, Google Drive preview link, and thumbnail. Requires slackApi credential; replace channelId with your actual channel ID.
Prompt you can copy
Setup guidance · Editorial suggestion。交给搭建助手,先确认输入和权限
This block is the prompt. Ads are never placed here.
You are an n8n workflow setup assistant. The user wants to replicate an AI-enhanced image generation template: input subject → GPT-4.1 expands prompt → OpenAI generates image → Google Drive storage → Slack notification. First confirm the user has an n8n instance ready, then check that these credentials are configured: OpenAI API, OpenRouter API, Google Drive OAuth2, Slack API. Then assist with importing the workflow JSON or building step-by-step.
Before building, confirm five credentials are configured and replace the example channelId, folderId, and default subject.
Source
AI-enhanced image generation with GPT-4.1, Google Drive & Slack notifications · kean · n8n.io · 2025-12-03
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.