Automation tools are great at moving data from A to B. But they struggle when the task needs judgement, interpretation, or creativity — the kind of thing humans do naturally. That's where the ChatGPT API changes everything.

Connect it to n8n and your automations stop being simple "if this then that" pipelines. They become systems that can read an email, understand what it means, and draft a response — all without a human in the loop.

If you're already running n8n, you're minutes away from adding AI capabilities. This guide covers practical setups we've deployed for clients, the cost implications, and the gotchas you'll hit along the way.

Why the ChatGPT API, Not the Chat Interface

The web chat is great for one-off questions. The API is built for automation. Here's what you get with the API that you can't do in the chat:

If you're already experimenting with AI agents for your business, the ChatGPT API is the engine that makes them capable beyond simple keyword matching.

Setting Up the API in n8n

You need two things: an OpenAI API key, and the n8n HTTP Request node. No special plugin required.

Step 1: Get Your API Key

Head to platform.openai.com/api-keys, create a new secret key, and store it in n8n as a credential. Use n8n's built-in OpenAI credential type if available, otherwise store it as a header in your HTTP Request node: Authorization: Bearer sk-....

Step 2: Build the API Call in n8n

The HTTP Request node makes a POST to https://api.openai.com/v1/chat/completions with this JSON body:

{
  "model": "gpt-4o-mini",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "{{ $json.input }}"}
  ],
  "temperature": 0.7,
  "max_tokens": 1000
}

The system message sets the behaviour. The user message is where you inject your dynamic content using n8n expressions. The response comes back as JSON — extract choices[0].message.content to get the generated text.

Step 3: Process the Response

. From there, you can feed it into any other n8n node — email, Notion, Slack, whatever your workflow needs.$.choices[0].message.content. From there, you can feed it into any other n8n node — email, Notion, Slack, whatever your workflow needs.

For a deeper dive into how n8n handles HTTP calls and webhooks, check our webhooks explained guide — the same patterns apply here.

1. Automated Email Response Drafting

Here are real automations we've built for clients, from simple to advanced. Each one uses the same core pattern: trigger → build prompt → call API → use response.

1. Automated Email Response Drafting

A support inbox gets 50-100 emails a day. Instead of having a human draft every reply, this workflow reads each new email, summarises the issue, and drafts a response — with the human just reviewing and hitting send.

The workflow: Gmail trigger picks up new emails → ChatGPT API generates a response based on the email body and your company's support guidelines → the draft is written to a Google Doc for human review → a Slack notification alerts the team.

One client went from 4-hour response times to under 30 minutes using this setup. The key was a well-crafted system prompt that matched their brand voice and escalation rules.

2. Content Brief Generation from Competitor URLs

Content teams need briefs. This workflow takes a competitor's blog post URL, scrapes the content, and uses ChatGPT to generate a content brief for your own version — including angle, outline, key points to cover, and SEO gaps.

The workflow: A Google Sheet row with a URL → n8n fetches the page content (or you pipe it through a summariser) → ChatGPT API analyses the content and generates a structured brief → the brief is written back to the Sheet in new columns.

If you're running a content engine, this pairs well with an AI content workflow — generate briefs at scale, then hand them off to writers or an automated drafting pipeline.

3. Lead Enrichment from Free-Form Text

Your lead form has a "tell us about your project" field. It's free text — unstructured, full of context, hard to parse. ChatGPT can extract structured data from it.

The workflow: Typeform or Webflow form submission → ChatGPT API receives the free-text field plus a system prompt that says "extract: company size, budget range, timeline, pain points. Return as JSON" → n8n parses the JSON response → a new entry is created in your CRM with structured fields.

This replaced a system that required 3 follow-up emails just to qualify a lead. Now it happens in seconds. Combined with automated client onboarding, the entire pipeline from lead to active client runs without a single manual data entry.

4. Multi-Language Customer Support Translation

If your customer base spans multiple languages but your support team only covers English, the ChatGPT API can act as a real-time translator with context awareness.

The workflow: An incoming support ticket in Spanish → ChatGPT translates it to English while preserving technical terms and urgency → support agent responds in English → ChatGPT translates the response back to Spanish → the reply is sent to the customer.

The critical detail: use a system prompt that preserves formatting, code snippets, and product names. Basic machine translation services strip context. GPT-4o preserves it.

5. Automated SEO Meta Tag Generation

If you publish frequently, writing meta titles and descriptions for every page becomes a bottleneck. This workflow generates them automatically from the page content.

The workflow: A webhook fires when a new page is published → n8n receives the page URL and content → ChatGPT API generates: 3 title options, a meta description (under 160 chars), and 5 suggested focus keywords → the output is written to a CMS field or a Google Sheet for review.

We've tuned this one extensively. The trick is constraining the output — use max_tokens: 200 and a system prompt that says "respond with JSON only, no explanations."

⚡ Key Takeaways

Cost Considerations

GPT-4o-mini costs roughly $0.15 per 1M input tokens and $0.60 per 1M output tokens. For most automation use cases — email drafting, basic enrichment, short translations — you're looking at pennies per hundred runs. Even with hundreds of daily executions, most clients spend less than $50/month on API costs.

GPT-4o (the full model) is about 15x more expensive. Reserve it for tasks that genuinely need deep reasoning — complex data analysis, legal document review, nuanced content creation. Use GPT-4o-mini for everything else.

For context on what n8n + AI costs overall (hosting, setup, maintenance), see our n8n vs Zapier cost comparison — the API costs are tiny compared to what you save by not running a fully manual operation.

Common Gotchas

We've made every mistake in this list so you don't have to:

When Not to Use the ChatGPT API

Not every automation needs AI. If you're moving a field from one app to another — name, email, phone number — a simple HTTP request does it cheaper and faster. The ChatGPT API adds value when the task requires understanding or generation. Classification, extraction, summarisation, drafting. If a regex or a lookup table solves the problem, use that instead.

Start with the minimal AI that does the job. Add complexity only when you've validated the workflow works. Most of the automations we build start with GPT-4o-mini and never need to upgrade.

Ready to add AI to your automation stack? We build n8n + ChatGPT API pipelines for clients every week — get in touch if you want it done without the trial and error.