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

payload-plugin-ai-chat

v0.1.0-beta.3

Published

ChatGPT-like Plugin for Payload

Readme

🚀 AI Chat Payload Plugin

The AI Chat Payload Plugin is a plugin for Payload CMS that adds ChatGPT-like functionality to your collection. It enables seamless interaction with ChatGPT models within Payload and provides out-of-the-box chat completion and admin chat completion endpoints. This README file provides instructions on how to install and use the plugin.

⚠️ Please note that this plugin is still in development and may contain bugs or incomplete features. Your feedback and suggestions during the beta testing phase are highly appreciated.

📢 Feedback and Bug Reporting

During the beta testing phase, your feedback and bug reports play a crucial role in improving the plugin. If you encounter any issues, have suggestions for improvements, or need assistance, please open an issue on the GitHub repository. Your contributions will help make the AI Chat Payload Plugin more stable and reliable.

Thank you for participating in the beta testing phase of the AI Chat Payload Plugin! Your support and feedback are highly appreciated.

📥 Installation

You can install the AI Chat Payload Plugin using one of the following methods:

pnpm add payload-plugin-ai-chat
// or
yarn add payload-plugin-ai-chat
// or
npm i payload-plugin-ai-chat

Basic Usage

To use the AI Chat Payload Plugin, follow these steps:

  1. Add the plugin to the plugins array in your Payload config file.
  2. Configure the plugin options, including the collections you want to enable the AI Chat functionality for.
  3. Set other options such as the group name, group label, and defaults for AI chat parameters.
  4. Rename .env.example -> .env
  5. Set environment variable OPENAI_API_KEY. How to generate your API KEY ?

Here's an example of how to configure the plugin in your Payload config file:

import { buildConfig } from 'payload/config';
import { aiChat } from 'payload-plugin-ai-chat'

const config = buildConfig({
  collections: ['chats'],
  plugins: [
    aiChat({
      collections: ['chats'],
      groupName: 'aiChat',
      groupLabel: 'AI Chat',
      defaults: {
        model: 'gpt-3.5-turbo-16k',
        messageRole: 'user',
        temperature: 1,
        maxToken: 2_048,
        frequencyPenalty: 0,
        presencePenalty: 0,
      },
    })
  ]
});

export default config;

Options

The AI Chat Payload Plugin provides a set of configurable options to customize its functionality:

  • enabled (boolean | default: true): Flag to determine if the plugin functionality should be enabled or not.
  • collections (string[]): An array of collection slugs to enable the AI Chat functionality.
  • groupName (string | default: 'aiChat'): Name for the AI Chat group in your configuration.
  • groupLabel (string | default: 'AI Chat'): Display label for the AI Chat group in the Payload admin panel.
  • defaults (object): Set of default values for the AI Chat parameters.
    • model (string | default: 'gpt-3.5-turbo-16k'): Specifies which GPT model to use.
    • messageRole (string | default: 'user'): Role for the message (usually 'user' or 'assistant').
    • temperature (number | default: 1): Controls the randomness of the model's output.
    • maxToken (number | default: 2_048): Maximum number of tokens for the response.
    • frequencyPenalty (number | default: 0): Adjusts the likelihood of frequently used tokens appearing.
    • presencePenalty (number | default: 0): Adjusts the likelihood of new tokens appearing.

Make sure to have the OPENAI_API_KEY set in your environment variables for the plugin to work seamlessly. How to generate your API KEY ?

Development

To actively develop or debug this plugin, you can work directly within the dev directory of this repository or link your own project.

Internal Development

This repository includes a fully working, self-seeding instance of Payload. To spin up the dev, follow these steps:

  1. Clone the repository.
  2. Navigate to the root directory of the plugin repository and run yarn to install the dependencies.
  3. Navigate to the dev directory and run yarn to install the dev dependencies.
  4. Run yarn dev to start the dev server.
  5. Open http://localhost:3000/admin in your browser.
  6. Log in using the username [email protected] and password test.

The dev allows you to test and make changes to the plugin. Keep in mind that the dev database is automatically seeded on every startup, and any changes you make to the data will be destroyed each time you reboot the app.