FLUX General Inpainting

90.00 credits/MP
ae_flux_general_inpainting

Replace or change a selected area of an image using a mask and a written instruction.

Image
90.00 credits/MP

Pricing

90.00 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.

90.00 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[].scaleobject | numberNo The scale of the LoRA weight. This is used to scale the LoRA weight before merging it with the base model. Providing a dictionary as {"layer_name":layer_scale} allows per-layer lora scale settings. Layers with no scale provided will have scale 1.0. 1
request_body.promptstringYesThe prompt to generate an image from.—
request_body.nag_endnumberNo The proportion of steps to apply NAG. After the specified proportion of steps has been iterated, the remaining steps will use original attention processors in FLUX. 0.25
request_body.nag_taunumberNo The tau for NAG. Controls the normalization of the hidden state. Higher values will result in a less aggressive normalization, but may also lead to unexpected changes with respect to the original image. Not recommended to change this value. 2.5
request_body.mask_urlstringYes The mask to area to Inpaint in. —
request_body.strengthnumberNoThe strength to use for inpainting/image-to-image. Only used if the image_url is provided. 1.0 is completely remakes the image while 0.0 preserves the original.0.85
request_body.image_urlstringYesURL of image to use for inpainting. or img2img—
request_body.max_shiftnumberNoMax shift for the scheduled timesteps1.15
request_body.nag_alphanumberNo The alpha value for NAG. This value is used as a final weighting factor for steering the normalized guidance (positive and negative prompts) in the direction of the positive prompt. Higher values will result in less steering on the normalized guidance where lower values will result in considering the positive prompt guidance more. 0.25
request_body.nag_scalenumberNo The scale for NAG. Higher values will result in a image that is more distant to the negative prompt. 3
request_body.schedulerenum (euler | dpmpp_2m)NoScheduler for the denoising process.euler
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.base_shiftnumberNoBase shift for the scheduled timesteps0.5
request_body.fill_imageobject | unknownNoUse an image input to influence the generation. Can be used to fill images in masked areas.—
request_body.fill_image.fill_image_urlstring | arrayNoURLs of images to be filled for redux prompting—
request_body.image_sizeobject | stringNoThe size of the generated image.—
request_body.image_size.widthintegerNoThe width of the generated image.512
request_body.image_size.heightintegerNoThe height of the generated image.512
request_body.num_imagesintegerNoThe number of images to generate. This is always set to 1 for streaming output.1
request_body.controlnetsarrayNo The controlnets to use for the image generation. Only one controlnet is supported at the moment. —
request_body.controlnets[].pathstringYesURL or the path to the control net weights.—
request_body.controlnets[].variantstring | unknownNoThe optional variant if a Hugging Face repo key is used.—
request_body.controlnets[].config_urlstring | unknownNooptional URL to the controlnet config.json file.—
request_body.controlnets[].end_percentagenumberNo The percentage of the image to end applying the controlnet in terms of the total timesteps. 1
request_body.controlnets[].mask_image_urlstring | nullNoURL of the mask for the control image.—
request_body.controlnets[].mask_thresholdnumberNoThreshold for mask.0.5
request_body.controlnets[].start_percentagenumberNo The percentage of the image to start applying the controlnet in terms of the total timesteps. 0
request_body.controlnets[].control_image_urlstringYesURL of the image to be used as the control image.—
request_body.controlnets[].conditioning_scalenumberNo The scale of the control net weight. This is used to scale the control net weight before merging it with the base model. 1
request_body.ip_adaptersarrayNo IP-Adapter to use for image generation. —
request_body.ip_adapters[].pathstringYesHugging Face path to the IP-Adapter—
request_body.ip_adapters[].scalenumberYesScale for ip adapter.—
request_body.ip_adapters[].image_urlstringYesURL of Image for IP-Adapter conditioning. —
request_body.ip_adapters[].subfolderstring | unknownNoSubfolder in which the ip_adapter weights exist—
request_body.ip_adapters[].weight_namestring | unknownNoName of the safetensors file containing the ip-adapter weights—
request_body.ip_adapters[].mask_image_urlstring | unknownNoURL of the mask for the control image.—
request_body.ip_adapters[].mask_thresholdnumberNoThreshold for mask.0.5
request_body.ip_adapters[].image_encoder_pathstringYesPath to the Image Encoder for the IP-Adapter, for example 'openai/clip-vit-large-patch14'—
request_body.ip_adapters[].image_encoder_subfolderstring | unknownNoSubfolder in which the image encoder weights exist.—
request_body.ip_adapters[].image_encoder_weight_namestring | unknownNoName of the image encoder.—
request_body.easycontrolsarrayNo EasyControl Inputs to use for image generation. —
request_body.easycontrols[].scalenumberNoScale for the control method.1
request_body.easycontrols[].image_urlstringYesURL of an image to use as a control—
request_body.easycontrols[].control_method_urlstringYesURL to safetensor weights of control method to be applied. Can also be one of `canny`, `depth`, `hedsketch`, `inpainting`, `pose`, `seg`, `subject`, `ghibli` —
request_body.easycontrols[].image_control_typeenum (subject | spatial)YesControl type of the image. Must be one of `spatial` or `subject`.—
request_body.use_cfg_zerobooleanNo Uses CFG-zero init sampling as in https://arxiv.org/abs/2503.18886. false
request_body.use_real_cfgbooleanNo Uses classical CFG as in SD1.5, SDXL, etc. Increases generation times and price when set to be true. If using XLabs IP-Adapter v1, this will be turned on!. false
request_body.control_lorasarrayNo The LoRAs to use for the image generation which use a control image. You can use any number of LoRAs and they will be merged together to generate the final image. —
request_body.control_loras[].pathstringYesURL or the path to the LoRA weights.—
request_body.control_loras[].scaleobject | numberNo The scale of the LoRA weight. This is used to scale the LoRA weight before merging it with the base model. Providing a dictionary as {"layer_name":layer_scale} allows per-layer lora scale settings. Layers with no scale provided will have scale 1.0. 1
request_body.control_loras[].preprocessenum (canny | depth | None)NoType of preprocessing to apply to the input image.None
request_body.control_loras[].control_image_urlstringYesURL of the image to be used as the control image.—
request_body.output_formatenum (jpeg | png)NoThe format of the generated image.png
request_body.reference_endnumberNo The percentage of the total timesteps when the reference guidance is to be ended. 1
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. 3.5
request_body.real_cfg_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. 3.5
request_body.sigma_schedulestring | unknownNoSigmas schedule for the denoising process.—
request_body.negative_promptstringNo Negative prompt to steer the image generation away from unwanted features. By default, we will be using NAG for processing the negative prompt. ""
request_body.reference_startnumberNo The percentage of the total timesteps when the reference guidance is to bestarted. 0
request_body.controlnet_unionsarrayNo The controlnet unions to use for the image generation. Only one controlnet is supported at the moment. —
request_body.controlnet_unions[].pathstringYesURL or the path to the control net weights.—
request_body.controlnet_unions[].variantstring | unknownNoThe optional variant if a Hugging Face repo key is used.—
request_body.controlnet_unions[].controlsarrayYesThe control images and modes to use for the control net.—
request_body.controlnet_unions[].controls[].control_modeenum (canny | tile | depth | blur | pose | gray | low-quality)YesControl Mode for Flux Controlnet Union. Supported values are: - canny: Uses the edges for guided generation. - tile: Uses the tiles for guided generation. - depth: Utilizes a grayscale depth map for guided generation. - blur: Adds a blur to the image. - pose: Uses the pose of the image for guided generation. - gray: Converts the image to grayscale. - low-quality: Converts the image to a low-quality image.—
request_body.controlnet_unions[].controls[].end_percentagenumberNo The percentage of the image to end applying the controlnet in terms of the total timesteps. 1
request_body.controlnet_unions[].controls[].mask_image_urlstring | nullNoURL of the mask for the control image.—
request_body.controlnet_unions[].controls[].mask_thresholdnumberNoThreshold for mask.0.5
request_body.controlnet_unions[].controls[].start_percentagenumberNo The percentage of the image to start applying the controlnet in terms of the total timesteps. 0
request_body.controlnet_unions[].controls[].control_image_urlstringYesURL of the image to be used as the control image.—
request_body.controlnet_unions[].controls[].conditioning_scalenumberNo The scale of the control net weight. This is used to scale the control net weight before merging it with the base model. 1
request_body.controlnet_unions[].config_urlstring | unknownNooptional URL to the controlnet config.json file.—
request_body.use_beta_schedulebooleanNoSpecifies whether beta sigmas ought to be used.false
request_body.reference_strengthnumberNoStrength of reference_only generation. Only used if a reference image is provided.0.65
request_body.num_inference_stepsintegerNoThe number of inference steps to perform.28
request_body.reference_image_urlstringNoURL of Image for Reference-Only—
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_general_inpainting' \
  --header "X-Api-Key: $AGENTEARTH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "params": {
    "request_body": {
      "enable_safety_checker": true,
      "guidance_scale": 3.5,
      "image_url": "https://file.gw.xnetwk.net/file/1ba89224-91c0-40c3-a853-5896f9940e65.jpg",
      "mask_url": "https://file.gw.xnetwk.net/file/debd47a7-ae33-4cd1-94b7-5c8acf833e8e.png",
      "num_images": 2,
      "num_inference_steps": 32,
      "output_format": "png",
      "prompt": "Inpaint only the masked face area. Replace the child'\''s face with the face of the young Chinese boy from the reference image, keeping his facial identity: round soft face, short black hair fringe under the beanie, gentle natural smile with mouth slightly open showing upper teeth, calm natural eyes. Realistic candid photograph texture: natural child skin with subtle pores and slight imperfections, soft outdoor daylight, matching the base image head angle, perspective, lighting direction, white balance and film-like color grade. The result must look like an unedited real photo taken on a DSLR camera, with no beauty filter and no airbrushed skin. Everything outside the mask stays exactly the same: hair fringe, beige beanie, grey striped collar, beige inner shirt, clothing, background.",
      "reference_image_url": "https://file.gw.xnetwk.net/file/16d7a1f9-9800-42e3-ae08-602d124742c7.jpg",
      "reference_strength": 0.8,
      "strength": 0.95
    }
  }
}'
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": "0929f9bf-16bc-46f4-9290-5ac82bf7ced0"
}

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