Skip to content

yonifra/ai-client

Repository files navigation

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

  1. 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).
  2. Installation:

    • Execute npm install ai-client in your project directory.
    • Import the code: import * as AIClient from 'ai-client'
  3. Initialization:

    • Create an instance of the AIClient class, passing your API key, desired model, and any optional parameters.
  4. 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.

Made with ❤️ by yonifra

About

An AI client for ChatGPT. Published as an NPM package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published