The 'ChatGPT API' is the OpenAI API: billed per token from prepaid credits, separately from ChatGPT plans. OpenAI's featured models are GPT-6 Astra ($10 input and $50 output per million tokens), GPT-6.1 Sol ($2 and $10) and GPT-6 Luna ($0.10 and $0.50). Call them through the Responses API from server-side code or n8n's OpenAI node, ask for structured JSON, and cut costs with the smallest model that works, prompt caching and the Batch API's 50% discount.
ChatGPT API workflows are automations that call OpenAI's models through the API, usually the Responses API, from a workflow tool such as n8n or from your own server code. You pay per token from prepaid credits, separately from any ChatGPT plan, and for most workflow jobs the smallest model is enough.
Prices and API behaviour were re-read on 14 October 2026 on OpenAI's models, pricing, rate limits, prompt caching, data controls and deprecations pages, its ChatGPT pricing page, and n8n's OpenAI node docs. The cost figures below are worked examples with stated assumptions, not measured bills. An older version of this page quoted GPT-4 Turbo prices and "unlimited" claims; they are gone.
- 01Trigger
A new email, form entry, row or schedule.
- 02Prepare
Pick only the fields the model needs. Strip IDs and secrets.
- 03Responses API call
Instructions first, data last, a JSON schema for the answer.
- 04Validate
Check the status and the parsed fields before using them.
- 05Act
Route, write to a CRM, or queue a draft for a person.
- 06Log usage
Input, output and reasoning tokens, per run.
ChatGPT plans vs the OpenAI API
They are two products. A ChatGPT plan pays for the app a person types into; the API is what a workflow calls. OpenAI's ChatGPT pricing page says API token prices "are separate from subscription usage".
| ChatGPT plans | OpenAI API | |
|---|---|---|
| What it is | The ChatGPT app for a person to chat with | A developer platform your code or workflow tool calls |
| Price | Free, Go $8, Plus $20 a month, Pro from $100 a month | Pay per token from prepaid credits |
| Automation | Manual use in the app | Any app, script or workflow can call it |
| Limits | Plan message and feature limits | Per-minute rate limits and a monthly usage limit, by usage tier |
A Plus plan gives you no API credits, and the API is not a cheaper way to chat: it is the way to put a model inside a workflow. Getting an OpenAI API key covers account setup, the $5 minimum credit purchase and spend limits.
Current models and prices
OpenAI's models page features three models, all with a 1.05 million token context window and up to 128,000 output tokens. Standard prices per million tokens from the pricing page:
| Model | Input | Cached input | Output | Use it for |
|---|---|---|---|---|
| gpt-6-astra | $10.00 | $1.00 | $50.00 | Hardest reasoning, long documents, final-quality writing |
| gpt-6.1-sol | $2.00 | $0.10 | $10.00 | Most drafting, analysis and agent steps |
| gpt-6-luna | $0.10 | $0.01 | $0.50 | Classification, extraction, routing, high volume |
- These rates apply to prompts up to 272K input tokens. Above that, the whole request costs 2x on input and cache rates and 1.5x on output.
- Reasoning tokens are billed as output. OpenAI's reasoning guide says a model may use anywhere from a few hundred to tens of thousands of them, so a bill can exceed what the visible answer suggests.
- Batch and Flex processing cost 50% of standard; Fast mode costs 2x.
- Writing a prompt to the cache costs 1.25x the input rate; later reads use the cached-input column.
Source: OpenAI API pricing page, read 14 October 2026. Prompts up to 272K input tokens.
What a workflow actually costs
Cost is input tokens times the input price plus output tokens, reasoning included, times the output price, per million. A token is roughly four characters of English. Three worked examples at standard rates, with made-up volumes:
| Workflow | Assumptions | Monthly cost |
|---|---|---|
| Classify support emails with GPT-6 Luna | 10,000 emails, 600 input and 60 output tokens each, reasoning set to none | $0.60 input + $0.30 output = $0.90 |
| Draft replies with GPT-6.1 Sol | 2,000 emails, 1,500 input and 400 visible output tokens each | $6.00 + $8.00 = $14.00, plus $20.00 for every extra 1,000 reasoning tokens per email |
| Monthly client reports with GPT-6 Astra | 100 reports, 20,000 input and 3,000 output tokens each | $20.00 + $15.00 = $35.00, before reasoning tokens |
The pattern: routing and extraction on a small model cost very little, while long, reasoning-heavy outputs on the flagship add up. Measure real usage from the usage object in each response, not from estimates. To compare these rates with Claude, Gemini and others, see LLM API pricing compared, and to decide whether the workflow pays for itself, workflow automation ROI.
Build API workflows in n8n
n8n's OpenAI node covers most workflow jobs without code. Five steps get a first one running.
- 1Create a restricted project key
On the OpenAI platform, then add it to an OpenAI credential in n8n. Leave Organization ID blank unless you belong to several.
- 2Add the OpenAI node
Text resource, Generate a Model Response. It uses the Responses API and arrived in n8n 1.117.0.
- 3Set the messages
A System message with your rules, a User message with data from earlier nodes.
- 4Set the options
Output Format as JSON Schema, a Maximum Number of Tokens, a Reasoning level, and Store off if you never fetch responses later.
- 5Use the output
Route with a Switch node, write to your CRM, or send a draft for approval.
The older Generate a Chat Completion operation still exists and uses Chat Completions (text operations docs). Store defaults to on. For agents that pick their own tools, connect the OpenAI Chat Model sub-node to an AI Agent node and turn on Use Responses API; AI agent automation covers that pattern and its guardrails. For endpoints the node does not cover, such as the Batch API, use the HTTP Request node with the OpenAI credential as a predefined credential type. Connecting OpenAI to n8n goes deeper on the node itself.
Or call the API from your own code
Keep the key on a server, in the OPENAI_API_KEY environment variable, never in browser or mobile code. This Python example follows OpenAI's Structured Outputs guide and returns validated fields instead of free text.
from typing import Literal
from openai import OpenAI
from pydantic import BaseModel
client = OpenAI() # reads OPENAI_API_KEY from the environment
class Triage(BaseModel):
category: Literal["billing", "technical", "account", "other"]
urgency: Literal["low", "normal", "high"]
summary: str
email = "Hi, I was charged twice for my October invoice. Can you fix it?"
response = client.responses.parse(
model="gpt-6-luna",
reasoning={"effort": "none"}, # simple classification needs no reasoning tokens
max_output_tokens=200,
input=[
{"role": "system", "content": "Classify the customer email and summarize it in one sentence."},
{"role": "user", "content": email},
],
text_format=Triage,
)
print(response.output_parsed)In Node.js, the openai package offers the same client.responses.parse() with a Zod schema. Pass untrusted text, like the email above, as a user message rather than inside your instructions. I have not run this snippet for the article; run it on a test email first.
Five workflows worth building
Each of these keeps a person on the step that cannot be undone. Start with the first: it is cheap, frequent and easy to check.
- Support triage. Classify incoming email with GPT-6 Luna, look up the order, draft a reply with GPT-6.1 Sol, and send it only after a person approves.
- Lead qualification. Combine a form submission with your notes on the company, score it against a fixed rubric returned as JSON, and route strong fits to sales.
- Document extraction. The Responses API accepts PDF input, so invoices, contracts or applications can become structured fields, with low-confidence results sent for review.
- Content repurposing. Turn a published article into platform-specific drafts that follow your style rules, and queue them for editing rather than auto-posting.
- Report narratives. Pull numbers with a SQL query, then have the model write the summary; n8n database automation shows the reporting half.
Keep costs and failures down
Most savings come from four habits, and none of them needs a cleverer prompt.
- Use the smallest model that passes your test set, and escalate only the hard cases
- Set max_output_tokens and a low reasoning effort for simple tasks
- Put instructions, examples and schemas first and changing data last, so the prefix caches
- Send work that can wait to the Batch API at half price
- On a 429, follow Retry-After, slow down, then ramp up gradually
- Set a hard monthly spend limit on the project
- Log input, output and reasoning tokens for every run
- Caching. Prompt caching is on by default for supported models. For GPT-5.6 and later, prefixes of at least 1,024 tokens can be cached, and reads cost 0.1x the input rate, or 0.05x on GPT-6.1 Sol.
- Batch. The Batch API is 50% cheaper and returns results within 24 hours.
- Capped output. If a response hits
max_output_tokens, its status isincomplete, and you can pay for input and reasoning tokens with no visible answer. - Rate limits. The usage tiers are Free, Build, Launch and Grow, and rise automatically with total credit purchases. At Build ($5 purchased, $500 a month), the Astra and Sol models allow 5,000 requests and 1 million tokens a minute, and Luna 2 million tokens.
Data and security basics
OpenAI's data controls page says data sent to the API "is not used to train or improve OpenAI models" unless you opt in, and abuse-monitoring logs are kept for up to 30 days by default. That still leaves you responsible for what you send.
- Send only the fields the task needs; strip IDs, card numbers and secrets before they reach a prompt.
- Use one restricted key per workflow or client, so you can revoke one without breaking the rest.
- Treat text from strangers as data. It goes in the user message and never changes what the workflow is allowed to do.
Troubleshooting
Most failures are one of five, and only two of them are fixed by retrying.
| Symptom | Cause | Fix |
|---|---|---|
| 401 | The key was rejected | Check the key and the project it belongs to |
| 429 rate limit | Too many requests or tokens a minute | Follow Retry-After, slow down, then ramp up again |
| 429 quota | Out of credit, or over a spend or tier limit | Retrying will not help. Add credit or raise the limit |
| Status incomplete | The response hit max_output_tokens | Raise the cap or lower reasoning effort |
| Assistants API errors | OpenAI removed that API on 26 August 2026 | Move the code to the Responses API |
For output that is not valid JSON, use Structured Outputs with a strict schema (in n8n, Output Format: JSON Schema) instead of asking for JSON in the prompt. Tutorials built on older model names will stop working, not just lag: OpenAI's deprecations page (checked 15 Oct 2026) shows gpt-4-turbo-preview shut down on 26 March 2026, and gpt-3.5-turbo, gpt-4 and gpt-4-turbo shut down on 23 October 2026. Swap the model ID for gpt-6-luna or gpt-6.1-sol from the model price table earlier in this post and re-test. One more date from the same page: OpenAI's Agent Builder shuts down on 30 November 2026.
Next steps
Start with one high-volume, low-risk task such as classification, and measure cost and accuracy on a week of real data before adding drafting or agents. If you are choosing between providers, Claude vs ChatGPT compares the two. If you want to build a product on an AI API rather than automate tools, AI SaaS Builder, one of our programs, uses the Claude API and covers prompting, tool use, structured output, caching and production hardening, with Supabase, Next.js and Stripe billing.
ChatGPT API workflows FAQ
Is the ChatGPT API the same as ChatGPT Plus?
No. ChatGPT Plus is a $20 a month subscription for the ChatGPT app. The API is OpenAI's developer platform, billed per token from prepaid credits through a separate account and key. OpenAI's ChatGPT pricing page says API token prices are separate from subscription usage, so a Plus plan gives you no API credit.
How much does the ChatGPT API cost?
It depends on the model and the tokens you send and receive. On 14 October 2026, standard prices per million tokens were $10 input and $50 output for GPT-6 Astra, $2 and $10 for GPT-6.1 Sol, and $0.10 and $0.50 for GPT-6 Luna, for prompts up to 272K input tokens. Reasoning tokens are billed as output, so count them too.
Which OpenAI model should I use for automation?
Use GPT-6 Luna for high-volume classification, extraction and routing, GPT-6.1 Sol for most drafting and analysis, and GPT-6 Astra only for the hardest reasoning or long-document work. OpenAI describes Luna as its most efficient model for focused, high-volume tasks. Test each on real examples before you commit to one.
Is the OpenAI API unlimited?
No. Every organization has rate limits in requests and tokens per minute that rise with its usage tier, and a monthly usage limit per tier. The tiers are Free, Build, Launch and Grow. At Build, reached after $5 in credit purchases, the monthly limit is $500 and the Astra and Sol models allow 5,000 requests and 1 million tokens a minute.
How do I use the OpenAI API in n8n?
Add an OpenAI credential with your API key, then use the OpenAI node's Text resource with the Generate a Model Response operation, which uses the Responses API and was added in n8n 1.117.0. For agents, connect the OpenAI Chat Model sub-node to an AI Agent node and turn on Use Responses API.
Does OpenAI train on my API data?
Not by default. OpenAI's data controls page says data sent to the API is not used to train or improve its models unless you explicitly opt in. Abuse-monitoring logs are kept for up to 30 days by default, with exceptions for legal requirements. Send only the fields a task needs either way.