npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-openai-compatible-chat-trigger

v1.0.6

Published

OpenAI-compatible chat trigger and helper nodes for n8n.

Readme

OpenAI-Compatible Chat Trigger & Tools for n8n

A custom n8n community node package that lets you expose your n8n workflows as direct, OpenAI-compatible chatbot backends. Instead of exposing standard Webhook URLs and mapping custom endpoints, this plugin exposes standard OpenAI API endpoints (/v1/chat/completions, /v1/completions, /v1/models) natively, allowing you to connect n8n workflows directly to any external chatbot program or library that supports OpenAI-compatible APIs (such as LibreChat, Chatbox, etc.).


Key Features

  1. OpenAI-Compatible Chat Trigger Node:

    • Registers a wildcard path that catches POST requests for /v1/chat/completions and /v1/completions.
    • Directly answers GET requests for /v1/models without executing the workflow, returning a custom mock models list.
    • Built-in authorization support (Bearer API keys) that immediately responds with a 401 Unauthorized block to clients on validation failure.
    • Extracts prompt messages, historical chat messages, and the requested model name into easy-to-use variables (message, messages, model) for downstream nodes.
  2. OpenAI Completions Response Node:

    • Automatically packages generated text from your workflow into the standard OpenAI Chat Completion or Text Completion JSON schemas.
    • Exposes parameters to customize response model name, role, finish reason, and optional custom ID or created timestamp.
    • Feeds back cleanly to the Chat Trigger node when set to "When Last Node Finishes".

Installation

For Local Development & Testing

  1. Clone or download this repository.
  2. In the folder, compile the TypeScript code and copy assets:
    npm run build
  3. Navigate to your local n8n data directory (typically ~/.n8n/ on Linux/macOS or C:\Users\<Username>\.n8n\ on Windows).
  4. Create the nested directories if they do not exist:
    mkdir -p ~/.n8n/custom/node_modules/
  5. Copy or symlink your package directory (n8n-nodes-openai-compatible-chat-trigger) into that folder:
    # On Linux/macOS
    ln -s /path/to/n8n-nodes-openai-compatible-chat-trigger ~/.n8n/custom/node_modules/n8n-nodes-openai-compatible-chat-trigger
  6. Restart your n8n server. The new nodes will be discoverable in the node selector.

Node Configurations

1. OpenAI-Compatible Chat Trigger

  • Webhook Path Prefix (path): The custom namespace prefix. For example, setting this to my-bot creates these active endpoints:
    • POST /webhook/my-bot/v1/chat/completions (starts workflow)
    • POST /webhook/my-bot/v1/completions (starts workflow)
    • GET /webhook/my-bot/v1/models (immediate GET response list)
  • Response Mode (responseMode): Set to When Last Node Finishes (returns output of the final node) or Using Respond to Webhook Node.
  • Authentication (authentication): None or Header (Bearer Token). If set to header authentication, provide an API Key.
  • Mock Models (mockModels): Comma-separated list of models returned from the /v1/models endpoint (e.g. gpt-3.5-turbo, gpt-4o, my-n8n-agent).
  • Support File Uploads / Vision (supportFiles): Enable/disable parsing of base64 image/file payloads from the client message. Parses them into native n8n binary files.
  • Allowed File Types (allowedFileTypes): Comma-separated list of allowed MIME types (e.g., image/png, image/jpeg, image/webp). Non-matching files are skipped.
  • Support Tools / Function Calling (supportTools): Enable/disable tools. If disabled, incoming tool calling definitions are filtered out to prevent errors in downstream nodes.

2. OpenAI Completions Response

  • Response Type (responseType): Choose Chat Completions or Text Completions.
  • Response Text (text): The final text content to return to the caller (e.g. {{ $json.text }}).
  • Model Name (model): The model name value injected into the JSON metadata (e.g. gpt-3.5-turbo).
  • Message Role (role): Message role (e.g., assistant).
  • Finish Reason (finishReason): Standard OpenAI stop reasons (e.g., stop, length, content_filter).
  • Additional Fields: Optional custom ID and Unix epoch created timestamp overrides.

API Testing Examples

Ensure you use your Test URL when testing inside the n8n editor, and the Production URL when the workflow is published and activated.

1. Get Models List

curl -X GET "http://localhost:5678/webhook/openai-compatible/v1/models" \
     -H "Authorization: Bearer <your-api-key>"

2. Send Chat Completions Request

curl -X POST "http://localhost:5678/webhook/openai-compatible/v1/chat/completions" \
     -H "Authorization: Bearer <your-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
       "model": "gpt-4o",
       "messages": [
         {"role": "user", "content": "Hello chatbot, how are you?"}
       ]
     }'

License

This community node package is licensed under the MIT License.