leonardoai-api
v1.0.5
Published
This module is a Node.js wrapper for the Leonardo AI API. It provides an easy-to-use interface for generating images with the Leonardo AI platform.
Downloads
14
Maintainers
Readme
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();