JSPM

  • Created
  • Published
  • Downloads 1612
  • Score
    100M100P100Q97910F
  • License ISC

Novita api sdk

Package Exports

  • novita-sdk
  • novita-sdk/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (novita-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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