Overview
n8n is an open-source workflow automation platform that supports calling large language models through AI nodes.
Configuration Steps
Add Credentials
Go to Settings → Credentials → Add Credential, select OpenAI API
Enter Credentials
- API Key:
sk-xxx
- Base URL:
https://crazyrouter.com/v1
Use in Workflows
Add an OpenAI node or AI Agent node and select the credentials you just created.
Workflow Examples
AI Chat Node
{
"node": "OpenAI Chat Model",
"parameters": {
"model": "gpt-4o",
"messages": [
{ "role": "user", "content": "{{ $json.input }}" }
]
}
}
AI Agent Workflow
- Trigger → AI Agent → Output
- Select the Crazyrouter credentials in the AI Agent node
- Configure tools (such as HTTP Request, Code, etc.)
Using HTTP Request Node
For more flexible control, you can use the HTTP Request node directly:
Method: POST
URL: https://crazyrouter.com/v1/chat/completions
Headers:
Authorization: Bearer sk-xxx
Content-Type: application/json
Body:
{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "{{ $json.input }}"}]
}
n8n’s AI Agent node supports tool calling (Function Calling) and can be combined with other n8n nodes to build complex automation workflows.