FLUX1.1 [pro] is the standard for text-to-image generation with fast, reliable and consistently stunning results.
To generate an image from text, you’ll make a request to the /flux-pro-1.1 endpoint.
Key Features
Fast & Reliable State-of-the-art inference speeds with consistent, stunning results every time
Strong Prompt Adherence Proven baseline for accurate text-to-image generation that follows your prompts precisely
Scalable Generation Robust architecture ideal for high-volume, production-ready image generation
Competitive Pricing Superior image quality at just $0.04 per image
Examples of Image Generation with FLUX.1 [pro]
Using FLUX1.1 [pro] API for Text-to-Image Generation
Create a Request
Use the /flux-pro-1.1 endpoint for standard FLUX1.1 [pro] generation:
create_request.sh
create_request.py
request = $( curl -X POST \
'https://api.bfl.ai/v1/flux-pro-1.1' \
-H 'accept: application/json' \
-H "x-key: ${ BFL_API_KEY }" \
-H 'Content-Type: application/json' \
-d '{
"prompt": "A futuristic city skyline at sunset with flying cars",
"width": 1024,
"height": 1024
}' )
request_id = $( echo $request | jq -r .id )
polling_url = $( echo $request | jq -r .polling_url )
import requests
import os
request = requests.post(
'https://api.bfl.ai/v1/flux-pro-1.1' ,
headers = {
'accept' : 'application/json' ,
'x-key' : os.environ.get( "BFL_API_KEY" ),
'Content-Type' : 'application/json' ,
},
json = {
'prompt' : 'A futuristic city skyline at sunset with flying cars' ,
'width' : 1024 ,
'height' : 1024
}
).json()
print (request)
request_id = request[ "id" ]
polling_url = request[ "polling_url" ] # Use this URL for polling
Poll for Result
After submitting a request, you need to poll using the returned polling_url to retrieve the output when ready.
poll_result.sh
poll_result.py
while true ; do
sleep 0.5
result = $( curl -s -X 'GET' \
"${ polling_url }" \
-H 'accept: application/json' \
-H "x-key: ${ BFL_API_KEY }" )
status = $( echo $result | jq -r .status )
echo "Status: $status "
if [ " $status " == "Ready" ]; then
echo "Result: $( echo $result | jq -r .result.sample)"
break
elif [ " $status " == "Error" ] || [ " $status " == "Failed" ]; then
echo "Generation failed: $result "
break
fi
done
# This assumes that the `polling_url` variable is set.
import time
import os
import requests
while True :
time.sleep( 0.5 )
result = requests.get(
polling_url,
headers = {
'accept' : 'application/json' ,
'x-key' : os.environ.get( "BFL_API_KEY" ),
}
).json()
if result[ 'status' ] == 'Ready' :
print ( f "Image ready: { result[ 'result' ][ 'sample' ] } " )
break
elif result[ 'status' ] in [ 'Error' , 'Failed' ]:
print ( f "Generation failed: { result } " )
break
A successful response will be a JSON object containing the result, and result['sample'] is a signed URL for retrieval.
Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe.
FLUX1.1 [pro] Parameters
Parameter Type Default Description Required promptstring Text description of the desired image Yes widthinteger 1024 Image width in pixels No heightinteger 1024 Image height in pixels No prompt_upsamplingboolean false Enhance prompt for better results No seedinteger null Seed for reproducible results. Accepts any integer No safety_toleranceinteger 2 Content moderation level. Value ranges from 0 (most strict) to 6 (more permissive) No output_formatstring ”jpeg” Desired format of the output image. Can be “jpeg” or “png” No webhook_urlstring null URL for asynchronous completion notification. Must be a valid HTTP/HTTPS URL No webhook_secretstring null Secret for webhook signature verification, sent in the X-Webhook-Secret header No
Pricing
FLUX1.1 [pro] is available at $0.04 per image .