novita-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.39 • Public • Published

Novita.ai Javascript SDK

This SDK is based on the official novita.ai API reference

Join our discord server for help:

Quick start

  1. Sign up on novita.ai and get an API key. Please follow the instructions at https://novita.ai/get-started

  2. Install the npm package in your project.

npm i novita-sdk

Usage

1. Functional usage

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);
  });

2. Class-based usage

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);
  });

API list and Sample codes

Type Definitions

For detailed information on the parameters and return types of each method, please refer to the types.ts file.

Playground

You can try all demos at https://novita.ai/playground

Package Sidebar

Install

npm i novita-sdk

Weekly Downloads

317

Version

1.0.39

License

ISC

Unpacked Size

295 kB

Total Files

11

Last publish

Collaborators

  • novitalabs