GET /api/v1/loras/{lora_id}/status
API version: v1.2.4
Check the upload/import status of a LoRA model.
Endpoint
Plain text
GET /api/v1/loras/{lora_id}/statusAuthentication
Required. Include your API key in the request header:
Plain text
X-API-Key: your-api-key-herePath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lora_id | string | Yes | UUID of the LoRA model |
Response
Pending/Downloading Status (200 OK)
JSON
{
"lora_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Custom Style",
"status": "downloading",
"created_at": "2024-01-15T10:30:00Z"
}Ready Status (200 OK)
JSON
{
"lora_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Custom Style",
"status": "ready",
"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,
"created_at": "2024-01-15T10:30:00Z"
}Failed Status (200 OK)
JSON
{
"lora_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Custom Style",
"status": "failed",
"error_message": "Failed to download file: Connection timeout",
"created_at": "2024-01-15T10:30:00Z"
}Response Fields
| Field | Type | Description |
|---|---|---|
lora_id | string | Unique UUID identifier |
name | string | Display name of the LoRA model |
status | string | Current status: pending, downloading, ready, failed |
high_noise_url | string | Storage URL of high noise file (only when ready) |
low_noise_url | string | Storage URL of low noise file (only when ready) |
file_size | integer | Total file size in bytes (only when ready) |
error_message | string | Error description (only when failed) |
created_at | string | ISO 8601 creation timestamp |
expires_at | string | ISO 8601 expiration timestamp |
expired | boolean | Whether the LoRA has expired |
Status Values
| Status | Description |
|---|---|
pending | Upload/import request received, processing queued |
downloading | Files being processed, uploaded, or downloaded |
ready | LoRA model ready for use in video generation |
failed | Upload/import failed (see error_message for details) |
Examples
Check Status (cURL)
cURL
curl -X GET "https://phosor.ai/api/v1/loras/550e8400-e29b-41d4-a716-446655440000/status" \
-H "X-API-Key: your-api-key"Poll Until Ready (Python)
Python
import requests
import time
def wait_for_lora_ready(lora_id, api_key, timeout=300, poll_interval=5):
"""
Wait for LoRA upload/import to complete.
Args:
lora_id: UUID of the LoRA model
api_key: Your API key
timeout: Maximum wait time in seconds
poll_interval: Time between status checks
Returns:
Status data dict if ready, None if failed or timeout
"""
start_time = time.time()
while time.time() - start_time < timeout:
response = requests.get(
f"https://phosor.ai/api/v1/loras/{lora_id}/status",
headers={"X-API-Key": api_key}
)
if response.status_code != 200:
print(f"Error checking status: {response.text}")
return None
status_data = response.json()
status = status_data["status"]
print(f"Status: {status}")
if status == "ready":
print("LoRA is ready!")
return status_data
elif status == "failed":
print(f"LoRA failed: {status_data.get('error_message')}")
return None
time.sleep(poll_interval)
print("Timeout waiting for LoRA to be ready")
return None
# Usage
result = wait_for_lora_ready(
"550e8400-e29b-41d4-a716-446655440000",
"your-api-key"
)
if result:
print(f"File size: {result['file_size']} bytes")JavaScript Example
JavaScript
async function checkLoraStatus(loraId, apiKey) {
const response = await fetch(
`https://phosor.ai/api/v1/loras/${loraId}/status`,
{
headers: { 'X-API-Key': apiKey }
}
);
if (response.ok) {
return await response.json();
} else {
throw new Error(await response.text());
}
}
async function waitForLoraReady(loraId, apiKey, timeoutMs = 300000) {
const startTime = Date.now();
while (Date.now() - startTime < timeoutMs) {
const status = await checkLoraStatus(loraId, apiKey);
console.log(`Status: ${status.status}`);
if (status.status === 'ready') {
return status;
} else if (status.status === 'failed') {
throw new Error(status.error_message || 'LoRA processing failed');
}
await new Promise(resolve => setTimeout(resolve, 5000));
}
throw new Error('Timeout waiting for LoRA to be ready');
}
// Usage
waitForLoraReady('550e8400-e29b-41d4-a716-446655440000', 'your-api-key')
.then(status => console.log('Ready!', status))
.catch(err => console.error('Failed:', err.message));Complete Upload and Use Flow
Python
import requests
import time
def upload_and_use_lora(high_noise_path, low_noise_path, name, prompt, api_key):
"""Complete flow: upload LoRA, wait for ready, generate video"""
# Step 1: Upload LoRA files
print("Uploading LoRA files...")
with open(high_noise_path, "rb") as high_f, open(low_noise_path, "rb") as low_f:
upload_response = requests.post(
"https://phosor.ai/api/v1/storage/lora/upload",
headers={"X-API-Key": api_key},
files={
"high_noise_file": high_f,
"low_noise_file": low_f
},
data={"name": name}
)
lora_id = upload_response.json()["lora_id"]
print(f"Upload started: {lora_id}")
# Step 2: Wait for LoRA to be ready
print("Waiting for processing...")
while True:
status_response = requests.get(
f"https://phosor.ai/api/v1/loras/{lora_id}/status",
headers={"X-API-Key": api_key}
)
status = status_response.json()["status"]
if status == "ready":
print("LoRA is ready!")
break
elif status == "failed":
print("LoRA processing failed")
return None
print(f" Status: {status}")
time.sleep(5)
# Step 3: Generate video with LoRA
print("Submitting video generation...")
submit_response = requests.post(
"https://phosor.ai/api/v1/inference/submit",
headers={
"X-API-Key": api_key,
"Content-Type": "application/json"
},
json={
"prompt": prompt,
"lora_id": lora_id,
"lora_scale": 0.8,
"num_frames": 81,
"frames_per_second": 16
}
)
request_id = submit_response.json()["request_id"]
print(f"Video generation started: {request_id}")
return request_id
# Usage
request_id = upload_and_use_lora(
"high_noise.safetensors",
"low_noise.safetensors",
"My Custom Style",
"A character walking in anime style",
"your-api-key"
)Error Responses
LoRA Not Found (404 Not Found)
JSON
{
"error": "LoRA not found",
"message": "No LoRA model found with the specified ID"
}Unauthorized (401 Unauthorized)
JSON
{
"error": "API key required",
"message": "X-API-Key header is required"
}