Easy Tech Tuts
n8n

How to Create OpenAI API Key & Connect With n8n Easily 2026

By Impran M N

Adding AI capabilities to your n8n workflows starts with generating an API key from OpenAI and linking it through n8n's credential manager. This guide covers creating that key, pasting it into n8n, and running a quick test to confirm the connection works.

01Add an OpenAI or AI Agent node

Place the relevant AI node onto your workflow canvas where you want to use a language model.

02Create a credential profile

Start a new credential entry inside n8n to hold your OpenAI authentication details.

03Generate a secret key

Go to the OpenAI developer platform and create a new secret API key under your account.

04Paste the key into n8n

Copy the generated key back into your n8n credential and save it.

05Select a model and test

Choose your target model, then run a test prompt to confirm the connection is working.

FAQ

Frequently asked questions

Where do I generate an OpenAI API key?

You create it from the API keys section of the OpenAI developer platform dashboard.

Is my OpenAI API key stored securely in n8n?

It's stored inside n8n's credential manager, which is designed to keep authentication details separate from your workflow logic.

Can I use different OpenAI models in the same workflow?

Yes, you can select different models depending on the node and use case within your workflow.

What happens if my API key stops working?

Check whether the key was revoked or your usage limits were reached, then generate a new key if needed.

Watch the full walkthrough

The same steps, demonstrated on screen from start to finish.