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

hercai

v14.0.3

Published

A powerful library for interacting with the Herc.ai API

Readme

Herc.ai

A powerful library for interacting with the Herc.ai API.

✨ Do You Want to Increase Your Herc.ai Limits? Click Here.

Support

📂 NPM

📝 Github

📂 Installation

npm i hercai
yarn add hercai
pnpm add hercai
bun add hercai

Quick Example

Example Client For TypeScript;

/* Import Package */
import { Hercai } from "hercai";

/* Initialize Client For Free Tier */
const hercai = new Hercai();

/* Initialize Client For Custom API Key */
const hercai = new Hercai({
    apiKey: 'YourSecretApiKey'
});

Example Stream Completions For TypeScript;

import { Hercai } from "hercai";
const hercai = new Hercai();

hercai.chat.completions.create({
    messages: [
        {
            role: 'user',
            content: 'Hi, How Are You?'
        },
        {
            role: 'assistant',
            content: 'I\'m just a computer program, so I don\'t have feelings, but thanks for asking. How can I assist you today?'
        },
        {
            role: 'user',
            content: [
                {
                    type: 'image',
                    image_url: {
                        url: 'base64:....'
                    }
                },
                {
                    type: 'text',
                    text: 'What Do You See In This Picture?'
                }
            ]
        }
    ],
    model: 'google/Gemma-3-12b-it',
    stream: true
}).then(async(streamResponse) => {

    for await (const chunk of streamResponse) {
        console.log(chunk.reply);
    }

});

Example Completions For TypeScript;

import { Hercai } from "hercai";
const hercai = new Hercai();

hercai.chat.completions.create({
    messages: [
        {
            role: 'user',
            content: 'Hi How Are You?'
        },
        {
            role: 'assistant',
            content: 'I\'m just a computer program, so I don\'t have feelings, but thanks for asking. How can I assist you today?'
        },
        {
            role: 'user',
            content: 'What Is The Best Programming Language?'
        }
    ],
    model: 'openai/GPT-4-32k-0613'
}).then((response) => {
    console.log(response.reply);
});

Example Draw Image For TypeScript;

import { Hercai } from "hercai";
import * as fs from 'fs';
const hercai = new Hercai();


hercai.images.generations({
    prompt: 'A Photo Of An Astronaut Riding A Horse.',
    negative_prompt: '',
    model: 'blackforestlabs/Flux-1.0',
    size: '1024x1024',
    seed: '45',
    response_format: 'buffer',
    steps: 50,
}).then(async(ImageBuffer) => {
    
    fs.writeFileSync('./hercai.png', ImageBuffer);

});

Example Audio Speech For TypeScript;

import { Hercai } from "hercai";
import * as fs from 'fs';
const hercai = new Hercai();


hercai.audio.speech.create({
    model: 'openai/Echo',
    input: 'Hello, how are you?',
    format: 'mp3',
}).then(async(AudioBuffer) => {
    
    fs.writeFileSync('./hercai.mp3', AudioBuffer);
    
});

Example Get Models For TypeScript;

import { Hercai } from "hercai";
const hercai = new Hercai();

/* For Completion Models */
hercai.chat.models.retrieve().then((models) => {
    console.log(models);
});

/* For Image Models */
hercai.images.models.retrieve().then((models) => {
    console.log(models);
});

/* For Audio Models */
hercai.audio.models.retrieve().then((models) => {
    console.log(models);
});

Example Get Rate Limits For TypeScript;

import { Hercai } from "hercai";
const hercai = new Hercai();

/* Get Rate Limits By Category */
hercai.ratelimits.retrieveByCategory('image').then((rateLimits) => {
    console.log(rateLimits);
});

/* Get Rate Limits By Model For Your Usage */
hercai.ratelimits.retrieveByModel('openai/GPT-4-32k-0613').then((rateLimits) => {
    console.log(rateLimits);
});

Example System Prompt For TypeScript;

/* 
  ⚠️ System Prompt Is Not Supported By All Models.
*/
import { Hercai } from "hercai";
const hercai = new Hercai();

hercai.chat.completions.create({
    messages: [
        {
            role: 'system',
            content: 'You are a helpful assistant.'
        },
        {
            role: 'user',
            content: 'Hi How Are You?'
        }
    ],
    model: 'openai/GPT-4-32k-0613'
}).then((response) => {
    console.log(response.reply);
});

API Reference

/* Chat Completions */
https://hercai.onrender.com/v1/chat/completions - POST

/* Image Generations */
https://hercai.onrender.com/v1/images/generations - POST

/* Audio Speech */
https://hercai.onrender.com/v1/audio/speech - POST

/* Models */
https://hercai.onrender.com/v1/chat/models - GET
https://hercai.onrender.com/v1/image/models - GET
https://hercai.onrender.com/v1/audio/models - GET

/* Rate Limits */
https://hercai.onrender.com/v1/ratelimits - GET
https://hercai.onrender.com/v1/ratelimits/:model - GET

Credits

Made by FiveSoBes And Luppux Development

Contact & Support

Discord Banner