SOYOMA LogoSOYOMA

AI Chatbot with n8n & OpenRouter

2025-07-09
usecase
Featured image for AI Chatbot with n8n & OpenRouter

Introduction

Let’s build a super-simple AI chatbot in n8n using only two nodes—Chat and AI Agent—and OpenRouter’s free-tier models (like llama3.1 or mixtral-small). No coding required!

Prerequisites

  • An OpenRouter account (free tier)

1. Get Your OpenRouter API Key

  1. Go to https://openrouter.ai and sign up.
  2. In your dashboard, click API KeysCreate Key.
  3. Copy the new key (it starts with or-…).

2. Add OpenRouter Credentials in n8n

  1. In n8n’s editor, click the gear ⚙️ icon in the top right → Credentials.
  2. Choose OpenRouter API.
  3. Paste your API key.
  4. Set Base URL to https://openrouter.ai/api/v1.
  5. Save.

3. Build the Chatbot Workflow

A. Chat Trigger

  1. Drag in a Chat node.

This node both receives user text and displays the AI’s reply.

B. AI Agent

  1. Drag an AI Agent node and connect it after Chat.
  2. Select the same OpenRouter credentials.
  3. In Tasks, you can add quick actions like:
    • Summarize
    • Translate
    • Extract keywords
  4. Link the Chat output (text) into the Agent’s Input field.

The AI Agent can enrich replies—for example, summarizing a longer user question.

4. Activate & Test

  1. Click Activate on each node.
  2. Open the Chat node’s URL in a browser (n8n shows it when you click the node).
  3. Type a message and hit send.
  4. Watch your AI reply instantly, powered by OpenRouter’s free model!

Conclusion

That’s it—two nodes, zero code, and you’ve got a Chatgpt like AI chatbot using n8n + OpenRouter’s free tier.

Want more step-by-step guides? Follow @soyoma.io and let’s build together!