A Free LLM API for n8n Workflows (OpenAI-Compatible Setup)
n8n is great at moving data between services, and adding a language model to a workflow turns it into something much more useful. The problem is cost. Every summarization step, every classification, every drafted reply burns OpenAI credits, and a workflow that loops over a few hundred rows can spend real money before you have even finished testing it. This guide shows you how to plug a free LLM API into n8n instead.
The reason this works is simple. Almost every AI node in n8n speaks the OpenAI protocol, and most of them let you override the base URL. DreamPrompting is an OpenAI-compatible gateway at https://dreamprompting.com/api/v1 that routes across multiple free model providers with automatic failover. Point n8n at that URL, give it your key, and the nodes you already know keep working.
Get your free API key first
You do need a key. It is free and takes about thirty seconds, with no credit card involved.
- Go to your account page.
- Sign in with Google.
- Create a key and copy it. It only shows in full once, so paste it straight into n8n or your password manager.
Every request needs that key in an Authorization: Bearer YOUR_API_KEY header. The limits are 100 requests per minute plus a rolling 24 hour account quota of 5,000 requests and 500,000 tokens. You can check where you stand at any time with GET /api/v1/quota, which is worth wiring into a monitoring workflow if you run scheduled jobs.
Method 1: the OpenAI credential
If your n8n version lets you override the base URL on the OpenAI credential, this is the cleanest route, because the built-in OpenAI and AI nodes then just work. Create a new credential of type OpenAI and fill in two fields.
API Key: YOUR_API_KEY
Base URL: https://dreamprompting.com/api/v1
Node and credential layouts shift between n8n releases, so look for the fields rather than a fixed position on screen. The base URL setting is sometimes labelled Base URL and sometimes lives behind an options or advanced toggle on the credential form. Whatever it is called, the value you want ends in /api/v1 with no trailing slash and no /chat/completions on the end, because the node appends the path itself.
Once the credential is saved, the model field matters. n8n usually tries to populate a dropdown by calling GET /api/v1/models, which works because your key is attached. If the dropdown is empty or you want a value the list does not offer, switch the field to expression or manual entry and type the model string yourself. Use auto to let the gateway choose a provider and fail over when one is unavailable, or pin something specific like groq/openai/gpt-oss-120b or google/gemini-3.1-flash-lite. The current lineup is on the models page.
Leave streaming off for workflow use. Streaming is supported on the API, but an n8n node normally wants one complete JSON response to pass to the next node, so a single non-streaming call is the right shape here.
Method 2: the HTTP Request node
This is the most reliable option and it works on every n8n version, self-hosted or cloud, no matter how the AI nodes have been reshuffled. You are calling the endpoint directly, so nothing can get in the way. Add an HTTP Request node and configure it like this.
- Method:
POST - URL:
https://dreamprompting.com/api/v1/chat/completions - Send Headers: on. Add
Authorizationwith valueBearer YOUR_API_KEY, andContent-Typewith valueapplication/json. - Send Body: on. Body Content Type: JSON. Specify Body: using JSON.
- Paste the body below.
{
"model": "auto",
"messages": [
{
"role": "system",
"content": "You are a concise assistant. Reply with plain text only."
},
{
"role": "user",
"content": "Summarize this in two sentences: {{ $json.body }}"
}
]
}
Two practical warnings about that body. First, if you interpolate incoming data into a JSON string, escape it, because a stray quote or newline in the source text will break the JSON. The safe pattern is to wrap the value with JSON.stringify inside the expression and drop the surrounding quotes, or to build the whole body in a Set or Code node and pass it through. Second, set a generous timeout in the node options. Model calls can take several seconds, and the default HTTP timeout is often shorter than you want.
Rather than storing the key as plain text in the node, you can create a Header Auth credential in n8n with name Authorization and value Bearer YOUR_API_KEY, then select it under Authentication in the HTTP Request node. The key stays out of the exported workflow JSON, which matters if you share workflows or commit them to a repository.
Using it behind an AI Agent or Chain node
The AI Agent and Basic LLM Chain nodes take a chat model as a sub-node, and an OpenAI Chat Model sub-node pointed at your credential from Method 1 will serve as that backend. This gives you memory, prompt templates, and tool nodes on top of a free model. If you are building anything agent-shaped, the notes in our guide to free LLM APIs for AI agents and the agent integration page are worth a read alongside this.
There is one real caveat. Agent nodes rely on function calling to decide which tool to invoke, and tool calling depends on the underlying model, not on the gateway. Do not use auto for agent work. Failover could hand you a model that does not support tools, and the agent will then either ignore its tools or fail in a confusing way. Pin a specific model you have confirmed supports function calling, for example groq/openai/gpt-oss-120b, and keep the tool count small. Smaller free models are noticeably better at choosing between three tools than between twelve.
Reading the reply in later nodes
The response is standard OpenAI shape, so the generated text sits at choices[0].message.content. In any node downstream of the HTTP Request node, reference it with this expression.
{{ $json.choices[0].message.content }}
If you need the value further along the workflow, after a few more nodes have run, address the node by name instead, as in {{ $('HTTP Request').item.json.choices[0].message.content }}. Token counts come back under usage if you want to log them. When you ask the model for structured output, prompt for JSON and then parse the content string in a Code node, since content is always text even when that text happens to be JSON.
Three workflows worth building
Summarize incoming email. Gmail or IMAP trigger, then the model call with the message body, then post the two sentence summary to Slack. This is the fastest way to make a noisy inbox scannable, and it is a good first test because the volume is naturally low.
Classify form submissions. A webhook receives a contact or support form, the model returns a single label from a fixed list such as sales, support, or spam, and a Switch node routes each one to the right destination. Tell the model to reply with the label and nothing else, then trim whitespace before comparing, which avoids most brittle routing bugs.
Draft replies from a webhook. Take an inbound question, pass along a short block of product context in the system message, and create a draft rather than sending. A human approves it in one click, so you get the speed of automation without the risk of an automatic wrong answer going out.
Rate limits, retries, and looping workflows
Two limits apply: 100 requests per minute, and a rolling 24 hour account quota of 5,000 requests and 500,000 tokens. Cross either one and you get an HTTP 429, which n8n surfaces as a node error. That is easy to handle once you know it is coming.
- Turn on Retry On Fail in the node settings, with two or three tries and a wait of a couple of seconds between them. This absorbs short bursts on its own.
- For workflows that process many items, put a Wait node inside the loop. Even one second per item keeps you comfortably under the per minute ceiling.
- Batch your work instead of sending one request per row. Ten items in a single prompt is one request against your quota, not ten.
- Set the node to continue on error where a missing summary is acceptable, so one failed item does not kill a run of five hundred.
- Call
GET /api/v1/quotaat the start of a large scheduled job and stop early if the remaining budget is too small.
The daily quota is the one that catches people out. A workflow that looks harmless in testing can consume a thousand requests in a single run once it is pointed at a real dataset, so estimate the item count before you enable the schedule.
Next steps
Start with the HTTP Request node, confirm you get text back, and only then decide whether the OpenAI credential route is worth wiring up for the AI nodes. Grab a key on your account page, keep the API docs open for parameters and error codes, and pick a model from the models page. If you are comparing options, our roundup of the best free LLM APIs in 2026 and the notes on free OpenAI-compatible APIs cover the tradeoffs, and the Python quickstart is handy for anything you end up writing in a Code node.