UNPKG

hercai

Version:

A powerful library for interacting with the Herc.ai API

120 lines (99 loc) 4.18 kB
<p align="center"> <a href="#"> <img width=500 src="https://raw.githubusercontent.com/Bes-js/herc.ai/main/hercai-logo.png"></a></p> <a href="https://www.npmjs.com/package/nyro"> <p align="center"> <img src="https://raw.githubusercontent.com/Bes-js/nyro/refs/heads/main/assets/nyro_logo.png" align="center" width=200 height=100> <span align="center">Powered By Nyro</span> </p> </a> <a href="https://www.npmjs.com/package/nexorm"> <p align="center"> <span align="center">Recommends NexORM</span> <img src="https://raw.githubusercontent.com/Bes-js/nexorm/c00409595b8fccc21fbb5bd1f91089b110ccc0f4/assets/nexorm_logo.png" align="center" width=200 height=140> </p> </a> <p align="center"> <a href="https://render.com?ref=hercai"> <img width=200 height=90 src="https://raw.githubusercontent.com/Bes-js/herc.ai/main/render-logo.png"></a> </p> <p align="center"><img src="https://img.shields.io/npm/v/hercai?style=for-the-badge"> <img src="https://img.shields.io/github/repo-size/Bes-js/herc.ai?style=for-the-badge"> <img src="https://img.shields.io/npm/l/hercai?style=for-the-badge"> <img src="https://img.shields.io/npm/dt/hercai?style=for-the-badge"> <img src="https://img.shields.io/github/contributors/Bes-js/herc.ai?style=for-the-badge"> <img src="https://img.shields.io/github/package-json/dependency-version/Bes-js/herc.ai/nyro?style=for-the-badge"> <a href="https://discord.gg/luppux" target="_blank"> <img alt="Discord" src="https://img.shields.io/badge/Support-Click%20here-7289d9?style=for-the-badge&logo=discord"> </a><a href="https://www.buymeacoffee.com/beykant" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" width="120px" height="30px" alt="Buy Me A Coffee"></a></p> # [Herc.ai](https://discord.gg/luppux) > **A powerful library for interacting with the [Herc.ai](https://discord.gg/luppux) API.** > **We Offer It To You For Free.** > **[Herc.ai](https://discord.gg/luppux) Answers Your Question According To The Language, And It Supports All Languages.** # ### ❔ [Support](https://discord.gg/luppux) ### 📂 [NPM](https://npmjs.com/hercai) ### 📝 [Github](https://github.com/Bes-js/herc.ai) # **📂 Installation** ```bash npm i hercai yarn add hercai pnpm add hercai bun add hercai ``` # # Quick Example **Example Question For TypeScript;** ```ts 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;** ```ts 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](https://github.com/Bes-js) And [Luppux Development](https://github.com/Luppux)** <p align="center"> <a href="https://render.com?ref=hercai"> <img src="https://raw.githubusercontent.com/Bes-js/herc.ai/main/sponsor-logo.png"></a> </p> # Contact & Support [![Discord Banner](https://api.weblutions.com/discord/invite/luppux/)](https://discord.gg/luppux)