Skip to content
All posts
By the PromptUnit team···8 min read

n8n OpenAI Costs Too High? 5 Fixes That Work

Your n8n workflows are spending too much on OpenAI. Here are five concrete fixes, model swaps, caching, batching, prompt trimming, and proxy routing, with real 2026 prices.

n8nopenai-costllm-routingworkflow-automationmodel-selection

The fastest way to cut your n8n OpenAI bill is to stop sending every step to your most expensive model. Most n8n workflows mix task types, and classification, extraction, and summarization steps can run on models costing 20 to 50 times less than a flagship without any noticeable quality drop. Beyond model choice, three more levers matter: trimming the tokens you send, caching repetitive calls, and using n8n's batch-ready structure to defer non-urgent work. This article walks through each one with actual November 2026 prices.

Why n8n Workflows Overspend on OpenAI

n8n does not bundle LLM costs. Every token your workflow sends to OpenAI is billed directly to your API key at whatever model rate you configured. That means a misconfigured model choice compounds with every execution.

The most common pattern is a workflow that was prototyped with GPT-4o or a newer flagship because "it worked reliably," then went to production without anyone revisiting the model. At 200,000 monthly executions with 20,000 input tokens per call, GPT-4o at $2.50 per million input tokens adds up to $10,000 in input tokens alone. That figure is very sensitive to model choice: moving to GPT-6 Luna at $0.10 per million input tokens would cost $400 for the same volume.

A second common issue is context growth. n8n's memory nodes add past messages to every request, so with a large window a workflow that starts at 1,000 input tokens per turn can reach 20,000 tokens after 20 turns, multiplying your bill by 20x on a long-running agent.

A third is model deprecation risk. If your workflow still names gpt-4o-2024-08-06 or gpt-4.1-2025-04-14, both have been deprecated as of October 14, 2026 and will stop working on January 14, 2027. The recommended replacement is gpt-6-luna for most of those workloads.

Fix 1: Audit What Each Step Actually Needs

Before changing any configuration, map what each AI node in your workflow is doing. n8n workflows typically mix at least three task types with very different model requirements:

Task type Typical tokens/call Minimum capable model Cost per million input tokens
Classification / routing 200-600 GPT-6 Luna $0.10
Extraction / structured JSON 500-2,000 GPT-6 Luna or GPT-5.4 mini $0.10-$0.75
Summarization 2,000-8,000 GPT-5.4 mini or GPT-5.6 Terra $0.75-$2.00
Long-form generation / reasoning 2,000-10,000+ GPT-5.6 Sol or GPT-6.1 Sol $2.00-$4.00

(All prices from OpenAI's pricing page, November 2026. GPT-4o and GPT-4o mini are deprecated with a January 14, 2027 shutdown date and should not be used in new configurations.)

A classification step that labels incoming emails as "billing," "support," or "sales" does not need GPT-5.5 at $5.00 per million input tokens. GPT-6 Luna at $0.10 handles it. At 600 input tokens a call, 50,000 classifications a month cost $150 in input on GPT-5.5 and $3 on GPT-6 Luna, a 50x difference for the same label.

For steps that need more reasoning, GPT-5.4 mini at $0.75 input / $4.50 output is a good middle tier. It costs 85% less than GPT-5.5 and handles extraction and moderate summarization well for most production workloads. See the routing math behind similar trade-offs if you want worked token examples.

Let each request use the cheapest model that's just as good

PromptUnit checks each request your app sends. When a cheaper model is just as good for that request, it uses it; otherwise your model answers. Free until it has saved you money.

Try it free →

Fix 2: Change the Model in the n8n Credential

In n8n, the OpenAI credential has a Base URL field alongside the API key. By default it points to https://api.openai.com/v1, but you can point it at any OpenAI-compatible endpoint and control which model the node calls by changing the model ID in the node's settings.

To change the model for a specific step without touching other nodes:

  1. Open the OpenAI Chat Model sub-node connected to your AI Agent or Basic LLM Chain.
  2. Change the Model field to the new model ID (for example, from gpt-5.5 to gpt-5.4-mini).
  3. If you want a node-level Base URL override instead of a credential-level one, go to Options in the OpenAI Chat Model sub-node. The node-level setting takes priority over the credential.

If your workflow uses multiple AI steps with different quality requirements, you can connect separate OpenAI Chat Model sub-nodes to each AI node, each with a different model ID. n8n's Switch node can then route items to the appropriate agent based on a complexity score or task type you compute earlier in the workflow.

Fix 3: Trim the Tokens You Send

Shorter prompts cost less. Three places where n8n workflows waste tokens:

System prompts. It is common to include multi-paragraph system prompts on every call. At 800 input tokens in the system prompt across 100,000 calls per month, you're spending 80 million tokens just on the prompt. At GPT-5.5 prices ($5.00 per million), that's $400 per month in system-prompt-only spend. Cutting the system prompt to 200 tokens saves $300 per month on that model.

Unfiltered data passthrough. When a workflow pulls JSON from an API and passes the whole object to an LLM, it often includes dozens of fields the LLM ignores. A Set or Code node upstream can strip the payload to only the fields the LLM needs. This is free to compute in n8n and can cut input tokens by 50 to 80 percent on data-heavy workflows.

A memory window larger than needed. The Window Memory node sends a set number of past messages with every call. For a workflow invoked dozens of times in a session, that adds up quickly. Set the window to the minimum number of turns that keeps the agent coherent for your specific task. Detailed techniques for prompt compression are in this guide to reducing token count without losing quality.

Fix 4: Cache Repetitive Calls

n8n has no built-in LLM response cache, but you can add a Redis or database lookup node before any LLM node. The pattern is straightforward: hash the input (the Code node can do this), query Redis, return the cached response if it exists, and only continue to the LLM if it doesn't. For workflows where many executions share similar inputs, like translating a fixed set of product descriptions or classifying from a small label set, this can eliminate a large share of LLM calls entirely.

If you are routing through an OpenAI-compatible proxy, some of them include exact-match caching for free. An exact repeat of the same request (same model, messages, and settings) can be served from cache without touching OpenAI's API at all.

For input that isn't identical but shares long repeated sections, like a system prompt or document that appears in every call, OpenAI's prompt caching (available on GPT-5.x and GPT-6.x models) automatically discounts tokens that reappear in context. Cached input tokens on GPT-5.4 cost $0.25 per million versus $2.50 uncached, a 90% reduction on the repeated portion. The prompt caching breakdown covers which conditions trigger a cache hit.

Fix 5: Defer Non-Urgent Calls to Batch Processing

If some steps in your workflow don't need a synchronous result, OpenAI's Batch API cuts costs by 50 percent across all supported models. At GPT-5.4, batch pricing is $1.25 input / $7.50 output per million tokens versus $2.50 / $15 at standard. At GPT-5.6 Sol, it's $2 / $10 versus $4 / $20.

In n8n, this means collecting inputs over a time window, sending them as a batch job via an HTTP Request node to /v1/batches, then polling for results when the job completes. The workflow is slightly more complex to build but the approach works well for nightly summarization, weekly report generation, or any pipeline where a few hours of latency is acceptable. The batch API decision guide has more detail on what to move and what to keep synchronous.

Putting It Together: Per-Step Model Assignment

The most reliable way to control n8n AI costs at scale is to treat your workflow as a pipeline with explicit model assignments per step, not a single model setting applied everywhere. A workflow with five AI steps might assign them like this:

  • Input classifier (labels ticket type): GPT-6 Luna at $0.10 input
  • Field extractor (pulls structured data from free text): GPT-6 Luna or GPT-5.4 mini at $0.10-$0.75 input
  • Context summarizer (condenses prior conversation): GPT-5.4 mini at $0.75 input
  • Response drafter (writes a customer-facing reply): GPT-5.6 Terra at $2.00 input
  • Quality checker (flags off-topic or policy violations): GPT-6 Luna at $0.10 input

That structure can be 5 to 20 times cheaper than using a single mid-to-high tier model across all five steps, with no change to the steps that actually need quality.

If manually auditing and assigning models per step feels like ongoing maintenance, a per-request cost router like PromptUnit can sit between n8n and OpenAI: in the OpenAI credential, you paste your personal PromptUnit address into the Base URL field, and the API Key field keeps your own OpenAI key. Each request is then checked: when a cheaper model is just as good for it, PromptUnit uses it; otherwise the request goes to the model you asked for. The dashboard shows what each step costs and saves, which makes the audit described above much faster. The setup for n8n specifically is documented at promptunit.ai/docs/connect/n8n.

The common thread across all five fixes is the same: the cost problem in most n8n workflows isn't that AI is inherently expensive, it's that a model chosen for prototyping was never re-examined once it went to production. The AI cost optimization checklist has a full 15-step process if you want a structured way to work through the rest of your stack.

Current prices of the models in this post

Per 1 million tokens, input and output, read every day from each provider's own pricing page.

Compare: GPT-4o mini vs GPT-6 Luna

All AI API prices →

FAQ

Why is my n8n OpenAI bill so high even for simple workflows?

n8n bills LLM tokens directly through your OpenAI API key, so the cost depends entirely on which model you picked and how many tokens each call sends. The most common cause is using a flagship model like GPT-5.5 or GPT-5.6 Sol for tasks like classification or extraction that a much cheaper model (GPT-6 Luna at $0.10 per million input tokens) can handle equally well.

How do I change the AI model in an n8n workflow?

Open the OpenAI Chat Model sub-node connected to your AI Agent or LLM Chain and change the Model field to the new model ID. You can also set a different Base URL in the OpenAI credential to route calls to a different endpoint, or override it per node under Options in the OpenAI Chat Model sub-node.

Can I use different models for different steps in the same n8n workflow?

Yes. Connect a separate OpenAI Chat Model sub-node to each AI Agent or LLM Chain node and set a different model ID on each one. A Switch node earlier in the workflow can also route items dynamically based on task type or complexity.

Are GPT-4o and GPT-4o mini still safe to use in n8n in late 2026?

No. Both GPT-4o and GPT-4o mini were deprecated by OpenAI on October 14, 2026 and will stop working on January 14, 2027. OpenAI recommends migrating to GPT-6 Luna as the replacement. Update your n8n nodes before that date to avoid workflow failures.

Does n8n have built-in LLM cost tracking or caching?

n8n does not have built-in LLM cost tracking or response caching. For caching, you can add a Redis lookup node before any LLM node to skip the API call when the same input repeats. For cost tracking, you need to log token usage from API responses to an external store, or use a proxy that records per-request spend.

Start saving from your first request

Paste one address where your app runs and see what your first request saved within seconds. Free until we've saved you money. If we save you $0, you pay $0.

Get started free →