KIE.AI
English
  • English
  • Chinese
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
  1. Flux Kontext API
  • Flux Kontext API Quickstart
  • Image Generation or Editing Callbacks
  • Generate or Edit Image
    POST
  • Get Image Details
    GET
English
  • English
  • Chinese
Support
English
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
  1. Flux Kontext API

Generate or Edit Image

POST
/api/v1/flux/kontext/generate
Create a new image generation or editing task using the Flux Kontext AI model.

Usage Modes#

1.
Text-to-Image Generation
Provide prompt and aspectRatio
Model will generate a new image based on the text description
2.
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

Callbacks

onImageGenerated

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
Request successful
Body

🔴500Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.kie.ai/api/v1/flux/kontext/generate' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "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 Response Example
200 - 成功示例
{
    "code": 200,
    "msg": "success",
    "data": {
        "taskId": "task12345"
    }
}
Previous
Image Generation or Editing Callbacks
Next
Get Image Details
Built with