# What is the OpenAI API?

> The OpenAI API lets software like n8n use OpenAI's models with a secret key and pay-per-use billing. How it differs from ChatGPT and how to connect it.

Source: https://learn.ynteractive.com/content/glossary/openai-api · Updated 2026-10-01 · Free from Stepthrough (https://learn.ynteractive.com)

[AI assistants](https://learn.ynteractive.com/content/glossary#topic-ai-assistants) · [AI glossary](https://learn.ynteractive.com/content/glossary)

Updated October 1, 2026 · By [Robert Breen](https://learn.ynteractive.com/content/about)

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](https://learn.ynteractive.com/content/n8n-ai-agent-tutorial-google-sheets) 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](https://learn.ynteractive.com/content/ai-receipt-extractor-n8n-google-sheets) 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](https://learn.ynteractive.com/modules/n8n-ai-agent) or [read the step-by-step guide](https://learn.ynteractive.com/content/n8n-ai-agent-tutorial-google-sheets).

## Common confusions

### OpenAI API vs ChatGPT

[ChatGPT](https://learn.ynteractive.com/content/glossary/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](https://learn.ynteractive.com/content/glossary/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

[API](https://learn.ynteractive.com/content/glossary/api) · [API key](https://learn.ynteractive.com/content/glossary/api-key) · [Credential](https://learn.ynteractive.com/content/glossary/credential) · [API usage billing](https://learn.ynteractive.com/content/glossary/api-usage-billing) · [Chat model](https://learn.ynteractive.com/content/glossary/chat-model) · [AI model](https://learn.ynteractive.com/content/glossary/ai-model)

## Where you use it: free lessons

- [n8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets](https://learn.ynteractive.com/content/n8n-ai-agent-tutorial-google-sheets) (n8n, 12 min)
- [AI Receipt Extractor: Receipts to Google Sheets with n8n](https://learn.ynteractive.com/content/ai-receipt-extractor-n8n-google-sheets) (n8n, 12 min)
- [AI Email Responder: Draft Gmail Replies Automatically with n8n](https://learn.ynteractive.com/content/ai-email-responder-gmail-drafts-n8n) (n8n, 12 min)

## More free tutorials

[n8n tutorials](https://learn.ynteractive.com/content/tool/n8n)

## 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.

[All AI glossary terms, A to Z](https://learn.ynteractive.com/content/glossary) · [Free prompt templates](https://learn.ynteractive.com/content/prompts)
