Skip to content

Flux

MaaS_Flux_Pro_1.1 / MaaS_Flux.1_Kontext

Creating Image Generation Tasks

Request Path

POST https://genaiapi.cloudsway.net/v1/ai/{endpoint}/flux/image/generate

Input Parameters

MaaS_Flux_Pro_1.1 Image Generation

Parameter Type Default Value Required Description
prompt string Yes Text description of the desired image
width integer 1024 No Image width in pixels
height integer 1024 No Image height in pixels
prompt_upsampling boolean FALSE No Enhance the prompt for better results
seed integer null No Seed for reproducible results. Accepts any integer
safety_tolerance integer 2 No Content moderation level. Value ranges from 0 (strictest) to 6 (more lenient)
output_format string "jpeg" No Desired format of the output image. Can be "jpeg" or "png".
webhook_url string null No URL for asynchronous completion notifications. Must be a valid HTTP/HTTPS URL
webhook_secret string null No Secret for webhook signature verification, sent in the X-Webhook-Secret header

MaaS_Flux.1_Kontext Image Generation

Note: MaaS_Flux.1_Kontext creates 1024x1024 images by default. Use aspect_ratio to adjust dimensions while keeping the total number of pixels unchanged.

Parameter Type Default Value Required Description
prompt string Yes Text description of the desired image
aspect_ratio string "1:1" No Desired aspect ratio (e.g., "16:9"). All outputs total approximately 1MP. Ratios from 3:7 to 7:3 are supported
seed integer null No Seed for reproducibility. If null, a random seed is used. Accepts any integer
prompt_upsampling boolean FALSE No If true, perform upsampling on the prompt
safety_tolerance integer 2 No Moderation level for input and output. Value ranges from 0 (strictest) to 6 (more lenient)
output_format string "jpeg" No Desired format of the output image. Can be "jpeg" or "png".
webhook_url string null No URL for asynchronous completion notifications. Must be a valid HTTP/HTTPS URL
webhook_secret string null No Secret for webhook signature verification, sent in the X-Webhook-Secret header

MaaS_Flux.1_Kontext Image Editing

Note: MaaS_Flux.1_Kontext will try to stay as close as possible to the input image dimensions (rounded to multiples of 32). Use aspect_ratio to override this behavior if needed.

Parameter Type Default Value Required Description
prompt string Yes Text description of the desired image
input_image string Yes Base64-encoded image to use as reference. Maximum support for 20MB or 20 million pixels
aspect_ratio string "1:1" No Desired aspect ratio (e.g., "16:9"). All outputs total approximately 1MP. Ratios from 3:7 to 7:3 are supported
seed integer null No Seed for reproducibility. If null, a random seed is used. Accepts any integer
prompt_upsampling boolean FALSE No If true, perform upsampling on the prompt
safety_tolerance integer 2 No Moderation level for input and output. Value ranges from 0 (strictest) to 6 (more lenient)
output_format string "jpeg" No Desired format of the output image. Can be "jpeg" or "png".
webhook_url string null No URL for asynchronous completion notifications. Must be a valid HTTP/HTTPS URL
webhook_secret string null No Secret for webhook signature verification, sent in the X-Webhook-Secret header

Output Parameters

{
    "id": "6b7db656-56f2-484d-9aea-bdd9c447b8db",
    "polling_url": "https://genaiapi.cloudsway.net/v1/ai/{endpoint}/flux/get_result?id=6b7db656-56f2-484d-9aea-bdd9c447b8db"
}

Call Example

curl --location --request POST 'https://genaiapi.cloudsway.net/v1/ai/{endpoint}/flux/image/generate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {key}' \
--data-raw '{
    "prompt": "A futuristic city skyline at sunset with flying cars",
    "width": 1024,
    "height": 1024
}'

Get Result

Request Path

GET https://genaiapi.cloudsway.net/v1/ai/{endpoint}/flux/get_result?id={id}

Output Parameters

{
    "id": "c34d8d13-b91d-4cea-b6d7-ec14a392d813",
    "result": {
        "seed": 1994028133,
        "prompt": "A futuristic city skyline at sunset with flying cars",
        "sample": "https://delivery-us1.bfl.ai/results/84/845643e5cfce52/e5cfce526bf94348b2d68e9f0fedb35c/sample.jpeg?se=2025-08-21T03%3A54%3A06Z&sp=r&sv=2024-11-04&sr=b&rsct=image/jpeg&sig=Pypqewv9SKRhnou8qoZGXQwUn5a8idtB3gn2DXZQbbs%3D",
        "duration": 2.1276044845581055,
        "end_time": 1.7557478461223414E9,
        "start_time": 1.755747843994737E9
    },
    "status": "Ready"
}

MaaS-Flux-1-schnell

Common Information

Parameter Description Example
basePath The base path for calling the mass API, includes the fixed path/v1/ai https://genaiapi.cloudsway.net/v2/ai
endpointPath A randomly generated path segment for calling the mass API
AccessKey The access key for calling the mass API RWxxxxxxxx0Gd
taskId The task ID for asynchronous image processing tasks 1234abcd

Generate image

Request Method

POST

Request Path

{basePath}/v2/ai/{endpointPath}/images/generations

Request Headers

Parameter Description Example
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd

Request Body

Field Name Type Required Description Example Value
prompts string Yes Positive prompt words. A beautiful and youthful high school girl is sitting in the classroom, with a bright smile on her face.
batchsize int No Number of generated images. Limit range: 1 to 8. default:1 1
aspect_ratio String No Aspect ratio; supported values include:1:1、2:3、3:2、3:4、4:3、16:9、9:16 1:1 corresponds to 1024:1024
2:3 corresponds to 512:768
3:2 corresponds to 768:512
3:4 corresponds to 768:1024
4:3 corresponds to 1024:768
16:9 corresponds to 1280:720
9:16 corresponds to 720:1280
step int Yes step Limit range:4-10 4
seed int No Random seed.
default:0
0

Response

Field Name Type Description Example Value
status String status success
taskId String task id

Example

Request
curl --request POST \
--url https://genaiapi.cloudsway.net/v2/ai/lXynAhfbAiD/images/generations \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw '{
"prompts": "A beautiful and youthful high school girl is sitting in the classroom, with a bright smile on her face.",
"aspect_ratio": "2:3",
"batchsize": "2",
"step": 10
}'
Response
{
  "status": "success",
  "taskId": "3374b3b0-d069-4831-a76b-ebab4df14457"
}

Query Image Task Result

Request Method

GET

Request Path

{basePath}/v2/ai/{endpointPath}/images/tasks/{taskId}

Request Header

Parameter Description Example
Authorization AccessKey
Bearer ${AccessKey}
Bearer RWxxxxxxxx0Gd

Path Variables

Field Name Type Required Description Example Value
taskId String Yes Task id 3374b3b0-d069-4831-a76b-ebab4df14457

Response

Field Name Type Description Example Value
status String Task status information.
completed boolean Whether completed.
imageUrls list Collection of image addresses.

Example

Request
curl --location --request GET 'https://genaiapi.cloudsway.net/v2/ai/lXynAhfbOiD/images/tasks/3374b3b0-d069-4831-a76b-ebab4df14457 ' \
--header 'Authorization: Bearer ${AccessKey}' \
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \
--header 'content-type: application/json' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-raw ''
Response
{
  "status": "completed",
  "completed": true,
  "imageUrls": [
    "http://xxxx.png"
  ]
}