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

v0.0.1

Published

n8n node for OpenAI-compatible models

Readme

n8n OpenAI Compatible Node

This n8n node allows you to interact with any OpenAI-compatible API service like qwen etc. It supports both chat completions and text completions, making it compatible with various AI model providers that follow the OpenAI API specification.

Features

  • Chat Completions: Generate responses using the chat completion endpoint (/v1/chat/completions)
  • Text Completions: Generate text using the completion endpoint (/v1/completions)
  • Flexible Configuration: Configure base URL, model, and API key for any OpenAI-compatible service
  • Advanced Parameters: Support for temperature, max tokens, top-p, frequency penalty, presence penalty, and stop sequences
  • Error Handling: Robust error handling with continue-on-fail support

Supported Services

This node works with any service that implements the OpenAI API specification, including:

  • OpenAI API
  • Azure OpenAI
  • Anthropic Claude (via OpenAI-compatible wrapper)
  • Local models (Ollama, LM Studio, etc.)
  • Other OpenAI-compatible providers

Installation

Manual Installation

  1. Clone or download this repository
  2. Install dependencies:
    npm install
  3. Build the node:
    npm run build
  4. Copy the dist folder to your n8n custom nodes directory:
    cp -r dist ~/.n8n/custom/
  5. Restart n8n

Using npm

npm install n8n-nodes-openai-compatible-node

Usage

1. Configure Credentials

  1. In n8n, go to SettingsCredentials
  2. Click Add Credential
  3. Search for "OpenAI Compatible API"
  4. Configure:
    • Base URL: The base URL of your OpenAI-compatible service (e.g., https://api.openai.com, https://your-service.com)
    • API Key: Your API key for the service

2. Add the Node

  1. In your workflow, add the "OpenAI Compatible" node
  2. Select the credentials you created
  3. Choose the operation:
    • Chat Completion: For conversational AI responses
    • Text Completion: For text generation

3. Configure Parameters

Chat Completion

  • Model: The model name (e.g., gpt-3.5-turbo, gpt-4)
  • Messages: Array of messages with role (system, user, assistant) and content
  • Additional Fields: Optional parameters like temperature, max tokens, etc.

Text Completion

  • Model: The model name (e.g., text-davinci-003)
  • Prompt: The text prompt to complete
  • Additional Fields: Optional parameters like temperature, max tokens, etc.

4. Advanced Parameters

  • Temperature (0-2): Controls randomness. Lower values = more deterministic
  • Max Tokens: Maximum number of tokens to generate
  • Top P (0-1): Controls diversity via nucleus sampling
  • Frequency Penalty (-2 to 2): Penalizes new tokens based on frequency
  • Presence Penalty (-2 to 2): Penalizes new tokens based on presence
  • Stop: Sequences where generation stops

Examples

Chat Completion Example

{
  "operation": "chatCompletion",
  "model": "gpt-3.5-turbo",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ],
  "temperature": 0.7,
  "max_tokens": 1000
}

Text Completion Example

{
  "operation": "textCompletion",
  "model": "text-davinci-003",
  "prompt": "Write a short story about a robot learning to paint.",
  "temperature": 0.8,
  "max_tokens": 500
}

Configuration Examples

OpenAI API

  • Base URL: https://api.openai.com
  • API Key: Your OpenAI API key

Azure OpenAI

  • Base URL: https://your-resource.openai.azure.com/openai/deployments/your-deployment
  • API Key: Your Azure OpenAI API key

Local Ollama

  • Base URL: http://localhost:11434/v1
  • API Key: (leave empty or use any value)

Anthropic Claude (via OpenAI wrapper)

  • Base URL: https://api.anthropic.com/v1
  • API Key: Your Anthropic API key

Development

Prerequisites

  • Node.js 16+
  • npm or yarn
  • n8n development environment

Setup

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build: npm run build
  4. Link to n8n: npm link (in n8n directory)

Scripts

  • npm run build: Build the node
  • npm run dev: Watch mode for development
  • npm run lint: Run ESLint
  • npm run format: Format code with Prettier

Troubleshooting

Common Issues

  1. "Base URL and API Key are required"

    • Ensure both fields are filled in the credentials
  2. "At least one message is required for chat completion"

    • Add at least one message in the Messages section
  3. "Prompt is required for text completion"

    • Add a prompt in the Prompt field
  4. Authentication errors

    • Verify your API key is correct
    • Check if the base URL is accessible

Debug Mode

Enable debug logging in n8n to see detailed request/response information.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  • Create an issue on GitHub
  • Check the n8n documentation
  • Join the n8n community