Call OpenRouter from n8n
One HTTP Request node turns OpenRouter into your workflow's LLM
In this course, OpenRouter is the recommended LLM backend for n8n: because the endpoint is OpenAI-compatible, you don't need a special node or plugin. A single HTTP Request node — POST, one URL, one Authorization header — lets any workflow call any model. This lesson wires that node and gets a free model answering inside n8n.
- 1 Open n8n and create (or open) a workflow. Add an HTTP Request node.
- 2 Set Method to
POSTand URL tohttps://openrouter.ai/api/v1/chat/completions. - 3 Add two headers:
Authorization: Bearer YOUR_KEYandContent-Type: application/json. Use your OpenRouter key from lesson 00 — do not hard-code it where others can read it. - 4 Set the Body (JSON) to:
`{ "model": "google/gemma-4-31b-it:free", "messages": [{"role": "user", "content": "Summarise the role of p53 in tumour suppression in 3 sentences."}] }` - 5 Execute the node. A clean 3-sentence answer comes back in the response body — free, no paid subscription needed.
An n8n HTTP Request node returns a model answer from OpenRouter, with the reply visible under `choices[0].message.content` in the node output.
Why a plain HTTP node is enough
It can feel surprising that you don't need a dedicated 'OpenRouter node'. Understand why one generic node is all it takes — that is the whole point of an OpenAI-compatible gateway.
Because OpenRouter speaks the OpenAI chat-completions format, an n8n HTTP Request node pointed at `https://openrouter.ai/api/v1/chat/completions` with a Bearer token is a complete LLM call. The model is just a string in the body, so the same node can call Claude, Gemini, Llama, or a free Gemma model — you change one field, not the node. This is what makes OpenRouter a drop-in backend for n8n workflows and for any other tool that expects an OpenAI base URL.
- ?If you wanted this same node to use a paid Claude model instead, which exact part of the node would you edit?
- ?Why is putting the API key directly in a shared n8n workflow risky, and where should it live instead?
- ?How would you feed the model's answer into the next node of your workflow? (Hint: which JSON field holds the text?)
Wire the answer into a two-step workflow
A single node that prints an answer is a demo. A workflow that takes an input and acts on the answer is useful.
Build a small n8n workflow where some input feeds the prompt and a later node does something with the model's reply.
- 1 Add a trigger or a Set node that produces an input value (e.g. a paper title, a gene name, a question).
- 2 Reference that value inside the HTTP Request node's prompt so the request is built from the input.
- 3 Add one node after the HTTP Request node that consumes
choices[0].message.content— write it to a file, a sheet, a message, or just a Set node that extracts it cleanly. - 4 Run the workflow end to end with at least two different inputs.
An n8n workflow that takes an input, asks an OpenRouter free model about it, and passes the answer to a downstream node — demonstrated on two inputs.