n8n
This guide shows how to integrate AI/ML API into your n8n workflows, whether you're using n8n Cloud or running a self-hosted instance.
About
n8n is an open-source workflow automation tool that lets you connect various services and automate tasks without writing full integrations manually.
Key features:
No-code / low-code interface: Build workflows visually using a drag-and-drop editor.
Extensive integrations: Comes with 350+ prebuilt nodes for popular services like Slack, GitHub, Google Sheets, OpenAI, and many others.
Flexible logic: You can inject custom JavaScript at any point in the flow for more control.
Self-hosting: Run it locally or on your own server—no need to send data to external clouds.
Extensibility: Easily create custom nodes or connect to any API.
n8n is popular with developers, product teams, and analysts who want to automate repetitive tasks, streamline processes, or create event-driven workflows—without building everything from scratch.
Installation
What installation type should I use?
Setup Complexity
🟢 Very Easy
🟡 Medium
Requires Restart
❌ Usually not
✅ Yes
Model Catalog Access
✅ Full (chat only)
✅ Full (chat only)
Supports Cloud & Self-Hosted
✅ Yes
✅ Self-hosted only
Recommended For
Most users
DevOps & power users
✅ Option 1: Use AI/ML API with Community Node Plugin (Recommended)
This is the easiest and most reliable way to use AI/ML API in n8n. It requires no coding and gives you access to a dedicated AIMLAPI node directly in the n8n workflow editor.
You will go from account creation to receiving your first AI response in just a few steps.
Step 1: Sign up for AI/ML API
Visit https://aimlapi.com/app.
Register an account with Google or email.
After logging in, navigate to your dashboard.
Create and copy your API key.
Step 2: Set up your n8n account
Go to https://n8n.io/ and click Sign Up.
Fill out the registration form.
Wait while your workspace is created.
You will be redirected to your personal n8n workspace.
Click Start from scratch to open the editor.
Click Add first step to begin building your workflow.
Select the node When chat message completed as a trigger.
Step 3: Add and install the AI/ML API Node
Click the + button on the right side of the trigger node. Search for AI/ML API.
Click on AI/ML API, then click Install node → Add to workflow.
The node will appear in your workspace.
Step 4: Connect your API Key
Click Create new credentials in the AI/ML API node.
Paste your API key.
Click Save.
Step 5: Configure the model and the input
Select the model (e.g.
GPT 4o
) in the Model Name or ID field.Click Execute previous node to simulate user input and activate the chat input panel.
Type a test message in the input field (e.g. “Tell me a fun fact”) and click Send.
Step 6: Pass the input to AI/ML API
Go back to the AI/ML API node, select the Prompt field. Click the Expression button.
In the expression editor, expand chatInput on the left. Drag and drop it into the Prompt field.
Step 7: Run the flow
Exit the node editor and click Execute Node (or the full workflow ▶️ button).
You will see the AI/ML API response in the Output tab.
🎉 You’re all set! You’ve successfully built a working chat interaction using AI/ML API and n8n.

🛠 Option 2: Use AI/ML API via npm Package (Manual, Self-Hosted)
If you're running n8n in a custom/self-hosted setup and prefer to manage dependencies manually, you can install the AI/ML API plugin using npm
.
✅ Note: This option gives you exactly the same features and interface as Option 1. The only difference is how the plugin is installed. Once it's added, the node usage, credentials, prompts, and output are identical.
📝 Installation via npm
Navigate to your self-hosted n8n directory
Run:
npm install n8n-nodes-aimlapi
If you’re using Docker:
Mount the plugin as a volume into
/home/node/.n8n/custom
, orExtend your
Dockerfile
and include the plugin inpackage.json
.
Restart your n8n instance to register the new node.
🧩 Continue with Setup from Option 1
Once the plugin is installed and n8n restarted, continue from the following steps:
Step 3: Add and install the AI/ML API Node
Step 4: Connect your API Key
Step 5: Configure the model and the input
Step 6: Pass the input to AI/ML API
Step 7: Run the flow
Everything works the same as in Option 1 — including system/user messages, prompt injection, and output formatting.
How to Use the AI/ML API in n8n
After completing the installation and setup steps described above, you can start using the configured model node in your workflows — for example, to build chatbots. For guidance on building different types of workflows, refer to the official n8n documentation.
You can also test the model's responses in the Chat window located at the bottom left of the editor.
Please note that this chat is intended for debugging purposes only. It does not represent the actual experience your end users will have. The formatting here is optimized for development and may include special tags or symbols. Your users will see clean, properly formatted responses as expected.

💬 Example Settings
Model
openai/gpt-4o
User Message
"Give me ideas for YouTube channels"
Temperature
0.7
Model
google/gemini-2.0-flash
User Message
"Write a summary of the latest Apple event"
📎 Links
Let us know what you build — we’d love to feature your workflows!
Last updated
Was this helpful?