node-red-contrib-chatgpt-api
v1.0.0
Published
A Node-RED node for interacting with the OpenAI ChatGPT API
Downloads
128
Maintainers
Readme
node-red-contrib-chatgpt-api
A Node-RED node for interacting with the OpenAI ChatGPT API. Supports creating prompts, retrieving models, and generating AI-driven completions.
Features
- Easily interact with OpenAI's ChatGPT API for intelligent, chat-based completions.
- Customize model, temperature, and token limits.
- Requires an OpenAI API key: Get yours from the OpenAI Platform.
- Lightweight implementation using Node.js's native https module.
Installation
Install the nodes directly through Node-RED's built-in palette manager.
Nodes
- gptapi: Calls the ChatGPT API to generate completions
- gptprompt: Helps construct the prompt.
- gptmodels: Retrieves the list of available models from the OpenAI API.
Usage
- Drag the gptapi node from the palette into your Node-RED workspace.
- Double-click the node to open the configuration panel:
- Enter your OpenAI API Key. If you don’t have one, visit the OpenAI Platform to generate it.
- Specify a model in the node or in the input payload, e.g., gpt-4.
- Optionally set values for temperature and maximum tokens.
- Use the gptmodels node to retrieve a list of available models.
- Use the gptprompt node to configure a multi-part structured prompt and pass it to the gptapi node as
msg.prompt
. - The gptapi node returns the API response in
msg.payload
.
Example Flow
The example flow demonstrates how to use the nodes together:
You can import it from the repository to get started quickly.