Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 5.72 KB

File metadata and controls

80 lines (54 loc) · 5.72 KB

PricingCalculator

(pricingCalculator)

Overview

Available Operations

pricingCalculator

This endpoint returns the cost used for generating images using a particular service type.

Example Usage

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

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

async function run() {
  const result = await leonardo.pricingCalculator.pricingCalculator();

  // 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 { pricingCalculatorPricingCalculator } from "@leonardo-ai/sdk/funcs/pricingCalculatorPricingCalculator.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 pricingCalculatorPricingCalculator(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.PricingCalculatorRequestBody ✔️ 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.PricingCalculatorResponse>

Errors

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