How to get an OpenAI (ChatGPT) API key for n8n

Last updated: June 10, 2026 ~5 min n8n setup guide

If an n8n automation we built (or one of our templates) uses OpenAI / ChatGPT for its AI steps, you'll need your own OpenAI API key to connect it. This walkthrough takes you from zero to a working key pasted into n8n in about five minutes.

Important up front: the OpenAI API is separate from a ChatGPT Plus subscription. Paying for ChatGPT does not give you API access — you set up API billing separately, and it's pay-as-you-go (you only pay for what your automation uses).

Video walkthrough coming soon — watch on YouTube
The short version
  1. Create an account at platform.openai.com
  2. Add a payment method or credits under Billing
  3. Go to API keysCreate new secret key, then copy it (shown once)
  4. In n8n, add an OpenAI credential and paste the key

1. Create your OpenAI Platform account

Go to platform.openai.com and sign up (or log in). This is the developer platform — a different place from chatgpt.com. If you already use ChatGPT, you can sign in with the same account, but you'll still set up API access and billing here.

2. Add billing (a payment method or credits)

Open Settings → Billing and add a payment method, or buy a small batch of prepaid credits ($5 is plenty to test an automation). Without billing set up, your key will authenticate but every request fails with an insufficient_quota error — this is the single most common snag.

Cost is per token (input + output) and depends on the model. For current rates, see OpenAI's API pricing page — most lead-gen and admin automations cost cents per run.

3. Create the API key

Go to API keys (under Settings, or via your profile menu) and click Create new secret key. Give it a recognizable name — e.g. n8n-production. If you're asked to pick a project, the Default project is fine.

OpenAI shows you the full key exactly once. It starts with sk- (newer project keys start with sk-proj-). Copy it immediately and store it somewhere safe — a password manager. If you close the dialog without copying, you'll have to delete it and create a new one.

Treat the key like a password. Anyone with it can spend on your account. Never paste it into a chat, email, or screenshot. To send it to us, use the secure method we agreed on (a password-manager share link or our secure form) — not a plain message.

4. Connect the key to n8n

In n8n, the key goes on an OpenAI credential, which the AI nodes then reuse:

  1. Open your workflow and click the OpenAI Chat Model node (it sits under an AI Agent node) — or add an OpenAI node.
  2. In the node's Credential dropdown, choose Create New Credential.
  3. Paste your key (sk-…) into the API Key field and save.
  4. Back on the node, pick a model from the dropdown (the model is set here, not on the credential).
  5. Click Execute / Test step — if it returns a response, you're connected.

That's it — every OpenAI step in the workflow now uses your key and your account's billing.

Official reference

OpenAI's dashboard changes from time to time. If a screen looks different from this guide, their own docs are the source of truth: the OpenAI Platform — API keys and OpenAI API docs. For the n8n side, see n8n's OpenAI credential docs.

FAQ

Does my ChatGPT Plus subscription include API access?

No — the API is billed separately. Set up API billing on platform.openai.com and pay per token, independent of any ChatGPT subscription.

I get insufficient_quota / "exceeded your current quota."

No usable credit or billing is set up. Add a payment method or prepaid credits under Settings → Billing. A valid key with no billing authenticates but fails on quota.

I lost my key. Where do I find it again?

You can't — OpenAI shows the full secret key only once. Delete the old one under API keys and create a new key.

Want us to set it up for you?

We build AI lead-gen and CRM automations in n8n — and handle the wiring, keys, and billing so you don't have to.

Book a Free Strategy Call

← Back to all guides