Skip to content

n8n ​

n8n's OpenAI Chat Model node, used by the Basic LLM Chain and the AI Agent.

Connect ​

  1. Create an "OpenAI API" credential: the API key is your plugboard key, and the Base URL is http://127.0.0.1:4010/v1 (or http://host.docker.internal:4010/v1 from the n8n container, which needs plugboard on a non-loopback address; see Serving other machines). Saving it calls GET /v1/models.
  2. Add an OpenAI Chat Model node with that credential. If the model list shows only OpenAI names, switch Model to "By ID" and type an alias such as fast or any allowed provider/model[#variant].
  3. Turn Use Responses API off in the node. Chat Completions is the path to use from n8n.

To run n8n in Docker beside plugboard:

yml
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:2.42.6
    restart: unless-stopped
    ports:
      - "127.0.0.1:5678:5678"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      N8N_SECURE_COOKIE: "false"
      GENERIC_TIMEZONE: UTC
      N8N_DIAGNOSTICS_ENABLED: "false"
      N8N_PERSONALIZATION_ENABLED: "false"
    volumes:
      - n8n:/home/node/.n8n

volumes:
  n8n:

A Basic LLM Chain workflow you can import. __CRED_ID__ is the id of your OpenAI credential, and responsesApiEnabled is the Use Responses API switch:

json
{
  "name": "pb-s1-chain",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "pb-s1-chain",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "11111111-0000-4000-8000-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [0, 0],
      "webhookId": "pb-s1-chain"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.prompt }}"
      },
      "id": "11111111-0000-4000-8000-000000000002",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [240, 0]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Webhook').first().json.body.model }}"
        },
        "responsesApiEnabled": false,
        "options": {}
      },
      "id": "11111111-0000-4000-8000-000000000003",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [260, 220],
      "credentials": {
        "openAiApi": { "id": "__CRED_ID__", "name": "Plugboard" }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [[{ "node": "Basic LLM Chain", "type": "main", "index": 0 }]]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [{ "node": "Basic LLM Chain", "type": "ai_languageModel", "index": 0 }]
      ]
    }
  },
  "settings": { "executionOrder": "v1" }
}

More workflows (an AI Agent with a tool, streaming, images, structured output) are in examples/n8n/workflows/.

What works ​

  • Basic LLM Chain and AI Agent, including tools (Code, Calculator, HTTP Request and others) and streaming webhooks. n8n runs the tools.
  • The Structured Output Parser, which puts the schema in the prompt.

Limits ​

  • The node's "Response Format: JSON" sends json_object with no schema, so a weak model may return {}. Prefer the Structured Output Parser.
  • Some providers reject sampling options (ChatGPT models reject temperature and top_p; Claude rejects temperature with top_p). Plugboard drops the ones it knows a model rejects and names them in x-plugboard-dropped-params. For others, n8n shows the provider's 400 as "Bad request": leave the option unset.