Integrate LumozAI's powerful AI models into your applications with our simple and robust API.
All API requests require authentication using your API key. You can find your API key in your account settings.
LumozAI uses Bearer Token authentication. Include your API key in the Authorization header for all API requests.
curl -X POST https://lumozai.com/api/v4/run \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-d "model_id=hidream-l1" \
-d "prompt=A beautiful sunset over mountains"
$apiKey = 'YOUR_API_KEY';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://lumozai.com/api/v4/run',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [
'model_id' => 'hidream-l1',
'prompt' => 'A beautiful sunset over mountains'
],
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Authorization: Bearer ' . $apiKey
]
]);
$response = curl_exec($curl);
curl_close($curl);
$result = json_decode($response, true);
Use this endpoint to run a model and generate outputs.
Parameter | Type | Required | Description |
---|---|---|---|
model_id | string | Required | The ID of the model to run (e.g., hidream-l1) |
webhook | string | Optional | URL to receive a callback when processing is complete |
Additional parameters vary by model. See the Models pages for model-specific parameters. |
{
"success": true,
"data": {
"request_id": 212121212121212,
"output": "https://lumozai.com/storage/outputs/image_12345.jpg",
"output_type": "image"
}
}
curl -X POST https://lumozai.com/api/v4/run \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-d "model_id=hidream-l1" \
-d "prompt=A beautiful sunset over mountains" \
-d "negative_prompt=blurry, low quality" \
-d "guidance_scale=7.5" \
-d "num_inference_steps=30"
Use this endpoint to check the status of a model run by its request ID.
Parameter | Type | Required | Description |
---|---|---|---|
request_id | integer | Required | The request ID returned from a previous run model call |
{
"success": true,
"data": {
"request_id": 212121212121212,
"status": "processing",
"progress": 45
}
}
{
"success": true,
"data": {
"request_id": 212121212121212,
"status": "completed",
"output": "https://lumozai.com/storage/outputs/image_12345.jpg",
"output_type": "image"
}
}
{
"success": false,
"data": {
"request_id": 212121212121212,
"status": "failed",
"error": "Model execution failed due to invalid parameters"
}
}
curl -X POST https://lumozai.com/api/v4/check \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Accept: application/json" \
-d "request_id=212121212121212"
Here are common errors you might encounter while using the LumozAI API.
HTTP Status Code | Error Code | Description |
---|---|---|
401 | authentication_failed | Invalid or missing API key |
403 | permission_denied | You don't have permission to access this resource |
404 | model_not_found | The requested model does not exist |
422 | validation_error | Invalid parameters provided |
429 | rate_limit_exceeded | You've exceeded your rate limit |
500 | internal_server_error | An unexpected error occurred on our servers |
{
"success": false,
"error": {
"code": "validation_error",
"message": "The model_id field is required.",
"details": {
"model_id": ["The model_id field is required."]
}
}
}
LumozAI API has rate limits to ensure fair usage for all users.
Rate limits vary based on your subscription plan. Each API response includes headers that provide information about your current rate limit status:
Header | Description |
---|---|
X-RateLimit-Limit | The maximum number of requests you're allowed to make per hour |
X-RateLimit-Remaining | The number of requests remaining in the current rate limit window |
X-RateLimit-Reset | The time at which the current rate limit window resets (Unix timestamp) |
For higher rate limits or custom requirements, please contact our sales team.