Browse documentationList LoRAs

GET /api/v1/loras

API version: v1.2.4

List all available LoRA models.

Endpoint

Plain text
GET /api/v1/loras

Authentication

Required. Include your API key in the request header:

Plain text
X-API-Key: your-api-key-here

Query Parameters

ParameterTypeRequiredDescription
limitintegerNoNumber of results per page (default: 50)
offsetintegerNoPagination offset (default: 0)
include_historybooleanNoInclude 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

FieldTypeDescription
lorasarrayList of LoRA model objects
totalintegerTotal number of LoRA models available
limitintegerCurrent page size limit
offsetintegerCurrent pagination offset
uploaded_countintegerNumber of LoRAs this user has uploaded or imported
trained_countintegerReserved; always 0 for LoRAs created through this API
max_uploadedintegerMaximum LoRAs allowed per user (20)
max_trainedintegerReserved; not applicable to this API

LoRA Object Fields

FieldTypeDescription
lora_idstringUnique UUID identifier
file_idstringFile identifier (format: lora-{uuid})
user_idstringOwner's user UUID (null if public)
namestringDisplay name
descriptionstringDescription text
tagsarrayList of tags
default_scalefloatDefault LoRA strength (0.0-1.0)
high_noise_urlstringStorage URL of high noise file
low_noise_urlstringStorage URL of low noise file
file_sizeintegerTotal file size in bytes
usage_countintegerNumber of times used
created_atstringISO 8601 creation timestamp
last_used_atstringISO 8601 last usage timestamp (null if never used)
statusstringCurrent status: ready, pending, downloading, trained, failed, expired, deleted
error_messagestringError description (if failed)
sourcestringOrigin of the model. Always upload for LoRAs created through this API
expires_atstringISO 8601 expiration timestamp
expiredbooleanWhether 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_at descending (newest first)
  • Results are cached for improved performance
  • The user_id filter 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"
}