This SDK is based on the official novita.ai API reference
Join our discord server for help:
-
Sign up on novita.ai and get an API key. Please follow the instructions at https://novita.ai/get-started
-
Install the npm package in your project.
npm i novita-sdk
import { txt2ImgSync, setNovitaKey } from "novita-sdk";
setNovitaKey("your api key");
const params = {
model_name: "sd_xl_base_1.0.safetensors",
prompt: "1 girl",
};
txt2ImgSync(params)
.then((res) => {
console.log("imgs", res);
})
.catch((err) => {
console.error(err);
});
import { NovitaSDK } from "novita-sdk";
const novitaClient = new NovitaSDK("your api key");
const params = {
model_name: "sd_xl_base_1.0.safetensors",
prompt: "1 girl",
};
novitaClient
.txt2ImgSync(params)
.then((res) => {
console.log("imgs", res);
})
.catch((err) => {
console.error(err);
});
- txt2Img Deprecated, recommend using txt2ImgV3
- img2img Deprecated, recommend using img2ImgV3
- txt2ImgV3
- img2ImgV3
- upscale Deprecated, recommend using upscaleV3
- upscaleV3
- cleanup
- outpainting
- removeBackground
- replaceBackground
- mixPose
- doodle
- lcmTxt2Img
- replaceSky
- replaceObject
- mergeFace
- removeText
- restoreFace
- reimagine
- createTile
- LoRA
- controlNet
- img2video
For detailed information on the parameters and return types of each method, please refer to the types.ts file.
You can try all demos at https://novita.ai/playground