{
  "name": "AI agent on 100+ models with one key (MegaBrain, OpenAI-compatible)",
  "nodes": [
    {
      "parameters": {
        "content": "# AI agent on any model\nn8n's **OpenAI Chat Model** node works with MegaBrain: one key, 100+ models (Claude, GPT, Gemini, Kimi, GLM, Qwen, DeepSeek…) and a free one, `mb-auto/free`.\n\n## Setup\n1. Get a key at [getmegabrain.com/keys](https://getmegabrain.com/keys).\n2. Create an **OpenAI** credential:\n   - API Key: your MegaBrain key\n   - Base URL: `https://getmegabrain.com/api/gateway/v1`\n3. Open the chat and talk. Change the model in *MegaBrain model* — the list loads from your account.\n\nAll models: [getmegabrain.com/models](https://getmegabrain.com/models)",
        "height": 600,
        "width": 440
      },
      "id": "2034ea28-6288-556a-b1fc-9ead4122e55e",
      "name": "About",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -300
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "7616c2d1-bd02-56b2-b8e0-2d44a29e3cec",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "webhookId": "8da56720-b39f-53c4-97ba-6eeb4562ce32"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant. Answer briefly."
        }
      },
      "id": "29854045-0d19-53c2-8f4b-aa7506cf38c8",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "mb-auto/free",
          "mode": "id"
        },
        "options": {}
      },
      "id": "d2331032-c73a-57e7-91d5-e9be88fee19a",
      "name": "MegaBrain model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        160,
        220
      ]
    },
    {
      "parameters": {},
      "id": "2a87cc5b-5201-5fd3-a595-d613f4b161c7",
      "name": "Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        340,
        220
      ]
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MegaBrain model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
