n8nでOpenRouter.aiのチャットAPIを使ったワーキングフローを構築する

初級

これはEngineering, AI Chatbot分野の自動化ワークフローで、4個のノードを含みます。主にSet, Summarize, HttpRequest, ManualTriggerなどのノードを使用。 OpenRouterを使ってMistralとAIモデルでチャット

前提条件
  • ターゲットAPIの認証情報が必要な場合あり
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "I0kBHahzGYqCjGVg",
  "meta": {
    "instanceId": "29dccb3f636e984cab758d231ae358f0228fd43880fb6292144b674668680e5a"
  },
  "name": "Use OpenRouter.ai Chat API Workflow in n8n",
  "tags": [],
  "nodes": [
    {
      "id": "865b71c0-1571-45d1-b043-34748152efc1",
      "name": "「Execute workflow」クリック時",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -200,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "46b00289-733d-46ec-9db4-1774d3ff9ce6",
      "name": "OpenRouter.ai",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        0
      ],
      "parameters": {
        "url": "https://openrouter.ai/api/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"{{ $json.Model }}\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"{{ $json.Message }}\"\n    }\n  ]\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "8485a42f-54f5-4151-861b-30e565e0d0b6",
      "name": "モデルとプロンプトの設定",
      "type": "n8n-nodes-base.set",
      "position": [
        40,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "230805bf-a50a-4d36-ac6d-70847bac862e",
              "name": "Model",
              "type": "string",
              "value": "mistralai/mistral-small-3.2-24b-instruct:free"
            },
            {
              "id": "c8d75446-659e-4fe6-bc88-8f24cf1a510e",
              "name": "Message",
              "type": "string",
              "value": "What is the meaning of life?"
            },
            {
              "id": "7eb8f25c-8a85-445c-9b06-0aaf66c5b719",
              "name": "",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "96a85fb6-2a8a-4417-93c7-9a6302658dfe",
      "name": "要約",
      "type": "n8n-nodes-base.summarize",
      "position": [
        500,
        0
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "choices[0].message.content",
              "aggregation": "min"
            }
          ]
        }
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "771a55ac-ff58-4b56-9137-b1871465b185",
  "connections": {
    "46b00289-733d-46ec-9db4-1774d3ff9ce6": {
      "main": [
        [
          {
            "node": "96a85fb6-2a8a-4417-93c7-9a6302658dfe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8485a42f-54f5-4151-861b-30e565e0d0b6": {
      "main": [
        [
          {
            "node": "46b00289-733d-46ec-9db4-1774d3ff9ce6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "865b71c0-1571-45d1-b043-34748152efc1": {
      "main": [
        [
          {
            "node": "8485a42f-54f5-4151-861b-30e565e0d0b6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

初級 - エンジニアリング, AIチャットボット

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
初級
ノード数4
カテゴリー2
ノードタイプ4
難易度説明

n8n初心者向け、1-5ノードのシンプルなワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34