Automating Your AI Workflows with OpenAI and n8n

Instead of copying and pasting between ChatGPT and your other apps, you can use no-code tools to automate your AI workflows. In this guide, we'll show you how to automate OpenAI prompts with n8n.

Written by
Matt Jasinski
and

June 9, 2025

Tired of copying and pasting between ChatGPT and your actual work? There's a much better way to use AI at your business. 

Instead of manual back-and-forth conversations, you can build automated AI workflows that run in the background while you focus on what matters.

In this guide, we'll show you how to connect OpenAI directly to your workflows using n8n, a fair-code automation provider.

You'll learn how to set up custom AI prompts that trigger automatically, and we'll walk through a real example where we automatically transcribe audio files without any manual work.

Connect OpenAI to n8n

The first thing you'll need to do is authorize n8n to access your OpenAI account.

You don't need any kind of ChatGPT subscription to build automations like these. Instead, you'll use your OpenAI developer account to make requests directly to the API, and you'll be billed a small amount for each request.

You can go to platform.openai.com to create an account if you don't have one already. Then, go to Settings > Billing to add your payment info and buy credits. 

Billing settings in the OpenAI developer platform

To follow along with this tutorial, you won't need many credits at all. Each request will only cost a few cents each at the most. You can see more details on OpenAI's pricing page for exact costs.

Create a new credential in n8n

Once your OpenAI developer platform account is set up, log in to n8n to create a new credential.

From your overview page, click on the arrow next to "Create workflow" in the top right, and select "Create credential".

Creating a new credential in n8n

Search for OpenAI and select it from the list.

Searching for OpenAI in n8n

To complete the credential, you just need an API key from your OpenAI account. 

Create an API key in OpenAI

To get your API key, click on Settings (gear icon) in your OpenAI account and choose "API keys".

API keys in the OpenAI developer platform

Create a new secret key. Give your key a descriptive name, and pick a project for it to belong to. 

Creating a new secret key in OpenAI

Save your key and copy it. NOTE: this will be your only chance to copy the key. OpenAI will not reveal the key to you again. 

Copying a secret key in OpenAI

Enter your OpenAI key in n8n

Go back to n8n and paste your key into the appropriate field. 

Pasting the key into n8n

Click "Save". This will test and save the new credential, which you can now use in any OpenAI step in n8n.

Setting up your trigger

Now, let's use this OpenAI credential to build an automated AI workflow. If you're brand new to n8n, you can check out our beginner's guide to learn the basics.

However, the workflow we're building today is very simple, and you can follow along even if you haven't used n8n much before.

You can start your automation however you'd like, using any trigger and any app you want. Just make sure to pick a trigger that will gather any data you want to send as part of your AI prompt. You can also add search steps after the trigger to find more info if you need to.

Our example: transcribing & summarizing audio files from Airtable

For this example, we'll use Airtable as the trigger app. We're building a workflow that runs whenever there's a new record added to an "Audio Transcripts" table. 

An Airtable record with an attached audio file

Then, it will send the attached audio file to OpenAI for transcription and summary. 

You can see the configuration of our Airtable trigger in the base below. If you’re following along with Airtable as well, you’ll need to pick your own base and table. Also, be sure your base includes a field that displays when each record was created or last modified. 

An Airtable trigger in an n8n workflow

Important configuration note: When setting up your Airtable trigger, make sure to enable "Download Attachments" and specify the field name that you want to download from.

In our example, our Airtable attachment field is called “Audio file”, so that’s the name we’ve entered into “Download fields”. 

These settings ensure that n8n makes a copy of the actual attached file. Otherwise, it would only retrieve the file name and metadata, which you wouldn't be able to use to create a transcription.

Test your trigger

Once your trigger is configured, test it to pull in some data by clicking on “Fetch Test Event”. 

An audio file retrieved from Airtable in n8n

You can view the downloaded file under the "Binary" tab, and all of the other data retrieved in the Schema, Table, and JSON tabs.

An Airtable record retrieved by n8n

Automatic audio transcription with OpenAI

Now, let's add an OpenAI step to the workflow. You can select either "Action in an app" or "AI" to find OpenAI.

Adding an AI action to an n8n workflow

Then pick the specific action you want to perform. There are several options available, including creating or messaging an assistant, analyzing an image, generating an image, and more.

If you just want to send a straightforward prompt to an OpenAI model, you can use "Message a model" (which we'll cover later).

But first, let's transcribe the recording we retrieved from Airtable. That's under “Audio actions”.

Selecting the "Transcribe a recording" action

Configure the automatic transcription 

Setting up audio transcription is straightforward:

• Choose your OpenAI account as the credential

• The "Resource" and "Operation" fields should already be set to what you need – 'Audio' and 'Transcribe a recording'

• Provide the "Input Data Field Name" - this is the name of the field that contains the audio file you want to transcribe

Configuring the automatic audio transcription

You can find the correct name in the Binary tab in the "Input" window on the left. In our example, the file's called ‘Audio file_0’, so that’s what we’ve entered into the field. Every file that the automation processes should use this same name.

Test the transcription step

With this simple configuration set, you click on “Execute step” to send the prompt and audio file to OpenAI. Before you do, be aware that this will actually send your request to OpenAI's API and consume some credits accordingly. 

However, we're talking about a charge of about $0.006 per minute of transcription with the Whisper model; this won't break the bank unless you're transcribing hours and hours of material.

After execution, it takes just a few seconds for the AI to transcribe the audio clip. It returns one data point - a "text" variable containing the entire transcription.

The AI-generated transcript in n8n

Need Help With AI Workflows?

XRay specializes in creating custom AI automation solutions with OpenAI, n8n, Zapier, and dozens of other platforms. 

We've helped businesses of all sizes build powerful tools that save thousands of hours of manual work, reduce errors, and turn scattered AI prompts into scalable workflows.

Book a free 15-minute consultation call to get started. We'll discuss your specific challenges and determine your best options for automating and optimizing your company's processes.

Send custom prompts to OpenAI with n8n

Next let’s explore using n8n to send a custom prompt to OpenAI. Add an OpenAI step to your n8n workflow and choose “Message a model” as the action. This will let you write any prompt you want with your own custom settings. 

Selecting the "message a model" action

Pick your OpenAI account again as the credential. The correct resource and operation should already be selected by default. 

The default settings for a custom OpenAI prompt

All that remains is to pick the model you want to use, compose a prompt, and configure optional settings. 

You have access to any OpenAI model here. You can check out their pricing page for details, but generally, the best and newest models will be more expensive than the older and slower ones. That said, any one prompt will likely cost you a few cents per execution (at the most). 

Selecting a model in the OpenAI prompt

For this example, we'll use the latest 4o model with a simple prompt: "Summarize this transcript in one to two sentences." 

Drafting an OpenAI prompt in n8n

We'll also include the "text" variable from the previous step in the prompt window, so OpenAI will see the correct transcript with each incoming prompt.

Inserting variables into the prompt

You can use the "Options" sections to tweak precise settings like the output randomness or presence penalty, but the default settings work well for most use cases. 

Once your prompt is configured, execute the step and wait a few seconds for the AI's response. The summary will appear in the "Content" variable.

An AI-generated summary in n8n

Send the AI responses to another app

To complete this automation, you’ll likely want to send the AI’s output to another app where you can view and store it. 

You can send your AI-generated wherever you'd like. For instance, you could add a Gmail step to send it in an email, add a Slack step to send it in a channel message, or add another Airtable step to update the original record. Any app supported by n8n will work.

For our example, we’ll update the Airtable record so we can view the AI-generated content without ever leaving Airtable. 

Here’s how to update an Airtable record with n8n:

Add an Airtable step and choose "Update record" as the action.

Updating an Airtable record in n8n

Pick the base and table you want to use. Then, under the "values to update" section, provide the data you want to add to the record. 

Enter the ID of the record retrieved in the trigger so n8n can find the correct record to update.

Matching Airtable records via ID

Insert the AI responses from both steps into appropriate fields. For the transcription, the variable is called “text”. For the custom prompt, the response is called “content.”

Configuring the 'update record' action

After testing this step, you can verify in Airtable that the record has been updated with the AI responses. 

AI-generated summary and transcript automatically updated in Airtable

Once everything looks good, save and activate the automation in n8n. It will now check Airtable for new records every minute, and when it finds one, it will send the attached recording to OpenAI for transcription and summary exactly as configured.

Creating scalable AI workflows

Your AI workflows can now run automatically, whether you're transcribing audio, analyzing data, or handling any other repetitive tasks.

This type of automation represents the future of AI integration - moving beyond manual ChatGPT conversations to automated, scalable workflows that handle repetitive tasks while you focus on higher-value work. The possibilities are endless when you connect AI directly to your existing business processes.

Ready to take your AI automation to the next level? Schedule a free consultation to explore how XRay can help you build custom solutions tailored to your specific business needs.

By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.