Mastering OpenAI with n8n: Automate ChatGPT, Davinci & DALLE-2

Discover how this unique n8n workflow integrates OpenAI’s ChatGPT, Davinci, Whisper, and DALLE-2 models to automate text summarization, translation, AI image generation, and more. Save valuable time processing diverse content types with tailored AI-powered automation.
openAi
manualTrigger
code
+5
Workflow Identifier: 2240
NODES in Use: Manual Trigger, OpenAI, Code, HTTP Request, Set, HTML, Read Binary Files, Sticky Note

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

Opening Problem Statement ⚙️

Meet Alex, a digital content manager overwhelmed with repetitive AI requests every day. He spends hours manually summarizing text documents, translating content, and generating creative images for blog covers. This tedious workflow not only wastes valuable time but also increases the risk of errors and inconsistency, especially when juggling multiple AI models like OpenAI’s GPT-3, ChatGPT, and DALLE-2.

For Alex, manually handling transcripts, translating to different languages, creating concise summaries, and designing eye-catching images means countless hours and lost productivity. Imagine losing 5-10 hours weekly just processing content that could be automated seamlessly!

What This Automation Does

This n8n workflow harnesses multiple OpenAI models — including Davinci 003, ChatGPT, Whisper, and DALLE-2 — to automate AI-powered content processing tasks.

  • Manual Trigger Start: Begin the workflow execution on demand.
  • Text Completion with Davinci 003: Generate summaries and edits based on input text.
  • ChatGPT Conversations: Create TL;DR summaries with customizable system and user prompts, including emoji enhancements.
  • Translation: Translate text to German using both Davinci Edit and ChatGPT nodes.
  • Audio Transcription with Whisper (disabled by default): Transcribe audio files into text for further AI processing.
  • AI Image Generation using DALLE-2: Automatically generate multiple comic-style cover images based on ChatGPT-generated prompts.
  • Dynamic Code Execution: Utilize JavaScript code nodes to prepare data and messages for API calls.
  • HTML Generation with SVG graphics: Produce colorful, random SVG images using GPT models for creative outputs.

By automating these eight distinct AI tasks, Alex can save hours weekly, reduce manual errors, and scale content creation efforts with a few clicks.

Prerequisites ⚙️

  • n8n account with access to workflow editor.
  • OpenAI account with API access enabled for GPT-3, ChatGPT, Whisper, and DALLE-2 models. 🔑
  • Basic knowledge of JavaScript for customizing code nodes.
  • Optional: Prepared audio files for transcription (disabled by default). 🔊

Consider self-hosting n8n for privacy and control using providers like Hostinger (https://buldrr.com/hostinger).

Step-by-Step Guide to Deploy This Workflow

1. Start with Manual Trigger Node

Navigate to your n8n editor and add a Manual Trigger node named “When clicking “Execute Workflow””. This node starts the workflow when you want, giving you control over execution.

No parameters needed here. This is your starting point.

Common mistake: Accidentally linking this node to multiple branches at once without expected logic can cause confusion.

2. Set Up the Text Example Node (Code Node)

Add a Code node named “Text-example” with the following JavaScript code to provide sample scientific text as input:

return [
 {
  "text": "Science Underground with your host, Anissa Ramirez. In this episode, how to stop your bathroom mirror from fogging up with a little dash of science..."
 }
];

This acts as a sample input to test AI summarization and translation.

Expected outcome: The node outputs sample text ready for AI processing.

Watch out: Modify the text only if you want to experiment with different inputs.

3. Use Davinci 003 for Text Completion

Add an OpenAI (Davinci 003 Complete) node titled “davinci-003-complete”. Configure it as:

  • Prompt: Use the expression = {{ $json.text }}nnTl;dr: to append a TL;DR request to the text.
  • Max tokens: 500 (to limit output length).
  • Credentials: Select your OpenAI API credentials.

This node generates a summary based on the text example.

Common mistake: Forgetting to set max tokens or using incorrect prompt formatting.

4. Add ChatGPT Conversation Examples

Deploy the following OpenAI ChatGPT nodes:

  • ChatGPT-ex1.1: Summarizes text using a user-only prompt.
  • ChatGPT-ex1.2: Translates the summarized text to German.
  • ChatGPT-ex2: Uses system content to instruct ChatGPT to add 5 emojis at the end of its TL;DR answer.

Configure each node’s message prompts accordingly, embedding expressions to pass incoming text.

Expected result: Multiple AI-generated summaries and translations ready for review.

5. Use Davinci Edit for Translation

Add an OpenAI (Davinci Edit) node named “davinci-003-edit” to translate the original input text to German.

Configure:

  • Input: Expression = {{ $json.text }}.
  • Instruction: “translate to German”.

This node complements the ChatGPT translation path.

6. Optional: Enable Audio Transcription with Whisper

Activate the Read Binary Files node “LoadMP3” and the HTTP Request node “Whisper-transcribe” if you have MP3 audio files for transcription.

Configure your audio file path in the “LoadMP3” node. The Whisper API call will send the audio for transcription and output text for further processing.

Note: This branch is disabled by default to save API calls.

7. Use Code Node to Format ChatGPT Messages

Add the JavaScript Code node named “Code-ex3.1”:

var intext = $input.first().json;

var messages = [
 {"role": "system", "content": "You are a helpful assistant. Write a Tl;dr of each user message"},
 {"role": "user", "content": intext.text}
];

return {"messages":messages};

This prepares a message array suitable for the ChatGPT API HTTP Request node.

8. Call ChatGPT API via HTTP Request Node

Add the HTTP Request node named “ChatGPT-ex3.1” configured as:

  • Method: POST
  • URL: https://api.openai.com/v1/chat/completions
  • Body: JSON with model gpt-3.5-turbo, messages key with the array from the previous node, temperature 0.8, max tokens 500.
  • Authentication: Use the predefined OpenAI credential.

This node programmatically calls ChatGPT with the formatted message array for a TL;DR response.

9. Generate AI Cover Image Prompt with ChatGPT

Use an OpenAI (ChatGPT) node “ChatGPT-ex3.2” configured to act as a DALLE-2 prompt generator:

  • System prompt: “You are now a DALLE-2 prompt generation tool that will generate a suitable prompt. Write a prompt to create a cover image relevant to the user input in a 60s comic style.”
  • User prompt: Use the TL;DR text from the previous ChatGPT response.

This creatively crafts an image prompt based on AI-summarized content.

10. Generate Comic Style Images with DALLE-2

Add an OpenAI (DALLE-ex3.3) image generation node:

  • Prompt: Use the message content from the ChatGPT prompt generator.
  • Options: Generate 4 images sized 512×512.

This node outputs four creative images matching the TL;DR cover prompt, perfect for blog or social media use.

11. Generate HTML SVG Image Code

Use a Set node “Set-ex4” to define parameters for SVG generation: model name, prompt for colorful random shapes.

Follow this with a ChatGPT (OpenAI) node “ChatGPT-ex4” to generate the SVG code with GPT-3.5-turbo-0301 model.

Finally, add an HTML node “HTML-ex4” to render or export the SVG image code.

Customizations ✏️

  • Switch AI Model: Change the model parameter in the “Set-ex4” or any OpenAI node to experiment with different GPT versions or temperature levels for varied creativity.
  • Add More Languages: Extend the translation nodes (Davinci Edit, ChatGPT) to other languages by changing the instructions and prompts.
  • Enable Whisper Transcription: Activate and configure the “LoadMP3” and “Whisper-transcribe” nodes to add audio transcription to your workflow.
  • Customize Emoji Count: In the “ChatGPT-ex2” node, edit the system message to modify the number of emojis added to the response.
  • Adjust Image Style: Modify the system prompt in “ChatGPT-ex3.2” to change the cover image style from comic 60s to modern or watercolor.

Troubleshooting 🔧

  • Problem: “401 Unauthorized error from OpenAI API.”
    • Cause: Invalid or expired API credentials.
    • Solution: Verify your OpenAI API key in n8n credentials. Re-authenticate if necessary.
  • Problem: “ChatGPT returns incomplete or cut-off responses.”
    • Cause: maxTokens parameter is set too low.
    • Solution: Increase maxTokens in your OpenAI node settings to accommodate longer responses.
  • Problem: “Audio transcription node failed to process file.”
    • Cause: Incorrect file path or unsupported audio format.
    • Solution: Confirm file location and ensure MP3 format compatibility.
  • Problem: “HTTP Request node to OpenAI returns JSON parse errors.”
    • Cause: Malformed JSON or incorrect body format.
    • Solution: Double-check the JSON structure in body parameters and ensure proper message array formatting.

Pre-Production Checklist ✅

  • Confirm OpenAI API credentials are valid in n8n.
  • Test each OpenAI node individually with sample text used in the “Text-example” node.
  • Verify the manual trigger starts workflow execution as expected.
  • Ensure optional Whisper nodes are disabled unless you have audio files and API quota.
  • Back up your workflow before making significant edits.

Deployment Guide

In n8n editor, activate your workflow by pressing the toggle switch. For manual trigger workflows, simply click “Execute Workflow” to test.

Monitor executions and logs in the n8n dashboard to troubleshoot any issues during runtime.

FAQs ✏️

  • Can I replace OpenAI models with similar services? You can try, but this workflow uses OpenAI-specific features and endpoints, so switching requires node and API changes.
  • Does this workflow consume many API credits? Yes, API calls to OpenAI models can accumulate costs. Manage usage carefully and disable unused nodes.
  • Is my data safe? All API calls happen over HTTPS, but you should review OpenAI’s privacy policies.
  • Can this workflow handle large volumes? Reasonably so, but consider API rate limits and scaling infrastructure for heavy loads.

Conclusion

By following this detailed guide, you have built a powerful OpenAI automation using n8n that:

  • Summarizes and translates text efficiently with Davinci and ChatGPT.
  • Generates creative comic-style cover images automatically via DALLE-2.
  • Prepares HTML SVG graphics for additional creative uses.
  • Optionally transcribes audio with Whisper for complete media processing.

This workflow saves you hours every week, reduces repetitive manual work, and leverages AI to produce high-quality content fast. Next, consider expanding this setup with email integration or multilingual content pipelines to enhance your automation capabilities further.

Enjoy your AI-powered workflow journey with n8n!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n (Beginner Guide)

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free