1.0.4 • Published 3 months ago
ai-client v1.0.4
ChatGPT Client: A Simple Node.js Interface
Introduction
This lightweight and easy-to-use Node.js library provides seamless integration with OpenAI's ChatGPT service, empowering you to add AI functionalities to your projects with minimal effort.
Key Features
- Intuitive Defaults: Smart defaults automatically fill in missing parameters, eliminating the need for complex configurations (e.g., selecting the optimal model).
- Readable Code: Well-structured code facilitates debugging and understanding.
- Compact Footprint: Currently resides in a single file, prioritizing a minimal code size (future expansion is possible).
Getting Started
Obtain an OpenAI API Key:
- Visit the OpenAI API page and create an account.
- Generate an API key (may require payment information as API calls incur costs).
Installation:
- Execute
npm install ai-client
in your project directory. - Import the code:
import * as AIClient from 'ai-client'
- Execute
Initialization:
- Create an instance of the
AIClient
class, passing your API key, desired model, and any optional parameters.
- Create an instance of the
Run Prompts:
- Run
AIClient.ask()
to trigger a ChatGPT API call passing the required params. - Tip: It's recommended that you store your API key in a
.env
file as API will incur costs.
- Run
Made with ❤️ by yonifra