Choosing the AI model in n8n: OpenAI, Anthropic, Gemini or OpenRouter
Short answer: in n8n, the model behind an AI Agent or LLM chain node is a separate chat model sub-node (OpenAI, Anthropic, Google Gemini, OpenRouter and others), each with its own credential and a model field. To try another model you swap the sub-node or change the model name. OpenRouter gives you models from many labs with one key. Before switching a live workflow, run the new model on 30–50 inputs the workflow really receives.
How the model is set
- AI nodes like AI Agent and Basic LLM Chain take a Chat Model sub-node: OpenAI Chat Model, Anthropic Chat Model, Google Gemini Chat Model, OpenRouter Chat Model, Ollama (local models) and more.
- Each needs a credential (an API key for that service) and has a model field, plus options like temperature and maximum tokens.
- Simple one-shot nodes like the OpenAI node also have their own model field.
Check n8n's docs for the full current list: new chat model nodes are added regularly.
OpenAI node or OpenRouter?
| A lab's own node (OpenAI, Anthropic, Gemini) | OpenRouter Chat Model | |
|---|---|---|
| Models | That lab's | Many labs and open models |
| Keys and billing | One account per lab | One account, one balance |
| Trying another lab | New account, new credential, swap the node | Change the model name |
| Lab-specific features | Full | Most common features; check the model page |
Switch models without breaking the workflow
- Collect test inputs: from past executions, copy 30–50 real inputs the AI node received (the email, the form, the ticket), anonymized.
- Write down what the next node needs: a field in the JSON, one of three labels, under 500 characters. Those are your checks. More in build a test set.
- Run the current model and the candidate on the same inputs. A copy of the workflow fed by a sheet or table of test inputs is enough. Recent n8n versions also have a built-in evaluations feature for this: see n8n's docs.
- Compare pass rate, cost (from the token usage each execution shows) and time. The comparison method.
- Switch in the live workflow, and keep the copy for the next test.
The thing that breaks most often in a workflow is the format: a model that wraps JSON in extra text, renames a field or adds a label you didn't list. The next node fails, or worse, quietly writes the wrong value. Check format first.
Which model is best for n8n?
The one that passes your workflow's checks at the lowest cost. Classification and extraction usually run fine on the cheap models (from $0.17 per 1,000 runs in our pricing comparison); open-ended writing and multi-step agents often need a bigger one. And if your workflow uses GPT-4o, GPT-4o mini or GPT-4.1, it has to move anyway: they shut down in the API on January 14, 2027.