Skip to content

Latest commit

 

History

History
485 lines (329 loc) · 49.2 KB

README.md

File metadata and controls

485 lines (329 loc) · 49.2 KB

Generation

(generation)

Available Operations

createGeneration

This endpoint will generate images

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.createGeneration({});

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.CreateGenerationRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.CreateGenerationResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

createLCMGeneration

This endpoint will generate a LCM image generation.

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.createLCMGeneration({
    imageDataUrl: "<value>",
    prompt: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.CreateLCMGenerationRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.CreateLCMGenerationResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

createSVDMotionGeneration

This endpoint will generate a SVD motion generation.

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.createSVDMotionGeneration({
    imageId: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.CreateSVDMotionGenerationRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.CreateSVDMotionGenerationResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

createTextureGeneration

This endpoint will generate a texture generation.

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.createTextureGeneration({});

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.CreateTextureGenerationRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.CreateTextureGenerationResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

deleteGenerationById

This endpoint deletes a specific generation

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.deleteGenerationById("<value>");

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
id string ✔️ The ID of the generation to delete.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.DeleteGenerationByIdResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

deleteTextureGenerationById

This endpoint deletes the specific texture generation.

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.deleteTextureGenerationById("<value>", {});

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
id string ✔️ "id" is required (enter it either in parameters or request body)
requestBody operations.DeleteTextureGenerationByIdRequestBody Query parameters can also be provided in the request body as a JSON object
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.DeleteTextureGenerationByIdResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

getGenerationById

This endpoint will provide information about a specific generation

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.getGenerationById("<value>");

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
id string ✔️ The ID of the generation to return.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.GetGenerationByIdResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

getGenerationsByUserId

This endpoint returns all generations by a specific user

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.getGenerationsByUserId("<value>", 10, 0);

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
userId string ✔️ N/A
limit number N/A
offset number N/A
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.GetGenerationsByUserIdResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

performAlchemyUpscaleLCM

This endpoint will perform Alchemy Upscale on a LCM image

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.performAlchemyUpscaleLCM({
    imageDataUrl: "<value>",
    prompt: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.PerformAlchemyUpscaleLCMRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.PerformAlchemyUpscaleLCMResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

performInpaintingLCM

This endpoint will perform a inpainting on a LCM image

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.performInpaintingLCM({
    imageDataUrl: "<value>",
    maskDataUrl: "<value>",
    prompt: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.PerformInpaintingLCMRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.PerformInpaintingLCMResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /

performInstantRefine

This endpoint will perform instant refine on a LCM image

Example Usage

import { Leonardo } from "@leonardo-ai/sdk";

const leonardo = new Leonardo({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await leonardo.generation.performInstantRefine({
    imageDataUrl: "<value>",
    prompt: "<value>",
  });

  // Handle the result
  console.log(result)
}

run();

Parameters

Parameter Type Required Description
request operations.PerformInstantRefineRequestBody ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

Promise<operations.PerformInstantRefineResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /