herc.ai
Hercai
用于与 Herc.ai API 交互的强大库。
我们免费为您提供。 Herc.ai 根据语言回答您的问题,并且支持所有语言。
一次性订阅即可无限享受 Hercai 的功能怎么样?通过 API 密钥使用 Hercai Unlimited!
? CLI 安装
npm i hercai -g
安装
npm i hercai
yarn add hercai
pnpm add hercai
bun add hercai
问题API; https://hercai.onrender.com/v3/hercai?question=
CommonJS 的示例问题;
/* Importing The Package */
const { Hercai } = require ( 'hercai' ) ;
const herc = new Hercai ( ) ; //new Hercai("your api key"); => Optional
/* Available Models */
/* "v3" , "v3-32k" , "turbo" , "turbo-16k" , "gemini" , "llama3-70b" , "llama3-8b" , "mixtral-8x7b" , "gemma-7b" , "gemma2-9b" */
/* Default Model; "v3" */
/* Premium Parameter; personality => Optional */
herc . question ( { model : "v3" , content : "hi, how are you?" } ) . then ( response => {
console . log ( response . reply ) ;
/* The module will reply based on the message! */
} ) ;
文本转图像API; https://hercai.onrender.com/v3/text2image?prompt=
CommonJS 绘制图像示例;
/* Importing The Package */
const { Hercai } = require ( 'hercai' ) ;
const herc = new Hercai ( ) ; //new Hercai("your api key"); => Optional
/* Available Models */
/* "v1" , "v2" , "v2-beta" , "v3" (DALL-E) , "lexica" , "prodia", "simurg", "animefy", "raava", "shonin" */
/* Default Model; "v3" */
herc . drawImage ( { model : "v3" , prompt : "anime girl" , negative_prompt : "" } ) . then ( response => {
console . log ( response . url ) ;
/* The module will reply based on the prompt! */
} ) ;
TypeScript 的示例接口和用法;
import { Hercai , QuestionData , DrawImageData } from "hercai" ;
const herc = new Hercai ( ) ; //new Hercai("your api key"); => Optional
/* Question Example For TypeScript */
herc . question ( { model : "v3" , content : "hi, how are you?" } )
. then ( ( response : QuestionData ) => {
console . log ( response . reply ) ;
} ) ;
/* DrawImage Example For TypeScript */
herc . drawImage ( { model : "v3" , prompt : "anime girl" , negative_prompt : "" } )
. then ( ( response : DrawImageData ) => {
console . log ( response . url ) ;
} ) ;
CLI 命令用法示例;
hercai < Your Question >
Herc.ai 还支持 TypeScript 和 EsModule?!
Beta 模型的用法示例;
import { Hercai } from "hercai" ;
const herc = new Hercai ( ) ; //new Hercai("your api key"); => Optional
herc . betaQuestion ( { content : "hi, how are you?" , user : 'chat-id' } )
. then ( ( response ) => {
console . log ( response . reply ) ;
} ) ;
/* DrawImage Example */
herc . betaDrawImage ( {
prompt : "anime girl" ,
negative_prompt : "" ,
sampler : "DPM-Solver" , /* Default => DPM-Solver */
image_style : "Null" , /* Default => Null */
width : 1024 , /* Default => 1024 */
height : 1024 , /* Default => 1024 */
steps : 20 , /* Default => 20 */
scale : 5 /* Default => 5 */
} ) . then ( ( response ) => {
console . log ( response . url ) ;
} ) ;
由 FiveSoBes 和 Luppux Development 制作