Generate an image from a text prompt using the FLUX.1-schnell model. Returns a PNG image file.
Request Body:
| Parameter |
Type |
Required |
Description |
prompt |
string |
Yes |
Text description of the image to generate |
width |
integer |
No |
Image width in pixels (256-2048, default: 1024) |
height |
integer |
No |
Image height in pixels (256-2048, default: 576) |
guidance_scale |
float |
No |
Guidance scale for generation (1.0-20.0, default: 7.5) |
num_inference_steps |
integer |
No |
Number of inference steps (1-50, default: 4) |
Example cURL Request:
curl -X POST "http://localhost:8000/generate" \
-H "Content-Type: application/json" \
-d '{
"prompt": "3 well adorned African priests riding horses in early Jerusalem, following the stars, cinematic lighting, 4k",
"width": 1024,
"height": 576,
"guidance_scale": 7.5,
"num_inference_steps": 4
}' \
--output generated_image.png
Example Python Request:
import requests
response = requests.post(
"http://localhost:8000/generate",
json={
"prompt": "3 well adorned African priests riding horses in early Jerusalem, following the stars, cinematic lighting, 4k",
"width": 1024,
"height": 576,
"guidance_scale": 7.5,
"num_inference_steps": 4
}
)
with open("generated_image.png", "wb") as f:
f.write(response.content)
Generate a video from a text prompt using text-to-video models. Returns an MP4 video file.
Request Body:
| Parameter |
Type |
Required |
Description |
prompt |
string |
Yes |
Text description of the video to generate |
model |
string |
No |
Model to use (default: "Wan-AI/Wan2.2-T2V-A14B") |
Example cURL Request:
curl -X POST "http://localhost:8000/generate-video" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A young man walking on the street waving an Algerian flag, smiling",
"model": "Wan-AI/Wan2.2-T2V-A14B"
}' \
--output generated_video.mp4
Example Python Request:
import requests
response = requests.post(
"http://localhost:8000/generate-video",
json={
"prompt": "A young man walking on the street waving an Algerian flag, smiling",
"model": "Wan-AI/Wan2.2-T2V-A14B"
}
)
with open("generated_video.mp4", "wb") as f:
f.write(response.content)
Check API health status and verify HuggingFace token configuration.
Example cURL Request:
curl -X GET "http://localhost:8000/health"
Example Response:
{
"status": "healthy",
"hf_token_configured": true
}