What you need
- n8n, self-hosted or on n8n Cloud. A cloud instance cannot reach
localhoston your computer. For n8n Cloud, FreeLLMAPI must have a public HTTPS address. - FreeLLMAPI, installed with Docker or the desktop app. Add at least two free provider keys on the Keys page.
- The unified key from the FreeLLMAPI Keys page. n8n uses only this key.
Install FreeLLMAPI (macOS or Linux)
curl -fsSL https://freellmapi.co/install.sh | bashThe Base URL depends on where n8n runs. Inside a Docker container, localhost is the container, not your computer.
| n8n runs | Base URL |
|---|---|
| On the host (npm or npx) | http://localhost:3001/v1 |
| In Docker Desktop (macOS, Windows) | http://host.docker.internal:3001/v1 |
| In Docker on Linux, same host as FreeLLMAPI | http://freellmapi:3001/v1, after you connect the n8n container to the FreeLLMAPI Docker network |
| n8n Cloud | The public HTTPS address of your FreeLLMAPI server, with /v1 at the end |
Step 1: Create the OpenAI credential
- In n8n, open Credentials and create a new credential of the type OpenAI.
- In API Key, paste your FreeLLMAPI unified key.
- Leave Organization ID (optional) empty.
- In Base URL, replace
https://api.openai.com/v1with your FreeLLMAPI URL, for examplehttp://host.docker.internal:3001/v1. - Save the credential.
All OpenAI nodes that use this credential now send their requests to FreeLLMAPI. Your real provider keys stay in FreeLLMAPI. They do not go into n8n.
Test the URL from the n8n container
docker exec n8n wget -qO- \
--header="Authorization: Bearer <unified-key>" \
http://host.docker.internal:3001/v1/models | head -c 300Step 2: Build an AI Agent workflow
The AI Agent node needs a chat model sub-node and at least one tool sub-node. Since n8n 1.82.0, every AI Agent node works as a Tools Agent. The agent sends tool definitions to the model, so the model must support tool calling.
- Add a Chat Trigger node. It gives you a chat window to test the workflow.
- Add an AI Agent node after the trigger.
- Connect an OpenAI Chat Model sub-node to the Chat Model input of the agent. Select your FreeLLMAPI credential.
- In Model, change the mode from From List to ID. Type
auto. - Connect a tool sub-node, for example the Calculator tool or an HTTP Request tool.
- Open the chat and send a test message.
Use ID mode for the model. The list mode shows the full FreeLLMAPI catalog, which also contains models that you cannot call yet. These IDs are useful in n8n:
| Model ID | Use it for |
|---|---|
auto | General workflows. The router follows your fallback chain. |
auto:fast | Classification, short summaries and other high-volume steps |
auto:smart | Agent steps that must plan or select tools |
auto:reliable | Scheduled workflows that must not fail |
auto:<profile> | A named fallback chain, for example one that has only tool-calling models |
For agent steps, keep only tool-calling models in the chain. These free models support tool calling today:
| Model | Free on | Context | Free limits (best offer) | Tools | Vision |
|---|---|---|---|---|---|
| GLM 5.3 | UnoRouter | 1M | 1 req/min 1 req/min per model | Yes | No |
| GLM 5.3 Flash | NVIDIA NIM, UnoRouter | 1M | 40 req/min 40 RPM | Yes | Yes |
| Gemini 3.8 Flash | Google AI Studio | 1M | Recurring provider quota | Yes | Yes |
| Qwen3.8 Flash Next | AMD Radeon Cloud | 262K | Recurring daily account allowance | Yes | No |
| Qwen3.8 Flash | ElectronHub | 1M | $0.25/week shared recurring credit | Yes | Yes |
| Gemini 3.7 Flash | Google AI Studio | 1M | 10 req/min 20 req/day 250,000 tokens/min ~3M | Yes | Yes |
| GPT-5.6 Luna | ElectronHub | 1M | $0.25/week shared recurring credit | Yes | Yes |
| Dots3 Note Preview | Kilo Gateway, OpenRouter | 512K | 20 req/min 50 req/day 50 req/day account-wide (1,000 after a $10 purchase) | Yes | Yes |
| DeepSeek V4 Flash | AMD Radeon Cloud, BazaarLink, ElectronHub | 1M | 10 req/min 50 req/day Shared rate limit | Yes | No |
| Qwen3.8 27B | ElectronHub, Groq, OVH AI Endpoints | 262K | 30 req/min 250 req/day 70,000 tokens/min ~6M | Yes | Yes |
Showing 10 of 109 matching free models. See all models.
Live data from the FreeLLMAPI catalog (version 2026.11.19, checked 19 November 2026). Free limits change often. The catalog is checked every day.
Step 3: Handle free-tier limits
A workflow that loops over 500 items sends 500 requests. Free tiers limit requests per minute and per day. FreeLLMAPI counts the quota of each key and moves to the next provider on a 429 error. When every key in the chain is at its limit, the gateway returns 429 with a Retry-After header.
Set these options so that a short limit does not stop the workflow:
| Where | Setting | Value |
|---|---|---|
| OpenAI Chat Model, Options | Max Retries | 3 to 5 |
| OpenAI Chat Model, Options | Timeout | 60000 ms or more for long prompts |
| Node settings (gear icon) | Retry On Fail | On |
| Node settings | Max. Tries | 3 |
| Node settings | Wait Between Tries (ms) | 5000 or more |
| Loop Over Items node | Batch Size | Small batches, with a Wait node between them |
Add keys from more providers to raise the total number of requests per day. The table shows the free limits per provider in today's catalog.
| Provider | Free models | Max req/min | Max req/day | Max tokens/min | Tokens/month (one model) | Strongest free model |
|---|---|---|---|---|---|---|
| ElectronHub | 84 | - | - | - | $0.25/week shared recurring credit | Qwen3.8 Flash (ElectronHub)qwen3.8-flash |
| Cloudflare Workers AI | 39 | - | - | - | ~5-10M | Qwen 3.8 27B (Cloudflare Workers AI)@cf/qwen/qwen3.8-27b |
| Inferbase | 38 | - | - | - | 5,000 requests/month; 100 requests and $0.50 usage/day shared | DeepSeek V4 Flash (fp8) (Inferbase)deepseek-v4-flash:fp8 |
| AI Horde | 31 | - | - | - | Ongoing volunteer queue; availability varies | Gemma 4 31B Heretic (AI Horde)koboldcpp/gemma-4-31B-it-heretic |
| ACLIDE | 29 | - | - | - | €20/month shared internal usage credits · no card | Qwen3.8 Max (ACLIDE)qwen/qwen3.8-max:free |
| Google AI Studio | 21 | 15 | 1,000 | 250,000 | ~3M | Gemini 3.8 Flashgemini-3.8-flash |
| Api.Airforce | 20 | 1 | 1,000 | - | free · 1,000 req/day · 1 req/min | gpt-oss-20b (Api.Airforce)gpt-oss-20b |
| NVIDIA NIM | 19 | 40 | - | - | free · 40 RPM | GLM 5.3 Flash (NV)z-ai/glm-5.3-flash |
| Cohere | 17 | 20 | 33 | - | ~1-2M | Command A+ (05-2026)command-a-plus-05-2026 |
| DreamPrompting | 14 | 100 | 5,000 | - | free · 500K tokens/day · 5,000 req/day | Gemini 3.1 Flash-Litegoogle/gemini-3.1-flash-lite |
Live data from the FreeLLMAPI catalog (version 2026.11.19, checked 19 November 2026). Free limits change often. The catalog is checked every day.
Use the HTTP Request node
You can also call FreeLLMAPI with the generic HTTP Request node. Use this method when you need a parameter that the OpenAI node does not show, or when you want the response headers.
- Method:
POST - URL:
http://host.docker.internal:3001/v1/chat/completions - Header:
Authorizationwith the valueBearer <unified-key> - Body content type: JSON
JSON body
{
"model": "auto:fast",
"messages": [
{"role": "system", "content": "Classify the ticket as billing, bug or other. Reply with one word."},
{"role": "user", "content": "{{ $json.ticket_text }}"}
],
"temperature": 0
}The answer is in choices[0].message.content. The response header X-Routed-Via shows the provider and model that answered. If the router changed provider, X-Fallback-Attempts shows the number of failed attempts.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Credential test fails with a connection error | localhost points to the n8n container | Use host.docker.internal or a shared Docker network |
| Error 401 | Wrong key | Paste the unified key again |
| The model list has hundreds of entries | List mode reads the full catalog | Use ID mode and type auto |
| The agent answers but never uses a tool | The selected model does not support tool calling | Use a model from the table above, or a profile with tool-calling models |
| Error 429 in a long loop | All keys are at their limit | Add providers, use smaller batches and turn on Retry On Fail |
| The node times out | A slow free model with a long prompt | Increase Timeout, or use auto:fast |
Frequently asked questions
Can I use a custom base URL with the n8n OpenAI node?
Yes. The OpenAI credential in n8n has a Base URL field. Set it to an OpenAI-compatible URL that ends in /v1, for example http://localhost:3001/v1 for FreeLLMAPI.
Is there a free LLM API for n8n?
Yes. Free provider tiers work in n8n through the OpenAI credential. FreeLLMAPI combines many free tiers behind one key. Each tier has its own request limits.
Which free model works with the n8n AI Agent node?
Use a model that supports tool calling, because the AI Agent node works as a Tools Agent. The table on this page lists free models with tool calling.
How do I stop n8n workflows from failing on rate limits?
Set Max Retries on the chat model node, turn on Retry On Fail in the node settings and process items in small batches. Add keys from more providers to raise the daily total.
Does n8n Cloud work with a self-hosted LLM gateway?
Only if the gateway has a public HTTPS address. n8n Cloud cannot reach localhost on your computer.
Related guides
- Free LLM API for AI agents
- Free LLM API with function calling
- Free OpenAI-compatible API base URLs
- Free LLM API rate limits
- Free LLM API for LangChain
Sources
- n8n source: OpenAI credential fields (API Key, Organization ID, Base URL) (checked 20 November 2026)
- n8n docs: OpenAI Chat Model node (checked 20 November 2026)
- n8n docs: AI Agent node (checked 20 November 2026)
- n8n docs: node settings (Retry On Fail) (checked 20 November 2026)
- FreeLLMAPI docs: REST API (routing strategies, response headers) (checked 20 November 2026)