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

13.0.0 • Public • Published

Powered By Nyro

Recommends NexORM

Discord Buy Me A Coffee

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

We Offer It To You For Free. Herc.ai Answers Your Question According To The Language, And It Supports All Languages.

Support

📂 NPM

📝 Github

📂 Installation

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

Quick Example

Example Question For TypeScript;

import { Hercai } from "hercai";
const hercai = new Hercai({
    apiKey: 'YourSecretAPIKey'
});

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: 'meta-llama/Llama-3.2-90b-Vision',
    stream: true
}).then(async(streamResponse) => {

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

});

Example Draw Image For TypeScript;

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


hercai.images.generations({
    prompt: 'a photo of an astronaut riding a horse',
    negative_prompt: '',
    model: '',
    size: '1024x1024',
    seed: '45',
    response_format: 'buffer',
    steps: 50,
}).then(async(ImageBuffer) => {
    
    fs.writeFileSync(ImageBuffer, './hercai.png');
    
});

Credits

Made by FiveSoBes And Luppux Development

Contact & Support

Discord Banner

Package Sidebar

Install

npm i hercai

Weekly Downloads

99,550

Version

13.0.0

License

GPL-3.0

Unpacked Size

51.9 kB

Total Files

23

Last publish

Collaborators

  • beykant