Powered By Nyro
Recommends NexORM
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
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');
});
Made by FiveSoBes And Luppux Development