Keep the API key in n8n's credential configuration, select that credential in the OpenAI node and test one small request with fictional data. This guide explains the setup, what to inspect in the result and how to tell an authentication problem from a rate limit or exhausted quota.

This guide covers bringing your own OpenAI API key to n8n. You need an n8n workspace where you can edit and manually run a test workflow, plus authorised OpenAI API access. API usage has separate billing from ChatGPT; a ChatGPT subscription does not establish that an API request has available credit. Your n8n plan and execution limits also apply.

If you want to practise without an AI request first, use the free Topic Intake Validator. It checks fictional input and requires no OpenAI credential. It does not generate an article.

Separate the credential from the request

A request contains the material you want the model to process. A credential supplies authentication. Keep the key out of prompts, Code nodes, sample JSON, URLs, screenshots and support conversations.

The official n8n credential guide documents API-key authentication. For an existing credential, confirm that it belongs to the intended environment and that you have permission to use it. Reuse that credential rather than distributing another copy of its secret.

For a new setup, the account owner should create or select the appropriate key in the official OpenAI platform, then enter it directly into n8n's OpenAI credential form and save it. Choose access appropriate to the intended request. Creating a key, changing its permissions and adding it to another service are account-security actions; this tutorial does not perform them for the reader. Never supply a secret in a chat or a tutorial file.

Follow the credential guide's conditions for an organisation ID; do not copy one from an unrelated example. Account context, project access, endpoint permissions and the selected model can affect which request succeeds. If a key has been exposed, editing a screenshot does not revoke it. The owner should revoke or rotate the exposed value and review its use.

Select the credential in a manual test workflow

  1. Create a separate test workflow with a Manual Trigger connected to the regular OpenAI node. Leave automatic triggers and downstream publishing actions out of this test.
  2. Open the OpenAI node and select the intended existing credential. Check the label and environment before executing; do not open the secret form while recording.
  3. Choose the text operation deliberately. The current n8n text-operation guide distinguishes Generate a Chat Completion from Generate a Model Response. Older workflows can show Message a Model. These labels and output structures are not interchangeable instructions.
  4. Select a model available to your project and compatible with that operation. Inspect the options offered by your installed node rather than copying an unrelated screenshot.

Use the regular OpenAI node for this isolated exercise. The OpenAI Chat Model sub-node used by chains or agents is a different component. Also inspect the whole path from the trigger: n8n's partial execution documentation explains that executing a step can run earlier nodes needed to produce its input.

OpenAI model node showing only a neutral credential label

Historical capture from 29 September 2026. It shows the existing neutral credential label and the operation used at that time. It does not show an API key or establish the labels in your installed version.

Prepare one small observable request

For this small connection check, choose Generate a Chat Completion, select a compatible non-reasoning model available to your project and use one completion. Enter this fictional user message: Reply with one sentence describing a weekly editorial checklist for a fictional small agency.

Set a supported output limit of 100 tokens in the operation's available options. The output limit bounds one part of the request; it is not a complete cost cap, and it does not include all input usage. Avoid tools, attachments, batches and automatic retries for this first check. Review the current model pricing and your account's available usage before running it.

For Generate a Model Response, inspect the Store option explicitly. n8n documents it as enabled by default for that operation. Disable it if you do not need stored responses, but do not describe that switch as zero retention. OpenAI's data controls documentation distinguishes application state from abuse-monitoring logs. n8n may separately retain execution data according to its workflow settings. Keep the prompt fictional either way.

When you are ready to permit a billable request, execute the manual test once. Inspect the OpenAI node's actual output. Expect a short textual sentence about an editorial checklist, not a particular exact phrase. Read the returned field structure before configuring the next node; a field from an older Chat Completion or simplified response example may not match the selected operation.

Record the date, n8n and node versions, operation, model, success or error, and usage if the result exposes it. If usage or cost is unavailable, record it as unknown. A successful request verifies that combination at that time; it does not validate throughput, every model or downstream publishing.

Diagnose the error before repeating the call

Start with the failed node, HTTP status and provider message. The OpenAI error guide distinguishes failures that can look similar in a workflow.

  • No credential selected: check the node's credential selection first. Changing the prompt will not supply authentication.
  • 401 or an invalid-key message: check that the intended credential is selected and that the key is still valid in the correct account context. Let the owner correct the credential directly; do not include its value in a report.
  • 429 with a rate-limit message: the request rate or token rate is too high. Slow down and use bounded backoff appropriate to the error. Repeated unsuccessful requests can also consume rate-limit capacity.
  • 429 with an insufficient-quota or billing message: review available credit, usage limits and the correct API project. Treat this separately from a temporary rate limit. Do not add unlimited retries or purchase credit automatically.
  • A model, permission or request-format error: inspect the exact message, selected operation, model availability and required parameters. Do not widen permissions by default or assume every such error is a bad key.
  • Timeout or interrupted connection: preserve the error and timestamp. If it is unclear whether the provider processed the request, mark the result unknown and investigate before another potentially billable call.

These are diagnostic categories, not provider failures deliberately reproduced for this guide. Never exhaust quota, revoke a working key or expose a secret to make a demonstration. A dashboard budget or alert should not be described as a guaranteed spending stop without verifying its actual behaviour.

Inspect the exported file before sharing

n8n's export documentation warns that workflow exports include credential names and IDs. HTTP Request nodes imported from cURL can also retain authentication headers. A clean canvas does not establish that its JSON is safe to distribute.

Review the whole export: credential references, headers, URLs, expressions, sample inputs and pinned data. Remove environment-specific credential references from a distributable template and use fictional examples. Inspect the file and all screenshot pixels before sharing; a pattern search alone cannot find every sensitive value.

On import, check credential selection again. In our live test on 29 September 2026, a sanitised JSON file contained no credential references, but n8n automatically selected a compatible existing OpenAI credential and displayed a notification. A clean file therefore does not guarantee an empty selector in the receiving workspace.

What the earlier demonstration established

Successful workflow using the selected OpenAI credential

Historical result from 29 September 2026: one gpt-4o-mini call through Message a Model generated a brief from fictional input, with an output limit of 700 tokens and Store disabled. That workflow's parser read output_text and its final validator returned brief_ready. No new key was created or entered for that test. These observations describe that workflow and date, rather than the field contract of every current OpenAI node.

A separate live run with an empty audience stopped at Validate topic before the OpenAI node. It verified the input boundary; it did not test an authentication or quota failure. The new one-sentence connection check above is a proposed exercise, not an additional recorded live result.

The earlier demonstration JSON is an internal review copy, not a public download. For a downloadable no-model starting point, use the Topic Intake Validator. Then continue with Build Your First AI Content Workflow in n8n to turn validated input into a reviewable brief. Keep publishing disconnected until the content and delivery have been approved.