@leap-ai/sdk
The Official Leap API
Installing
npm
npm install @leap-ai/sdk --save
yarn
yarn add @leap-ai/sdk
Important note: this library can be used in both the client-side or server-side, but using it in client-side browser code is not recommended as you would expose security credentials.
Getting Started
import { Leap } from "@leap-ai/sdk";
const leap = new Leap({
// Defining the base path is optional and defaults to https://api.tryleap.ai
// basePath: "https://api.tryleap.ai",
accessToken: "ACCESS_TOKEN",
});
const generateResponse = await leap.images.generate({
modelId: "modelId_example",
prompt: "A photo of an astronaut riding a horse",
negativePrompt: "asymmetric, bad hands, bad hair",
steps: 50,
width: 1024,
height: 1024,
numberOfImages: 1,
promptStrength: 7,
seed: 4523184,
});
console.log(generateResponse);
Documentation for API Endpoints
All URIs are relative to https://api.tryleap.ai
Tag | Method | HTTP request | Description |
---|---|---|---|
Images | generate | POST /api/v1/images/models/{modelId}/inferences | Generate an Image |
Images | delete | DELETE /api/v1/images/models/{modelId}/inferences/{inferenceId} | Delete Image Job |
Images | findOne | GET /api/v1/images/models/{modelId}/inferences/{inferenceId} | Get Single Image Job |
Images | listAll | GET /api/v1/images/models/{modelId}/inferences | List All Image Jobs |
Image Models | deleteModel | DELETE /api/v2/images/models/{modelId} | Delete a Model |
Image Models | getModel | GET /api/v2/images/models/{modelId} | Get a Single Model |
Image Models | listAllModels | GET /api/v2/images/models | List All Models |
Image Models | trainModel | POST /api/v2/images/models/new | Train Model |
Music | findOne | GET /api/v1/music/{inferenceId} | Get a Music Generation Job |
Music | generate | POST /api/v1/music | Generate Music |
Music | listAll | GET /api/v1/music | List Music Generation Jobs |
Author
This TypeScript package is automatically generated by Konfig