GET /api/v1/loras
API version: v1.2.4
List all available LoRA models.
Endpoint
Plain text
GET /api/v1/lorasAuthentication
Required. Include your API key in the request header:
Plain text
X-API-Key: your-api-key-hereQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Number of results per page (default: 50) |
offset | integer | No | Pagination offset (default: 0) |
include_history | boolean | No | Include deleted/failed/expired LoRAs (default: false) |
Response
Success (200 OK)
JSON
{
"loras": [
{
"lora_id": "550e8400-e29b-41d4-a716-446655440000",
"file_id": "lora-550e8400-e29b-41d4-a716-446655440000",
"user_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "Anime Style LoRA",
"description": "Custom trained for anime-style character generation",
"tags": ["anime", "character", "style"],
"default_scale": 0.8,
"high_noise_url": "https://s3.amazonaws.com/bucket/lora/high_noise.safetensors",
"low_noise_url": "https://s3.amazonaws.com/bucket/lora/low_noise.safetensors",
"file_size": 524288000,
"usage_count": 42,
"created_at": "2024-01-15T10:30:00Z",
"last_used_at": "2024-01-20T14:25:00Z"
}
],
"total": 15,
"limit": 50,
"offset": 0,
"uploaded_count": 5,
"trained_count": 3,
"max_uploaded": 20,
"max_trained": 20
}Response Fields
| Field | Type | Description |
|---|---|---|
loras | array | List of LoRA model objects |
total | integer | Total number of LoRA models available |
limit | integer | Current page size limit |
offset | integer | Current pagination offset |
uploaded_count | integer | Number of LoRAs this user has uploaded or imported |
trained_count | integer | Reserved; always 0 for LoRAs created through this API |
max_uploaded | integer | Maximum LoRAs allowed per user (20) |
max_trained | integer | Reserved; not applicable to this API |
LoRA Object Fields
| Field | Type | Description |
|---|---|---|
lora_id | string | Unique UUID identifier |
file_id | string | File identifier (format: lora-{uuid}) |
user_id | string | Owner's user UUID (null if public) |
name | string | Display name |
description | string | Description text |
tags | array | List of tags |
default_scale | float | Default LoRA strength (0.0-1.0) |
high_noise_url | string | Storage URL of high noise file |
low_noise_url | string | Storage URL of low noise file |
file_size | integer | Total file size in bytes |
usage_count | integer | Number of times used |
created_at | string | ISO 8601 creation timestamp |
last_used_at | string | ISO 8601 last usage timestamp (null if never used) |
status | string | Current status: ready, pending, downloading, trained, failed, expired, deleted |
error_message | string | Error description (if failed) |
source | string | Origin of the model. Always upload for LoRAs created through this API |
expires_at | string | ISO 8601 expiration timestamp |
expired | boolean | Whether the LoRA has expired |
Examples
List All LoRAs (cURL)
cURL
curl -X GET "https://phosor.ai/api/v1/loras" \
-H "X-API-Key: your-api-key"List User's LoRAs (Python)
Python
import requests
response = requests.get(
"https://phosor.ai/api/v1/loras",
headers={"X-API-Key": "your-api-key"},
params={"user_id": "your-user-id"}
)
result = response.json()
print(f"Found {result['total']} LoRA models")
for lora in result["loras"]:
print(f"- {lora['name']} (ID: {lora['lora_id']})")
print(f" Usage count: {lora['usage_count']}")
print(f" Default scale: {lora['default_scale']}")Paginated Listing
Python
import requests
def get_all_loras(api_key, page_size=50):
"""Fetch all LoRA models with pagination"""
all_loras = []
offset = 0
while True:
response = requests.get(
"https://phosor.ai/api/v1/loras",
headers={"X-API-Key": api_key},
params={"limit": page_size, "offset": offset}
)
result = response.json()
all_loras.extend(result["loras"])
if offset + page_size >= result["total"]:
break
offset += page_size
return all_loras
# Usage
loras = get_all_loras("your-api-key")
print(f"Total LoRA models: {len(loras)}")Filter and Display
Python
import requests
def list_loras_by_tag(api_key, tag):
"""List LoRA models filtered by tag"""
response = requests.get(
"https://phosor.ai/api/v1/loras",
headers={"X-API-Key": api_key}
)
result = response.json()
# Filter by tag (client-side filtering)
filtered = [
lora for lora in result["loras"]
if tag in (lora.get("tags") or [])
]
return filtered
# Usage
anime_loras = list_loras_by_tag("your-api-key", "anime")
for lora in anime_loras:
print(f"{lora['name']}: {lora['lora_id']}")JavaScript Example
JavaScript
async function listLoras(apiKey, userId = null) {
const params = new URLSearchParams();
if (userId) {
params.append('user_id', userId);
}
const url = `https://phosor.ai/api/v1/loras?${params}`;
const response = await fetch(url, {
headers: {
'X-API-Key': apiKey
}
});
if (response.ok) {
const result = await response.json();
console.log(`Found ${result.total} LoRA models`);
return result.loras;
} else {
console.error('Failed to list LoRAs:', await response.text());
return [];
}
}
// Usage
listLoras('your-api-key').then(loras => {
loras.forEach(lora => {
console.log(`${lora.name} (${lora.lora_id})`);
});
});Select LoRA for Video Generation
Python
import requests
def select_lora_for_generation(api_key, style_preference):
"""Select the most suitable LoRA based on style preference"""
# Get all available LoRAs
response = requests.get(
"https://phosor.ai/api/v1/loras",
headers={"X-API-Key": api_key}
)
loras = response.json()["loras"]
# Find matching LoRA
for lora in loras:
if style_preference.lower() in lora["name"].lower():
return lora
if lora.get("tags") and style_preference.lower() in [t.lower() for t in lora["tags"]]:
return lora
return None
# Usage
lora = select_lora_for_generation("your-api-key", "anime")
if lora:
print(f"Using LoRA: {lora['name']} with scale {lora['default_scale']}")
# Submit video generation with this LoRA
response = requests.post(
"https://phosor.ai/api/v1/inference/submit",
headers={
"X-API-Key": "your-api-key",
"Content-Type": "application/json"
},
json={
"prompt": "A character walking in a park",
"lora_id": lora["lora_id"],
"lora_scale": lora["default_scale"]
}
)Notes
- Only LoRA models with
status='ready'are returned - Results are ordered by
created_atdescending (newest first) - Results are cached for improved performance
- The
user_idfilter is optional; without it, all accessible LoRAs are returned
Error Responses
Unauthorized (401 Unauthorized)
JSON
{
"error": "API key required",
"message": "X-API-Key header is required"
}