JSPM

  • Created
  • Published
  • Downloads 99313
  • Score
    100M100P100Q154556F
  • License ISC

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hercai) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Powered By Nyro

    Recommends NexORM

    Discord Buy Me A Coffee

    Herc.ai

    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