leonardoai-api

1.0.5 • Public • Published

LeonardoAI-API

A JavaScript library to use the Leonardo AI API.

Installation

$ npm install leonardoai-api

Get started

The library provides a set of classes and methods for accessing the various features of the API. The main classes are Leonardo, Generation, Image, and User.

const { Leonardo, Generation, Image, User } = require('leonardoai-api');

// Create the client
const leonardo = new Leonardo({ token: "..." });

// Get the generations (groups of images)
const generations = await leonardo.getGenerationFeed();

// Create a new generation (group of images)
const generation = await leonardo.createGeneration({
  prompt: 'a beautiful sunset over the ocean',
  quantity: 1,
  imageWidth: 512,
  imageHeight: 512,
});

// Get the generated images from the generation
const images = await generation.generated_images;

// Delete an image
await images[0].delete();

// Delete a generation
await generation.delete();

Package Sidebar

Install

npm i leonardoai-api

Weekly Downloads

40

Version

1.0.5

License

MIT

Unpacked Size

13.3 kB

Total Files

3

Last publish

Collaborators

  • mathis.alrc