
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Powered By Nyro
Recommends NexORM
A powerful library for interacting with the Herc.ai API.
📂 Installation
npm i hercai
yarn add hercai
pnpm add hercai
bun add hercai
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);
});
/* 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
Made by FiveSoBes And Luppux Development
FAQs
A powerful library for interacting with the Herc.ai API
The npm package hercai receives a total of 67,861 weekly downloads. As such, hercai popularity was classified as popular.
We found that hercai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.