Authentication
authorization string required
All APIs require authentication via Bearer Token
Get API Key:
Visit API Key Management Page to get your API Key
Usage:
Add to request header:
Authorization: Bearer YOUR_API_KEY
Parameters
model string required
Model ID to use for the request
Options: flux_kontext_pro
prompt string required
Text description of the desired image
input_image string
Base64 encoded image or image URL used as reference. Supports up to 20MB
input_image_2 string
Base64 encoded image or image URL used as reference. Supports up to 20MB
input_image_3 string
Base64 encoded image or image URL used as reference. Supports up to 20MB
input_image_4 string
Base64 encoded image or image URL used as reference. Supports up to 20MB
seed integer
Used for reproducibility. If null or omitted, a random seed is used. Accepts any integer
aspect_ratio string
Image aspect ratio, between 21:9 and 9:21
output_format string
Output format
Options: jpeg, png
Default: jpeg
prompt_upsampling boolean
Whether to perform upsampling on the prompt. If activated, will automatically modify prompt to achieve more creative generation
Default: false
safety_tolerance integer
Input and output moderation tolerance level. 0 means strictest, 6 means least strict
Range: 1 - 6
Default: 2
Polling
Since image generation takes time, you need to poll the task status after creation
The initial response returns the task ID and initial status. The actual generation results must be obtained through polling the task status endpoint
Response Format
error object
Error information, only present when status is failed
code
stringError code
message
stringDetailed error message
output array
Generation results, only present when status is completed
content
arrayList of generated content
type
stringResource type, e.g.,
imageurl
stringGenerated content URL
usage object
Usage statistics, only present when status is completed
cost
stringTotal cost in USD
discount
numberDiscount amount
metadata object
Metadata information
Error Codes
Error information is provided in the error field when status is failed