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.
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.
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
request_body | object | Yes | No parameter description. | — |
request_body.seed | integer | unknown | No | The same seed and the same prompt given to the same version of the model will output the same image every time. | — |
request_body.loras | array | No | 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[].path | string | Yes | URL or the path to the LoRA weights. | — |
request_body.loras[].scale | object | number | No | 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.prompt | string | Yes | The prompt to generate an image from. | — |
request_body.nag_end | number | No | 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_tau | number | No | 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_url | string | Yes | The mask to area to Inpaint in. | — |
request_body.strength | number | No | The 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_url | string | Yes | URL of image to use for inpainting. or img2img | — |
request_body.max_shift | number | No | Max shift for the scheduled timesteps | 1.15 |
request_body.nag_alpha | number | No | 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_scale | number | No | The scale for NAG. Higher values will result in a image that is more distant to the negative prompt. | 3 |
request_body.scheduler | enum (euler | dpmpp_2m) | No | Scheduler for the denoising process. | euler |
request_body.sync_mode | boolean | No | If `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_shift | number | No | Base shift for the scheduled timesteps | 0.5 |
request_body.fill_image | object | unknown | No | Use an image input to influence the generation. Can be used to fill images in masked areas. | — |
request_body.fill_image.fill_image_url | string | array | No | URLs of images to be filled for redux prompting | — |
request_body.image_size | object | string | No | The size of the generated image. | — |
request_body.image_size.width | integer | No | The width of the generated image. | 512 |
request_body.image_size.height | integer | No | The height of the generated image. | 512 |
request_body.num_images | integer | No | The number of images to generate. This is always set to 1 for streaming output. | 1 |
request_body.controlnets | array | No | The controlnets to use for the image generation. Only one controlnet is supported at the moment. | — |
request_body.controlnets[].path | string | Yes | URL or the path to the control net weights. | — |
request_body.controlnets[].variant | string | unknown | No | The optional variant if a Hugging Face repo key is used. | — |
request_body.controlnets[].config_url | string | unknown | No | optional URL to the controlnet config.json file. | — |
request_body.controlnets[].end_percentage | number | No | The percentage of the image to end applying the controlnet in terms of the total timesteps. | 1 |
request_body.controlnets[].mask_image_url | string | null | No | URL of the mask for the control image. | — |
request_body.controlnets[].mask_threshold | number | No | Threshold for mask. | 0.5 |
request_body.controlnets[].start_percentage | number | No | The percentage of the image to start applying the controlnet in terms of the total timesteps. | 0 |
request_body.controlnets[].control_image_url | string | Yes | URL of the image to be used as the control image. | — |
request_body.controlnets[].conditioning_scale | number | No | 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_adapters | array | No | IP-Adapter to use for image generation. | — |
request_body.ip_adapters[].path | string | Yes | Hugging Face path to the IP-Adapter | — |
request_body.ip_adapters[].scale | number | Yes | Scale for ip adapter. | — |
request_body.ip_adapters[].image_url | string | Yes | URL of Image for IP-Adapter conditioning. | — |
request_body.ip_adapters[].subfolder | string | unknown | No | Subfolder in which the ip_adapter weights exist | — |
request_body.ip_adapters[].weight_name | string | unknown | No | Name of the safetensors file containing the ip-adapter weights | — |
request_body.ip_adapters[].mask_image_url | string | unknown | No | URL of the mask for the control image. | — |
request_body.ip_adapters[].mask_threshold | number | No | Threshold for mask. | 0.5 |
request_body.ip_adapters[].image_encoder_path | string | Yes | Path to the Image Encoder for the IP-Adapter, for example 'openai/clip-vit-large-patch14' | — |
request_body.ip_adapters[].image_encoder_subfolder | string | unknown | No | Subfolder in which the image encoder weights exist. | — |
request_body.ip_adapters[].image_encoder_weight_name | string | unknown | No | Name of the image encoder. | — |
request_body.easycontrols | array | No | EasyControl Inputs to use for image generation. | — |
request_body.easycontrols[].scale | number | No | Scale for the control method. | 1 |
request_body.easycontrols[].image_url | string | Yes | URL of an image to use as a control | — |
request_body.easycontrols[].control_method_url | string | Yes | URL 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_type | enum (subject | spatial) | Yes | Control type of the image. Must be one of `spatial` or `subject`. | — |
request_body.use_cfg_zero | boolean | No | Uses CFG-zero init sampling as in https://arxiv.org/abs/2503.18886. | false |
request_body.use_real_cfg | boolean | No | 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_loras | array | No | 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[].path | string | Yes | URL or the path to the LoRA weights. | — |
request_body.control_loras[].scale | object | number | No | 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[].preprocess | enum (canny | depth | None) | No | Type of preprocessing to apply to the input image. | None |
request_body.control_loras[].control_image_url | string | Yes | URL of the image to be used as the control image. | — |
request_body.output_format | enum (jpeg | png) | No | The format of the generated image. | png |
request_body.reference_end | number | No | The percentage of the total timesteps when the reference guidance is to be ended. | 1 |
request_body.guidance_scale | number | No | 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_scale | number | No | 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_schedule | string | unknown | No | Sigmas schedule for the denoising process. | — |
request_body.negative_prompt | string | No | 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_start | number | No | The percentage of the total timesteps when the reference guidance is to bestarted. | 0 |
request_body.controlnet_unions | array | No | The controlnet unions to use for the image generation. Only one controlnet is supported at the moment. | — |
request_body.controlnet_unions[].path | string | Yes | URL or the path to the control net weights. | — |
request_body.controlnet_unions[].variant | string | unknown | No | The optional variant if a Hugging Face repo key is used. | — |
request_body.controlnet_unions[].controls | array | Yes | The control images and modes to use for the control net. | — |
request_body.controlnet_unions[].controls[].control_mode | enum (canny | tile | depth | blur | pose | gray | low-quality) | Yes | Control 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_percentage | number | No | The percentage of the image to end applying the controlnet in terms of the total timesteps. | 1 |
request_body.controlnet_unions[].controls[].mask_image_url | string | null | No | URL of the mask for the control image. | — |
request_body.controlnet_unions[].controls[].mask_threshold | number | No | Threshold for mask. | 0.5 |
request_body.controlnet_unions[].controls[].start_percentage | number | No | The percentage of the image to start applying the controlnet in terms of the total timesteps. | 0 |
request_body.controlnet_unions[].controls[].control_image_url | string | Yes | URL of the image to be used as the control image. | — |
request_body.controlnet_unions[].controls[].conditioning_scale | number | No | 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_url | string | unknown | No | optional URL to the controlnet config.json file. | — |
request_body.use_beta_schedule | boolean | No | Specifies whether beta sigmas ought to be used. | false |
request_body.reference_strength | number | No | Strength of reference_only generation. Only used if a reference image is provided. | 0.65 |
request_body.num_inference_steps | integer | No | The number of inference steps to perform. | 28 |
request_body.reference_image_url | string | No | URL of Image for Reference-Only | — |
request_body.enable_safety_checker | boolean | No | If 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-KeySubmit 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
{
"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.

