The 'ChatGPT API' is the OpenAI API: billed per token from prepaid credits, separately from ChatGPT plans. As of October 2026, 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.
Prices and API behavior checked against OpenAI's developer documentation, pricing page and help center, and n8n's docs, on October 1, 2026. This update replaces the January 2026 version, whose GPT-4 Turbo prices, "unlimited" claims and per-request cost figures were out of date or unsupported.
ChatGPT plans vs the OpenAI API
People say "ChatGPT API" but mean two different products:
| 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 $0, 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 | Rate limits per minute and a monthly usage limit, by usage tier |
Sources: ChatGPT pricing and OpenAI's billing help, which says "API usage is billed separately from your ChatGPT subscription." A Plus plan doesn't give you API credits, and the API isn't a cheaper way to chat; it's the way to put models inside workflows. Our guide to 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. 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. All three models have a 1,050,000-token context window and up to 128,000 output tokens.
- 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 your bill can exceed what the visible answer suggests.
- Batch API and Flex processing cost 50% of standard; Fast mode costs 2x.
- Writing a prompt to the cache costs 1.25x the input rate on these models; cached reads then use the cached-input column.
What a workflow actually costs
Cost = input tokens x input price + output tokens (including reasoning) x output price, per million. A token is roughly four characters of English text. Three worked examples at standard rates:
| 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, and run the numbers again when prices change.
Build API workflows in n8n
- Create a restricted project key on the OpenAI platform and add it to an OpenAI credential in n8n. Leave Organization ID blank unless you belong to several organizations.
- Add the OpenAI node and choose the Text resource with Generate a Model Response, which uses the Responses API. n8n added it in version 1.117.0; the older Generate a Chat Completion operation uses Chat Completions (text operations docs).
- Set the messages: a System message with your rules, and a User message with the data from earlier nodes.
- Set the options: Output Format as JSON Schema, a Maximum Number of Tokens, a Reasoning effort, and Store off if you don't need to fetch responses later (it defaults to on). Built-in tools include Web Search, File Search, Code Interpreter and remote MCP servers.
- Use the output in the next nodes: route with a Switch node, write to your CRM, or send a draft for approval.
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. For endpoints the node doesn't cover, such as the Batch API, use the HTTP Request node with the OpenAI credential as a Predefined Credential Type. See our AI agent automation guide for the agent pattern.
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 JSON 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 in your instructions.
Five workflows worth building
- 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 about 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 for a spreadsheet or database, 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; our n8n database automation guide shows the reporting half.
Keep costs and failures down
- Right-size models. Use Luna wherever it passes your tests, and escalate only the hard cases.
- Cap output. Set
max_output_tokensand a low reasoning effort for simple tasks. If a response hits the cap, its status isincomplete, and you can pay for input and reasoning tokens with no visible answer. - Cache the stable part. Prompt caching is on by default for supported models. Put instructions, examples and schemas first and the changing data last. For GPT-5.6 and later, prefixes of at least 1,024 tokens can be cached; later reads cost 0.1x the input rate (0.05x on GPT-6.1 Sol).
- Batch what can wait. The Batch API is 50% cheaper, with results within 24 hours and a separate pool of higher rate limits.
- Plan for rate limits. Limits rise with your usage tier; at the Build tier, Astra and Sol allow 5,000 requests and 1 million tokens per minute. On a 429, wait at least as long as the
Retry-Afterheader says, and otherwise back off exponentially with a little random delay. - Cap spend. Set a hard spend limit on the project so a runaway loop can't drain your credits.
Data and security basics
- OpenAI's data controls page says API data "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.
- 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.
Troubleshooting
401 or 429 errors
A 401 means the key was rejected; a 429 is either a rate limit (retry with backoff) or a quota, credit or spend-limit problem (retrying won't help). Our API key guide lists the exact error codes.
Old tutorials fail
Code that uses the Assistants API stopped working when OpenAI removed it on August 26, 2026, per the deprecations page; move it to the Responses API. Tutorials built on older model names, such as gpt-4-turbo-preview or gpt-3.5-turbo, will generally get better results and prices from the current models.
Output isn't valid JSON
Use Structured Outputs with a strict JSON schema (in n8n, Output Format: JSON Schema) instead of asking for JSON in the prompt.
Answers are cut off
Raise max_output_tokens or lower the reasoning effort; reasoning tokens count against the same limit.
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. For more, see our guides to connecting OpenAI to n8n and Claude vs ChatGPT. If you want to build a product on an AI API, AI SaaS Builder uses the Claude API and covers prompting, tool use, structured output, caching and production hardening, along with Supabase, Next.js and Stripe billing.
Want the full AI SaaS Builder playbook?
A 10-module, 52-lesson curriculum: validate an idea, build on Supabase and Next.js, add AI features with the Claude API, speed up with Claude Code and MCP, deploy on Vercel, launch, and charge with Stripe.
ChatGPT API workflows FAQ
Is the ChatGPT API the same as ChatGPT Plus?
No. ChatGPT Plus is a $20 a month subscription for using the ChatGPT app. The API is OpenAI's developer platform, billed per token from prepaid credits, and OpenAI's billing help says API usage is billed separately from your ChatGPT subscription.
How much does the ChatGPT API cost?
It depends on the model and the tokens you send and receive. On October 1, 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.
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. Test each on real examples before you commit.
Is the OpenAI API unlimited?
No. Every organization has rate limits in requests and tokens per minute that rise with usage tier, plus a monthly usage limit. At the Build tier, for example, GPT-6 Astra and Sol allow 5,000 requests and 1 million tokens per 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. 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 says data sent to the API since March 1, 2023 is not used to train its models unless you opt in. Abuse-monitoring logs are kept for up to 30 days by default.