v1
latestOpenAPI 3.0.02026-07-263014.2 KBGenerate or Edit Image
Create a new image generation or editing task using the Flux Kontext AI model.
Usage Modes
-
Text-to-Image Generation
- Provide prompt and aspectRatio
- Model will generate a new image based on the text description
-
Image Editing
- Provide prompt and inputImage
- You can optionally provide an aspectRatio.
- If supplied, the output will be cropped or padded to match this ratio.
- If omitted, the original image's ratio will be preserved.
- Model will edit the input image according to the prompt
Important Notes
- Generated images will expire after 14 days
- Prompts only support English
- Choose the appropriate model based on your needs:
- flux-kontext-pro: Standard model for most use cases
- flux-kontext-max: Enhanced model for complex scenes
post/api/v1/flux/kontext/generate
Request body
Example request
{
"prompt": "A serene mountain landscape at sunset with a lake reflecting the orange sky",
"enableTranslation": true,
"aspectRatio": "16:9",
"outputFormat": "jpeg",
"promptUpsampling": false,
"model": "flux-kontext-pro"
}Response
Request successful
Example response
{
"msg": "success",
"data": {
"taskId": "task12345"
}
}