Create Universal OpenAI-Compatible API Endpoints for Multiple AI Workflows
N8n OpenAI-Compatible API Endpoints
Transform your n8n workflows into OpenAI-compatible API endpoints, allowing you to access multiple workflows as selectable AI models through a single integration.
What This Does
This workflow creates two API endpoints that mimic the OpenAI API structure:
/models - Lists all n8n workflows tagged with aimodel (or any other tag of your choice) /chat/completions - Executes chat completions with your selected workflows, supporting both text and stream responses
Benefits
Access Multiple Workflows: Connect to all your n8n agents through one API endpoint instead of creating separate pipelines for each workflow.
Universal Platform Support: Works with any application that supports OpenAI-compatible APIs, including OpenWebUI, Microsoft Teams, Zoho Cliq, and Slack.
Simple Workflow Management: Add new workflows by tagging them with aimodel . No code changes needed.
Streaming Support: Handles both standard responses and streaming for real-time agent interactions .
How to Use
Download the workflow JSON file from this repository Import it into your n8n instance Tag your workflows with aimodel to make them accessible through the API Create a new OpenAI credential in n8n and change the Base URL to point to your n8n webhook endpoints . Learn more about OpenAI Credentials Point your chat applications to your n8n webhook URL as if it were an OpenAI API endpoint
Requirements
n8n instance (self-hosted or cloud) Workflows you want to expose as AI models Any OpenAI-compatible chat application
Documentation
For detailed setup instructions and implementation guide, visit https://medium.com/@deleodufuye/how-to-create-openai-compatible-api-endpoints-for-multiple-n8n-workflows-803987f15e24.
Inspiration
This approach was inspired by Jimleuk’s workflow on n8n Templates.
Related Templates
USDT And TRC20 Wallet Tracker API Workflow for n8n
Overview This n8n workflow is specifically designed to monitor USDT TRC20 transactions within a specified wallet. It u...
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
Bulk Automated Google Drive Files Sharing and Direct Download Link Generation
This N8N workflow automates the process of sharing files from Google Drive. It includes OAuth2 authentication, batch pro...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments