# Leap AI Integration via LowCodeAPI
## Overview
Leap AI is an AI image and video generation platform for creating visual content with fine-tuned models, image generation, and video remixing capabilities.
## Base Endpoint
```
https://api.lowcodeapi.com/leapai/
```
## Authentication
LowCodeAPI handles authentication automatically. You only need to:
1. **Sign up** at https://www.tryleap.ai/
2. **Connect your account** in LowCodeAPI dashboard
3. **Use your `api_token`** in all requests
The `api_token` is your LowCodeAPI authentication token. LowCodeAPI will automatically:
- Fetch your Leap AI API key from database
- Apply it to each request with proper Bearer token header
**Auth Type**: `API Key` (Bearer Token)
## API Categories
- Video Generation AI
- Fine-Tuning
- Generate Images
- Remix Images
- Projects
## Common Endpoints
### Category: Fine-Tuning
#### List All Models
**Method**: `GET` | **LowCodeAPI Path**: `/api/v1/images/models`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models?api_token={api_token}
```
**Description**: Get a list of all custom fine-tuned models in your account.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `returnInObject` | boolean | No | Whether to return as object (default) or array |
**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/leapai/api/v1/images/models?api_token=YOUR_API_TOKEN"
```
**Example Response**:
```json
{
"data": [
{
"id": "model_abc123",
"title": "My Custom Model",
"subjectKeyword": "my-style",
"status": "finished"
}
]
}
```
**Official Documentation**: https://docs.tryleap.ai/reference/listallmodels
---
#### Create Model
**Method**: `POST` | **LowCodeAPI Path**: `/api/v1/images/models`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models?api_token={api_token}
```
**Description**: Create a new fine-tuned model for custom image generation.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `title` | string | Yes | Name of the model to identify it |
| `subjectKeyword` | string | Yes | Keyword to trigger the style during inference |
| `subjectType` | string | No | What the model is learning (e.g., "person", "object") |
| `subjectIdentifier` | string | No | Random string replacing subject keyword at inference |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "My Art Style",
"subjectKeyword": "myart",
"subjectType": "style"
}'
```
**Official Documentation**: https://docs.tryleap.ai/reference/createmodel
---
#### Upload Image Samples Via Url
**Method**: `POST` | **LowCodeAPI Path**: `/api/v1/images/models/modelId/samples/url`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/samples/url?modelId={modelId}&api_token={api_token}
```
**Description**: Upload training images via URL for model fine-tuning.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `modelId` | string | Yes | The ID of the model to upload samples to |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `returnInObject` | boolean | No | Return as object (true) or array (false) |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `images` | array of strings | Yes | Array of image URLs to upload |
**Example Request**:
```bash
# modelId comes from Create Model response
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/samples/url?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"images": ["https://example.com/image1.jpg", "https://example.com/image2.jpg"]
}'
```
**Official Documentation**: https://docs.tryleap.ai/reference/samplescontroller_createurl
---
#### Queue Training Job
**Method**: `POST` | **LowCodeAPI Path**: `/api/v1/images/models/modelId/queue`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/queue?modelId={modelId}&api_token={api_token}
```
**Description**: Start training a fine-tuned model after uploading samples.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `modelId` | string | Yes | The ID of the model to train |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `baseWeightsId` | string | Yes | Base model weights (default: Stable Diffusion v1.5) |
| `steps` | number | No | Number of training steps (more = better quality) |
| `webhookUrl` | string | No | URL to call when training completes |
**Example Request**:
```bash
# Start training after uploading samples
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/queue?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"baseWeightsId": "sd-1.5",
"steps": 500
}'
```
**Official Documentation**: https://docs.tryleap.ai/reference/queuetrainingjob
---
### Category: Generate Images
#### Generate an image using a text prompt
**Method**: `POST` | **LowCodeAPI Path**: `/api/v1/images/models/modelId/inferences`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences?modelId={modelId}&api_token={api_token}
```
**Description**: Generate images using a fine-tuned model or base model.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `modelId` | string | Yes | The ID of the model to use for generation |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `prompt` | string | Yes | Text description of the image to generate |
| `numberOfImages` | number | No | Number of images to generate (max 20) |
| `width` | number | No | Image width in pixels (must be multiple of 8) |
| `height` | number | No | Image height in pixels (must be multiple of 8) |
| `steps` | number | No | Number of diffusion steps |
| `scale` | number | No | Prompt strength (0-30) |
| `seed` | number | No | Random seed for reproducibility |
| `webhookUrl` | string | No | URL to call when generation completes |
| `negativePrompt` | string | No | Things to avoid in the image |
| `enhancePrompt` | boolean | No | Automatically enhance the prompt |
| `upscaleBy` | string | No | Upscale factor (x1-x4) |
| `restoreFaces` | boolean | No | Apply face restoration |
**Example Request**:
```bash
# Generate image with custom model
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A photo of an astronaut riding a horse in myart style",
"numberOfImages": 4,
"width": 1024,
"height": 1024,
"steps": 50
}'
```
**Example Response**:
```json
{
"data": {
"id": "inference_123",
"status": "processing",
"images": []
}
}
```
**Official Documentation**: https://docs.tryleap.ai/reference/inferencescontroller_create-1
---
#### Get a single inference job
**Method**: `GET` | **LowCodeAPI Path**: `/api/v1/images/models/modelId/inferences/inferenceId`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences/inferenceId?modelId={modelId}&inferenceId={inferenceId}&api_token={api_token}
```
**Description**: Retrieve the status and results of an image generation job.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `modelId` | string | Yes | The ID of the model used for generation |
| `inferenceId` | string | Yes | The inference job ID from generation response |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
# Check inference status - inferenceId returned from generation request
curl -X GET "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences/inferenceId?modelId=MODEL_ID&inferenceId=INFERENCE_ID&api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.tryleap.ai/reference/inferencescontroller_findone-1
---
### Category: Remix Images
#### Remix Image Via URL
**Method**: `POST` | **LowCodeAPI Path**: `/api/v1/images/models/modelId/remix/url`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/remix/url?modelId={modelId}&api_token={api_token}
```
**Description**: Transform an existing image using AI while preserving key elements.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `modelId` | string | Yes | The ID of the model to use |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `imageUrl` | string | Yes | URL of the source image (must be public) |
| `prompt` | string | Yes | Text describing the transformation |
| `numberOfImages` | number | No | How many images to generate |
| `mode` | string | No | Segmentation mode for the transformation |
| `seed` | number | No | Random seed for reproducibility |
| `steps` | number | No | Number of diffusion steps |
| `webhookUrl` | string | No | URL to call when remix completes |
| `negativePrompt` | string | No | Things to avoid in the remix |
**Example Request**:
```bash
# Remix an image with new style
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/remix/url?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/original.jpg",
"prompt": "Transform into a watercolor painting style",
"numberOfImages": 2
}'
```
**Official Documentation**: https://docs.tryleap.ai/reference/controlcontroller_createwithurl
---
#### Get a Remix job by ID
**Method**: `GET` | **LowCodeAPI Path**: `/api/v1/images/models/modelId/remix/remixId`
**Full URL**:
```
https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/remix/remixId?modelId={modelId}&remixId={remixId}&api_token={api_token}
```
**Description**: Retrieve the status and results of a remix job.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `modelId` | string | Yes | The ID of the model |
| `remixId` | string | Yes | The remix job ID |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
# remixId returned from remix request
curl -X GET "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/remix/remixId?modelId=MODEL_ID&remixId=REMIX_ID&api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.tryleap.ai/reference/controlcontroller_findone
---
## Usage Examples
### Example 1: Create and Train a Custom Model
Complete workflow for fine-tuning your own image generation model.
```bash
# Step 1: Create a new model
# Returns modelId needed for subsequent steps
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "My Pet Portraits",
"subjectKeyword": "mypet",
"subjectType": "animal"
}'
# Step 2: Upload training images via URL
# Use the modelId from Step 1 response
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/samples/url?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"images": [
"https://example.com/pet1.jpg",
"https://example.com/pet2.jpg",
"https://example.com/pet3.jpg"
]
}'
# Step 3: Queue training job
# Start the fine-tuning process with uploaded samples
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/queue?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"baseWeightsId": "sd-1.5",
"steps": 1000
}'
# Step 4: Generate images with trained model
# Once training is complete, generate new images
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A mypet cat wearing a space suit on Mars",
"numberOfImages": 4,
"width": 1024,
"height": 1024
}'
```
### Example 2: Generate and Check Image Status
Generate images and monitor the job status.
```bash
# Generate images with base model or custom model
# Returns inferenceId to check status later
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city at sunset in cyberpunk style",
"numberOfImages": 2,
"steps": 50,
"upscaleBy": "x2"
}'
# Check inference status using returned inferenceId
# Poll this endpoint until status shows as finished
curl -X GET "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/inferences/inferenceId?modelId=MODEL_ID&inferenceId=INFERENCE_ID&api_token=YOUR_API_TOKEN"
```
### Example 3: Remix Existing Images
Transform images while preserving key elements.
```bash
# Start a remix job with source image URL
# Returns remixId to check status
curl -X POST "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/remix/url?modelId=MODEL_ID&api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/original-photo.jpg",
"prompt": "Convert to oil painting style with vibrant colors",
"numberOfImages": 3,
"mode": "object"
}'
# Check remix status
# remixId returned from previous response
curl -X GET "https://api.lowcodeapi.com/leapai/api/v1/images/models/modelId/remix/remixId?modelId=MODEL_ID&remixId=REMIX_ID&api_token=YOUR_API_TOKEN"
```
## Complete Endpoint Reference
For a complete list of all endpoints and their parameters, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/leapai/definition`
- **Official Provider Documentation**: https://docs.tryleap.ai/api-reference/getting-started
## Rate Limits & Best Practices
- Training jobs can take several minutes to complete
- Use webhook URLs for async job completion notifications
- Higher step counts improve quality but take longer
- Image dimensions must be multiples of 8
- Check job status before attempting to download results
## Error Handling
Standard HTTP status codes apply. Training and generation jobs return job IDs that can be used to check status and retrieve results when ready.