Skip to content

Latest commit

 

History

History
299 lines (204 loc) · 22.6 KB

File metadata and controls

299 lines (204 loc) · 22.6 KB

RealtimeCanvas

(realtimeCanvas)

Overview

Available Operations

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.realtimeCanvas.createLCMGeneration();

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

run();

Standalone function

The standalone function version of this method:

import { LeonardoCore } from "@leonardo-ai/sdk/core.js";
import { realtimeCanvasCreateLCMGeneration } from "@leonardo-ai/sdk/funcs/realtimeCanvasCreateLCMGeneration.js";

// Use `LeonardoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const leonardo = new LeonardoCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await realtimeCanvasCreateLCMGeneration(leonardo);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.CreateLCMGenerationResponse>

Errors

Error Type 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.realtimeCanvas.performAlchemyUpscaleLCM();

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

run();

Standalone function

The standalone function version of this method:

import { LeonardoCore } from "@leonardo-ai/sdk/core.js";
import { realtimeCanvasPerformAlchemyUpscaleLCM } from "@leonardo-ai/sdk/funcs/realtimeCanvasPerformAlchemyUpscaleLCM.js";

// Use `LeonardoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const leonardo = new LeonardoCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await realtimeCanvasPerformAlchemyUpscaleLCM(leonardo);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.PerformAlchemyUpscaleLCMResponse>

Errors

Error Type 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.realtimeCanvas.performInpaintingLCM();

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

run();

Standalone function

The standalone function version of this method:

import { LeonardoCore } from "@leonardo-ai/sdk/core.js";
import { realtimeCanvasPerformInpaintingLCM } from "@leonardo-ai/sdk/funcs/realtimeCanvasPerformInpaintingLCM.js";

// Use `LeonardoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const leonardo = new LeonardoCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await realtimeCanvasPerformInpaintingLCM(leonardo);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.PerformInpaintingLCMResponse>

Errors

Error Type 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.realtimeCanvas.performInstantRefine();

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

run();

Standalone function

The standalone function version of this method:

import { LeonardoCore } from "@leonardo-ai/sdk/core.js";
import { realtimeCanvasPerformInstantRefine } from "@leonardo-ai/sdk/funcs/realtimeCanvasPerformInstantRefine.js";

// Use `LeonardoCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const leonardo = new LeonardoCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await realtimeCanvasPerformInstantRefine(leonardo);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // 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.
options.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.PerformInstantRefineResponse>

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*