Skip to main content

Create universal OpenAI-compatible API endpoints for multiple AI workflows

Workflow preview

Workflow preview
100%
Create universal OpenAI-compatible API endpoints for multiple AI workflows preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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...

Best for

  • Engineering automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.aggregate, n8n-nodes-base.respondtowebhook, n8n-nodes-base.webhook, n8n-nodes-base.stickynote, n8n-nodes-base.n8n, n8n-nodes-base.set, n8n-nodes-base.code, n8n-nodes-base.if

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Dele Odufuye.

Original n8n.io source

1.1 Workflow description

Title
Create universal OpenAI-compatible API endpoints for multiple AI workflows
Workflow name
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

  1. Download the workflow JSON file from this repository
  2. Import it into your n8n instance
  3. Tag your workflows with aimodel to make them accessible through the API
  4. Create a new OpenAI credential in n8n and change the Base URL to point to your n8n webhook endpoints . Learn more about OpenAI Credentials
  5. 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.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 2 - Models Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.2

Block 3 - GET models

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 4 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Get many workflows

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 7 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - POST ChatCompletions

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 9 - Remap to Response API Schema

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Format Completion Response

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - JSON Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.2

Block 12 - Text Response

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.2

Block 13 - Format Stream Response

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Is Stream?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 15 - Call workflow webhook

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 16 - Call workflow webhook1

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 17 - n8n Webhooks

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 18 - When chat message received

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.1

Block 19 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Powered By n8n Workflow Models

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 21 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

3. Summary Table

Workflow Create universal OpenAI-compatible API endpoints for multiple AI workflows
Complexity advanced
Nodes 21
Categories Engineering, AI Chatbot
Author Dele Odufuye
Published 09 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9438/9438.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create universal OpenAI-compatible API endpoints for multiple AI workflows do?

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 do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Chatbot use case.