FLUX Kontext Lora

42 credits/MP
ae_flux_kontext_lora

Edit an existing image with a text prompt and optionally apply LoRA styles or effects.

Image
42 credits/MP

Pricing

42 AE credits per MP. Charge for successfully returned images. Round each image up to a whole MP, then sum. One MP is 1024 by 1024 pixels.

42 credits/MP

Parameters

Optional parameters use the platform defaults when omitted.

ParameterTypeRequiredDescriptionDefault
request_bodyobjectYesNo parameter description.—
request_body.seedinteger | unknownNo The same seed and the same prompt given to the same version of the model will output the same image every time. —
request_body.lorasarrayNo The LoRAs to use for the image generation. You can use any number of LoRAs and they will be merged together to generate the final image. —
request_body.loras[].pathstringYesURL or the path to the LoRA weights.—
request_body.loras[].scalenumberNo The scale of the LoRA weight. This is used to scale the LoRA weight before merging it with the base model. 1
request_body.promptstringYesThe prompt to edit the image.—
request_body.image_urlstringYesThe URL of the image to edit. Max width: 14142px, Max height: 14142px, Timeout: 20s—
request_body.sync_modebooleanNoIf `True`, the media will be returned as a data URI and the output data won't be available in the request history.false
request_body.num_imagesintegerNoThe number of images to generate.1
request_body.accelerationenum (none | regular | high)NoThe speed of the generation. The higher the speed, the faster the generation.none
request_body.output_formatenum (jpeg | png)NoThe format of the generated image.png
request_body.guidance_scalenumberNo The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you. 2.5
request_body.resolution_modeenum (auto | match_input | 1:1 | 16:9 | 21:9 | 3:2 | 2:3 | 4:5 | 5:4 | 3:4 | 4:3 | 9:16 | 9:21)No Determines how the output resolution is set for image editing. - `auto`: The model selects an optimal resolution from a predefined set that best matches the input image's aspect ratio. This is the recommended setting for most use cases as it's what the model was trained on. - `match_input`: The model will attempt to use the same resolution as the input image. The resolution will be adjusted to be compatible with the model's requirements (e.g. dimensions must be multiples of 16 and within supported limits). Apart from these, a few aspect ratios are also supported. match_input
request_body.num_inference_stepsintegerNoThe number of inference steps to perform.30
request_body.enable_safety_checkerbooleanNoIf set to true, the safety checker will be enabled.true

Invocation example

Copy the request and explore its response example.

POST/agent-api/v1/tool/executeX-Api-Key

Submit first, then query with the returned task_id until the task completes.

Request coderequest.sh
curl --request POST \
  --url 'https://agentearth.ai/agent-api/v1/tool/execute?tool_name=ae_flux_kontext_lora' \
  --header "X-Api-Key: $AGENTEARTH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "params": {
    "request_body": {
      "guidance_scale": 3.5,
      "image_url": "https://agentearth.ai/fileserver/file/cf810752-448c-4487-863e-5540b3826cb9.png",
      "num_images": 1,
      "num_inference_steps": 30,
      "output_format": "png",
      "prompt": "Remove the white steam/gas/smoke rising from the teacup that the elf girl is holding. The teacup should have no steam at all. Keep everything else exactly the same: the cute elf girl Cha Xiao Luo with green-to-orange gradient hair, straw hat with green leaf, white camellia flower, pointed elf ears, green embroidered top, amber orange skirt, leaf pendant, woven sandals, sitting on the wooden railing holding a teacup. Keep the busy ancient Chinese tea street scene with tea stalls, clay teapots, red lanterns, stone arch bridge, canal with wooden boat, people walking, cats on rooftops, floating tea leaves, distant mountains. Do not change the style, lighting, or composition. Only remove the white steam from the cup.",
      "resolution_mode": "match_input",
      "safety_tolerance": "2"
    }
  }
}'
Response exampleresponse.json
JSONPartial content
{
  "description": "task accepted; poll the result via query_tool with this task_id",
  "query_tool": "ae_get_result",
  "status": "created",
  "task_id": "579f4b8f-bf87-4ef0-9e34-801cdc5ba68e"
}

This example shows part of the response. Copied content is valid JSON.