What is the OpenAI API?
Updated · By Robert Breen
The OpenAI API is OpenAI's developer service that lets software, rather than a person in a chat window, send text or images to OpenAI's models and get answers back. Tools like n8n connect to it with a secret API key and pay per request.
Why it matters for a small business
As soon as you want AI inside a workflow (reading every new email, logging every receipt, answering every form), you need the API rather than ChatGPT. The workflow sends the request, gets the answer and hands it to the next step, with nobody copying and pasting in between.
It is a separate account with separate billing, which surprises people who already pay for ChatGPT. Cost depends on the model and on how much text goes in and out, so choosing a small model for simple jobs keeps spending predictable. The key itself can spend money, so it needs the care you'd give a password.
In a real lesson: n8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets
The n8n AI agent lesson sets up the API before building anything. On platform.openai.com you go to Billing and click Add to credit balance (a key with no credit behind it just returns errors), then API Keys and + Create new secret key, named n8n agent after what will use it. You click Copy straight away, because OpenAI shows the key only once.
Back in n8n, the AI Agent node shows a red warning until it has a model. You click the + under Chat Model, choose OpenAI Chat Model, open Credential to connect with, pick + Create new credential, paste the key and click Save. n8n tests the connection and keeps the credential for later workflows; the receipt extractor simply picks OpenAI account from the list.
Then you choose the model. BrightPath Marketing's idea agent runs on gpt-5-mini, which the lesson calls fast and cheap, while the receipt extractor switches to gpt-4o because it has to read a photo.

Try this lesson free or read the step-by-step guide.
Common confusions
OpenAI API vs ChatGPT
ChatGPT is the app for people. The API is for software. They are billed separately, and a ChatGPT subscription doesn't include API usage.
API key vs n8n credential
The API key is the secret string OpenAI gives you. The n8n credential is where n8n stores it, so every node can use it without you pasting it again.
Tips
- Name each key after what uses it, so you know which one to revoke if something goes wrong.
- Never paste a key into a chat, a shared doc or a screen recording.
- Start with a small model and move up only when the output isn't good enough.
- Check usage on platform.openai.com after your first week of real runs.
Related terms
Where you use it: free lessons
- n8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets (n8n, 12 min)
- AI Receipt Extractor: Receipts to Google Sheets with n8n (n8n, 12 min)
- AI Email Responder: Draft Gmail Replies Automatically with n8n (n8n, 12 min)
More free tutorials
Frequently asked questions
- Do I need the OpenAI API if I already pay for ChatGPT?
- Yes, if you want n8n or another tool to use OpenAI's models. The API is a separate account at platform.openai.com with its own billing.
- What should I do if my OpenAI API key leaks?
- Revoke the key on platform.openai.com right away, create a new one, and update the credential in n8n. Until it is revoked, anyone with the key can run requests you pay for.