{ "id": "147", "meta": { "instanceId": "workflow-ec12d675", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:51.560112", "updatedAt": "2025-09-29T07:07:51.560126", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production" }, "name": "OpenAI-model-examples", "tags": [ "automation", "n8n", "production-ready", "excellent", "optimized" ], "nodes": [ { "id": "ad6dc2cd-21cc-4563-86ba-f78cc4a55543", "name": "When clicking \"Execute Workflow\"", "type": "n8n-nodes-base.manualTrigger", "position": [ -640, 380 ], "parameters": {}, "typeVersion": 1, "notes": "This manualTrigger node performs automated tasks as part of the workflow." }, { "id": "b370da23-ead4-4221-b7fe-a9d943f7fbb9", "name": "davinci-003-complete", "type": "n8n-nodes-base.openAi", "position": [ 1160, 60 ], "parameters": { "prompt": "={{ $json.text }}\n\nTl;dr:", "options": { "maxTokens": "YOUR_TOKEN_HERE" } }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "5e04f355-36c0-4540-8e65-68118cb73135", "name": "ChatGPT-ex2", "type": "n8n-nodes-base.openAi", "position": [ 1160, 740 ], "parameters": { "prompt": { "messages": [ { "role": "system", "content": "=You are an assistant. Always add 5 emojis to the end of your answer." }, { "content": "=Write tl;dr of the wollowing text: {{ $json.text}}" } ] }, "options": { "maxTokens": "YOUR_TOKEN_HERE", "temperature": 0.8 }, "resource": "chat" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "16a7cf80-16e3-44f9-b15c-7501417fe38f", "name": "davinci-003-edit", "type": "n8n-nodes-base.openAi", "position": [ 1340, 60 ], "parameters": { "input": "={{ $json.text }}", "options": {}, "operation": "edit", "instruction": "translate to German" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "95254870-65c3-4714-83fb-20ba2c0ca007", "name": "ChatGPT-ex1.1", "type": "n8n-nodes-base.openAi", "position": [ 1160, 380 ], "parameters": { "prompt": { "messages": [ { "content": "=Write a Tl;dr of the followint text: {{ $json.text }}" } ] }, "options": { "maxTokens": "YOUR_TOKEN_HERE" }, "resource": "chat" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "be9c4820-18b0-46fd-a5a0-51a5dc3ebed5", "name": "ChatGPT-ex1.2", "type": "n8n-nodes-base.openAi", "position": [ 1340, 380 ], "parameters": { "prompt": { "messages": [ { "content": "=Translate to German the following text: {{ $json.message.content }}" } ] }, "options": { "maxTokens": "YOUR_TOKEN_HERE" }, "resource": "chat" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "c52c875b-5270-44ac-bfca-ce25124e3d04", "name": "Text-example", "type": "n8n-nodes-base.code", "position": [ 540, 380 ], "parameters": { "jsCode": "return [\n {\n \"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. I'm Anissa Ramirez and this is Science Underground. We've all been there. You come out of the shower and you go to the mirror and you can't see yourself because the mirror is fogged up. You can't see anything until you first clear off the surface. Every morning it's the same thing. Shower, fog, shower, fog, shower, fog. There's gotta be a better way. Well, there is. Before you take the next shower, wipe a bit of shaving cream on the surface of the mirror and keep it there for about 30 seconds. Then wipe it off. The next time you take a shower, that part of the mirror that was covered with shaving cream will be amazingly fog free. And the shaving cream will keep the water from fogging up for a few weeks. So what's going on? Well, the fog on your mirror is made out of little itty bitty water droplets. If you were to look at the surface of the mirror under the microscope, you will see that the surface looks like a newly waxed car. The water forms beads, preventing you from seeing yourself in the mirror. When you add shaving cream to the surface of the mirror, the water droplets are no longer beads. They are a thin, smoothed out layer of water. Just like the surface of an old car that hasn't been waxed. Scientists would say that the shaving cream has changed the surface tension of the mirror. So there you have it. There's the answer. The secret to fogless mirrors is shaving cream. A little dab of science will do you. I'm Anissa Ramirez, and this was Science Underground.\"\n }\n];" }, "typeVersion": 1, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "45d3bad7-0e9a-426b-b4e9-b3568181d9dc", "name": "Code-ex3.1", "type": "n8n-nodes-base.code", "position": [ 1160, 1100 ], "parameters": { "jsCode": "var intext = $input.first().json;\n\nvar messages = [\n {\"role\": \"system\", \"content\": \"You are a helpful assistant. Write a Tl;dr of each user message\"},\n {\"role\": \"user\", \"content\": intext.text}\n];\n\nreturn {\"messages\":messages};" }, "typeVersion": 1, "notes": "This code node performs automated tasks as part of the workflow." }, { "id": "4db3de05-51a7-46ea-a818-508bdcb04582", "name": "ChatGPT-ex3.1", "type": "n8n-nodes-base.httpRequest", "position": [ 1340, 1100 ], "parameters": { "url": "{{ $env.API_BASE_URL }}", "method": "POST", "options": {}, "sendBody": true, "authentication": "{{ $credentials.predefinedCredentialType }}", "bodyParameters": { "parameters": [ { "name": "model", "value": "gpt-3.5-turbo" }, { "name": "temperature", "value": "={{ parseFloat(0.8) }}" }, { "name": "n", "value": "={{ Number(1) }}" }, { "name": "max_tokens", "value": "={{ Number(500) }}" }, { "name": "messages", "value": "={{ $json.messages }}" } ] }, "nodeCredentialType": "YOUR_CREDENTIAL_HERE" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 3, "notes": "This httpRequest node performs automated tasks as part of the workflow." }, { "id": "709fcd7c-deb3-469d-b16b-62d4d36d100d", "name": "ChatGPT-ex3.2", "type": "n8n-nodes-base.openAi", "position": [ 1880, 1100 ], "parameters": { "prompt": { "messages": [ { "role": "system", "content": "=You are now a DALLE-2 prompt generation tool that will generate a suitable prompt. Write a promt to create a cover image relevant to the user input. The image should be in a comic style of the 60-s." }, { "content": "={{ $json.choices[0].message.content }}" } ] }, "options": { "maxTokens": "YOUR_TOKEN_HERE", "temperature": 0.8 }, "resource": "chat" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "6b32cc45-5ba2-4605-b690-3929ec9acecf", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 900, -60 ], "parameters": { "width": 746.6347949130579, "height": 295.50954755505853, "content": "## The old way of using text completion and text edit\n### Davinci model is 10 times more expensive then ChatGPT, consider switching to the new API:\n{{ $env.API_BASE_URL }}\n" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "3cc74d77-7b02-40fd-83d8-f540d5ff34ab", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ -160, 260 ], "parameters": { "width": 428.4578974150008, "height": 316.6202633391793, "content": "## Whisper-1 example\n### Prepare your audio file and send it to whisper-1 transcription model" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "6ba8069a-485c-497c-8b27-4c7562fbccab", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 380, 280 ], "parameters": { "width": 421.9002034748082, "height": 302.4086532331564, "content": "## An example of transcribed text\n### Please pause this node when using real audio files" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "c71001e6-b80f-41dd-bcdd-10927014b374", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 900, 280 ], "parameters": { "width": 747.8556016477869, "height": 288.18470714667706, "content": "## ChatGPT example 1.1 and 1.2 \n### Write a Tl;dr of the text input\n### Translate it to German\n### only user content provided" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "4605be68-4c57-404f-8624-e095c8e86ff9", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 900, 620 ], "parameters": { "width": 742.9723747088658, "height": 288.18470714667706, "content": "## ChatGPT example 2 \n### Use system content to provide general instruction\n### Manual setup of system and user content" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "f5b72d7a-655a-4cc9-b722-b75429889d1d", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 900, 960 ], "parameters": { "width": 739.309954504675, "height": 288.18470714667706, "content": "## ChatGPT example 3.1\n### When using ChatGPT programmatically, create an array of system / user / assistant contents and append them one after another\n### Call ChatGPT API via HTTP Request node to provide all messages at once" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "a003a4db-1960-4867-8dfe-3114cf0742f3", "name": "DALLE-ex3.3", "type": "n8n-nodes-base.openAi", "position": [ 2060, 1100 ], "parameters": { "prompt": "={{ $json.message.content }}", "options": { "n": 4, "size": "512x512" }, "resource": "image" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "d71a01ff-4d47-4675-964c-c47820d3989b", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 1720, 960 ], "parameters": { "width": 611.1252473579985, "height": 284.52228694248623, "content": "## ChatGPT example 3.2 & DALLE-2 example 3.3\n### Use ChatGPT to create a prompt for a cover image of the Tl;dr message\n### Use OpenAI node to generate 4 images using the auto-generated prompt" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "f5a55cfe-c110-4833-9668-1f1ba895860f", "name": "ChatGPT-ex4", "type": "n8n-nodes-base.openAi", "position": [ 1240, 1420 ], "parameters": { "model": "gpt-3.5-turbo-0301", "prompt": { "messages": [ { "content": "={{ $json.prompt }}" } ] }, "options": { "maxTokens": "YOUR_TOKEN_HERE", "temperature": 0.5 }, "resource": "chat" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "8a9f7a20-187c-4494-8005-b10d066d04e2", "name": "Set-ex4", "type": "n8n-nodes-base.set", "position": [ 1060, 1420 ], "parameters": { "values": { "string": [ { "name": "model", "value": "code-davinci-002" }, { "name": "suffix", "value": "" }, { "name": "prompt", "value": "=Create an HTML code with and SVG tag that contains random shapes of various colors. Include triangles, lines, ellipses and other shapes" } ] }, "options": {}, "keepOnlySet": true }, "typeVersion": 1, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "68fcc6a2-761c-42ac-8778-313c8db7d53c", "name": "HTML-ex4", "type": "n8n-nodes-base.html", "position": [ 1420, 1420 ], "parameters": { "html": "{{$json.message.content }}" }, "typeVersion": 1, "notes": "This html node performs automated tasks as part of the workflow." }, { "id": "1f70cf3f-b6a9-4ea7-9486-c7565e6951b7", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ 900, 1300 ], "parameters": { "width": 739.309954504675, "height": 288.18470714667706, "content": "## ChatGPT example 4\n### Generate HTML code that contains SVG image" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "d857acd9-ea74-44d2-ac89-66b1fac4645f", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "position": [ 900, 1640 ], "parameters": { "width": 739.309954504675, "height": 288.18470714667706, "content": "## ChatGPT example 5\n### Provide several outputs. Useful for quick replies (i.e. in Gmail / Outlook)" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "fe64533a-4cd4-4adc-a48a-8abf3f2d61d7", "name": "ChatGPT-ex", "type": "n8n-nodes-base.openAi", "position": [ 1160, 1760 ], "parameters": { "model": "gpt-3.5-turbo-0301", "prompt": { "messages": [ { "role": "system", "content": "Act as an e-mail client. Provide a five to eight word answers to a given user messages." }, { "content": "Hi There! My name is Jack.\n\nI'm sending you an overview of my pricelist attached.\nCould you please reply to me within 3 days?\n\nBest regards and have a nice day,\nJack" } ] }, "options": { "n": 3, "maxTokens": "YOUR_TOKEN_HERE", "temperature": 0.8 }, "resource": "chat" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 1, "notes": "This openAi node performs automated tasks as part of the workflow." }, { "id": "6c9f8a70-99ae-4310-8e6a-26cc6f75b3a2", "name": "LoadMP3", "type": "n8n-nodes-base.readBinaryFiles", "disabled": true, "position": [ -80, 380 ], "parameters": { "fileSelector": "/home/node/.n8n/OpenAI-article/Using Science to Stop Your Mirror From Fogging Up.mp3" }, "typeVersion": 1, "notes": "This readBinaryFiles node performs automated tasks as part of the workflow." }, { "id": "0edc1996-6484-4e62-a47b-5666dfbb3546", "name": "Whisper-transcribe", "type": "n8n-nodes-base.httpRequest", "disabled": true, "position": [ 100, 380 ], "parameters": { "url": "{{ $env.API_BASE_URL }}", "method": "POST", "options": {}, "sendBody": true, "contentType": "multipart-form-data", "authentication": "{{ $credentials.predefinedCredentialType }}", "bodyParameters": { "parameters": [ { "name": "model", "value": "whisper-1" }, { "name": "file", "parameterType": "formBinaryData", "inputDataFieldName": "data" } ] }, "nodeCredentialType": "YOUR_CREDENTIAL_HERE" }, "credentials": { "openAiApi": { "id": "{{ $credentials.openAiApi.id }}", "name": "OpenAi account" } }, "typeVersion": 3, "notes": "This httpRequest node performs automated tasks as part of the workflow." }, { "id": "c12ba294-bdcd-4ece-8370-fa6a83a8ef0b", "name": "Sticky Note9", "type": "n8n-nodes-base.stickyNote", "position": [ -840, 260 ], "parameters": { "width": 596.9600747621192, "height": 320.63203364295396, "content": "## Do not run the whole workflow, it's rather slow\n### Better execute the last node of each branch or simply disconnect branches that are not needed" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." } ], "active": false, "pinData": {}, "settings": { "callerPolicy": "workflowsFromSameOwner", "saveManualExecutions": true, "saveDataSuccessExecution": "none", "executionOrder": "v1", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000 }, "versionId": "972cd971-9e7e-4a1d-b3fb-6f061e23e96f", "connections": { "4db3de05-51a7-46ea-a818-508bdcb04582": { "main": [ [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-2ff54ec3", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-30ccc5bd", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-ee34b8a3", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-b6352ab7", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-218ee4b1", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-305bd31e", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-874fb63f", "type": "main", "index": 0 } ], [ { "node": "error-handler-4db3de05-51a7-46ea-a818-508bdcb04582-d0028f1d", "type": "main", "index": 0 } ] ] }, "0edc1996-6484-4e62-a47b-5666dfbb3546": { "main": [ [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-bec900c0", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-a6a25182", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-4a6005c5", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-6de7df42", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-410de18d", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-fe68fb71", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-7412885c", "type": "main", "index": 0 } ], [ { "node": "error-handler-0edc1996-6484-4e62-a47b-5666dfbb3546-4b063019", "type": "main", "index": 0 } ] ] }, "b370da23-ead4-4221-b7fe-a9d943f7fbb9": { "main": [ [ { "node": "error-handler-b370da23-ead4-4221-b7fe-a9d943f7fbb9-1f011f79", "type": "main", "index": 0 } ] ] }, "5e04f355-36c0-4540-8e65-68118cb73135": { "main": [ [ { "node": "error-handler-5e04f355-36c0-4540-8e65-68118cb73135-2db9e525", "type": "main", "index": 0 } ] ] }, "16a7cf80-16e3-44f9-b15c-7501417fe38f": { "main": [ [ { "node": "error-handler-16a7cf80-16e3-44f9-b15c-7501417fe38f-99c5a784", "type": "main", "index": 0 } ] ] }, "95254870-65c3-4714-83fb-20ba2c0ca007": { "main": [ [ { "node": "error-handler-95254870-65c3-4714-83fb-20ba2c0ca007-ba829592", "type": "main", "index": 0 } ] ] }, "be9c4820-18b0-46fd-a5a0-51a5dc3ebed5": { "main": [ [ { "node": "error-handler-be9c4820-18b0-46fd-a5a0-51a5dc3ebed5-4326037a", "type": "main", "index": 0 } ] ] }, "709fcd7c-deb3-469d-b16b-62d4d36d100d": { "main": [ [ { "node": "error-handler-709fcd7c-deb3-469d-b16b-62d4d36d100d-fc7837f8", "type": "main", "index": 0 } ] ] }, "a003a4db-1960-4867-8dfe-3114cf0742f3": { "main": [ [ { "node": "error-handler-a003a4db-1960-4867-8dfe-3114cf0742f3-fdccda8b", "type": "main", "index": 0 } ] ] }, "f5a55cfe-c110-4833-9668-1f1ba895860f": { "main": [ [ { "node": "error-handler-f5a55cfe-c110-4833-9668-1f1ba895860f-6f41037d", "type": "main", "index": 0 } ] ] }, "fe64533a-4cd4-4adc-a48a-8abf3f2d61d7": { "main": [ [ { "node": "error-handler-fe64533a-4cd4-4adc-a48a-8abf3f2d61d7-4ee7d065", "type": "main", "index": 0 } ] ] }, "6c9f8a70-99ae-4310-8e6a-26cc6f75b3a2": { "main": [ [ { "node": "error-handler-6c9f8a70-99ae-4310-8e6a-26cc6f75b3a2-8dc855f2", "type": "main", "index": 0 } ] ] } }, "description": "Automated workflow: OpenAI-model-examples. This workflow integrates 9 different services: stickyNote, httpRequest, code, set, stopAndError. It contains 41 nodes and follows best practices for error handling and security.", "notes": "Excellent quality workflow: OpenAI-model-examples. This workflow has been optimized for production use with comprehensive error handling, security, and documentation." }