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 製作