Access the power of FLUX.1-schnell model through our RESTful API
The FLUX Image Generator API allows you to generate images using the FLUX.1-schnell model programmatically. The API supports both base64 and raw image responses, making it suitable for various use cases.
You can optionally provide your Hugging Face token in the request body. If not provided, the default token will be used.
Check if the API is operational.
curl https://flux-image-generator-bdcdcphnhmbhg6et.centralindia-01.azurewebsites.net/health
{
"status": "healthy",
"version": "1.0.0"
}
Generate an image based on a text prompt.
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | The text description of the image you want to generate |
| width | integer | No | Image width in pixels (default: 1024, max: 2048) |
| height | integer | No | Image height in pixels (default: 768, max: 2048) |
| return_format | string | No | "base64" (default) or "raw" |
| hf_token | string | No | Your Hugging Face token |
curl -X POST "https://flux-image-generator-bdcdcphnhmbhg6et.centralindia-01.azurewebsites.net/generate-image" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a beautiful sunset",
"width": 1024,
"height": 768,
"return_format": "base64",
"hf_token": "your_token_here"
}'
curl -X POST "https://flux-image-generator-bdcdcphnhmbhg6et.centralindia-01.azurewebsites.net/generate-image" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a beautiful sunset",
"width": 1024,
"height": 768,
"return_format": "raw"
}' \
--output image.png
The API uses standard HTTP status codes:
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 500 | Internal Server Error |
The API is subject to Hugging Face's rate limits. Using your own token is recommended for consistent access to the service.