Create a new image generation or editing task using the Flux Kontext AI model.
prompt and aspectRatioprompt and inputImageaspectRatio.
All APIs require authentication via Bearer Token.
Get API Key:
Usage: Add to request header: Authorization: Bearer YOUR_API_KEY
Note:
Text prompt describing the desired image or edit. Required for both generation and editing modes.
"A serene mountain landscape at sunset with a lake reflecting the orange sky"
Whether to enable automatic translation feature.
true
(Optional) Specifies the server region for image upload. Set to true to use servers in China, false to use non-China servers. Choose based on your geographical location for optimal upload speeds.
false
URL of the input image for editing mode. Required when editing an existing image.
"https://example.com/input-image.jpg"
Output image aspect ratio. You Applicable in both text-to-image generation and image editing modes.
For text-to-image generation , the output image will follow the specified aspect ratio.
For image editing , if aspectRatio is provided, the edited image will follow that ratio. If not provided, the image will retain its original aspect ratio.
Supported Aspect Ratios:
| Ratio | Format Type | Common Use Cases |
|---|---|---|
| 21:9 | Ultra-wide | Cinematic displays, panoramic views |
| 16:9 | Widescreen | HD video, desktop wallpapers |
| 4:3 | Standard | Traditional displays, presentations |
| 1:1 | Square | Social media posts, profile pictures |
| 3:4 | Portrait | Magazine layouts, portrait photos |
| 9:16 | Mobile Portrait | Smartphone wallpapers, stories |
Note: Default ratio is "16:9" if not specified.
21:9, 16:9, 4:3, 1:1, 3:4, 9:16 Output image format.
jpeg, png Model version to use for generation.
Available Options:
| Model | Description |
|---|---|
| flux-kontext-pro | Standard model with balanced performance |
| flux-kontext-max | Enhanced model with advanced capabilities |
Note: Choose flux-kontext-max for more demanding tasks that require higher quality and detail
flux-kontext-pro, flux-kontext-max The URL to receive image generation or editing task completion updates. Optional but recommended for production use.
"https://your-callback-url.com/callback"
For Image Generation Mode: Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 6 (more permissive).
For Image Editing Mode: Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 2 (balanced).
Default: 2
0, 1, 2, 3, 4, 5, 6 2
Watermark identifier to add to the generated image.
"your-watermark-id"
Request successful
Response status code
200, 401, 402, 404, 422, 429, 455, 500, 501, 505 Error message when code != 200
"success"