hiveminded-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

HiveMindedJS

HiveMindedJS is a credit management system designed to help AI developers quickly build applications without worrying about credit management. It provides a simple and intuitive API to manage credits for different users and sessions.

Installation

npm install hiveminded-js

Quickstart

Import HiveMinded.

import HiveMinded from 'hiveminded-js';

Initialize your app at the root of your project.

HiveMinded.init({organizationID: '<--- YOUR-ORG --->', namespace: '<--- YOUR-APP --->'});

Create a session (1 per user).

const session = HiveMinded.createSession({userID: 'my-user'});

You can then manage credits for this session using the following methods:

session.consume(1); // Consume 1 credit
session.refund(1); // Refund 1 credit
sesion.credits(); // Returns number of credits assigned to the user.

Example

session.consume(1);

try {

    // Your cool ai code here
    //...

} catch (err) {
    session.refund(1);
}

Package Sidebar

Install

npm i hiveminded-js

Weekly Downloads

11

Version

0.0.6

License

none

Unpacked Size

7.67 kB

Total Files

9

Last publish

Collaborators

  • hiveminded-dev