Skip to main content

Image-to-image

Send a source image and a text prompt that describes the edit. Some models also take several source images, for example to put the subject of one image into the scene of another. The response contains the edited image. The request is synchronous. There is no task to poll.

Models

See Choosing a model for a comparison, and Performance tiers for the tiers that each model serves.

Endpoint

Request

Every request must include your API key and a JSON content type. See Authentication.
string
required
Your API key.
string
required
Must be application/json.
string
required
The model that edits the image.Options: nunchux-flux.2-klein-4b-edit, nunchux-flux.2-klein-9b-edit, nunchux-flux.2-klein-4b-base-edit, nunchux-flux.2-klein-9b-base-edit, nunchux-qwen-image-edit-2511-lightning, nunchux-qwen-image-edit-2511, nunchux-qwen-image-edit-2509-lightning, nunchux-qwen-image-edit-2509, nunchux-qwen-image-edit, nunchux-flux.2-dev, nunchux-flux.3-image-klein-edit, nunchux-flux.3-image-klein-base-edit, nunchux-qwen-image-2.1-edit, nunchux-qwen-image-2.1-turbo-edit
string
The source image, as a data URI (for example data:image/png;base64,...) or as a public URL. Send the source image in url or in image, not in both. Supported formats: PNG, JPEG, WebP. Maximum size: 10 MB. Each side must be at least 64 px. The aspect ratio must be no more extreme than 8:1 in either orientation. A remote URL must resolve to a public host. Nunchux does not follow redirects.When you send a data URI, Nunchux keeps a copy of the image so that it appears in your request history for 7 days.
string | array
One source image, or a list of source images. Use a list to send more than one image. Each item follows the same rules as url: a data URI or a public URL. You can mix both kinds in one list. The model receives the images in the order of the list.The number of images that each model takes is in the Models table. A list with more images than the model takes, or an empty list, returns a 400 with the invalid_request code.
string
required
A text description of the edit. Say what to change, add or remove.On Qwen Image 2.1 Edit, the prompt and the source images share 8192 positions. Each prompt token uses one. Each source image uses 64 when it is square, and up to 182 when it is long and narrow, such as 8:1. A request that needs more positions returns a 400 with error.details.field set to prompt.
string
default:"radical_speed"
The balance of speed and cost. See Performance tiers.Options: radical_speed, radical_valueQwen Image Edit and FLUX.2 dev have radical_speed only. On them, radical_value returns a 400.
integer
required
Output width in pixels. Send it together with height. Range: 1 to 8192. On Qwen Image Edit, Qwen Image Edit 2511, Qwen Image Edit 2511 Lightning, Qwen Image Edit 2509, Qwen Image Edit 2509 Lightning, FLUX.2 dev and FLUX.2 Klein 4B Base Edit, FLUX.2 Klein 9B Base Edit: 256 to 2048, in steps of 16. On FLUX 3 Image Klein Edit and FLUX 3 Image Klein Base Edit: 256 to 4096, in steps of 16. On Radical Value, FLUX 3 Image Klein Edit and FLUX 3 Image Klein Base Edit take at most 4,194,304 pixels (width times height, the area of 2048x2048), so 4096x1024 works and 2576x1632 returns a 400. On Qwen Image 2.1 Edit and Qwen Image 2.1 Turbo Edit: 256 to 2752, in steps of 32. A size that is a multiple of 16 but not of 32, such as 1040, returns a 400 on them.
integer
required
Output height in pixels. Send it together with width. Range: 1 to 8192. On Qwen Image Edit, Qwen Image Edit 2511, Qwen Image Edit 2511 Lightning, Qwen Image Edit 2509, Qwen Image Edit 2509 Lightning, FLUX.2 dev and FLUX.2 Klein 4B Base Edit, FLUX.2 Klein 9B Base Edit: 256 to 2048, in steps of 16. On FLUX 3 Image Klein Edit and FLUX 3 Image Klein Base Edit: 256 to 4096, in steps of 16. On Radical Value, FLUX 3 Image Klein Edit and FLUX 3 Image Klein Base Edit take at most 4,194,304 pixels (width times height, the area of 2048x2048), so 4096x1024 works and 2576x1632 returns a 400. On Qwen Image 2.1 Edit and Qwen Image 2.1 Turbo Edit: 256 to 2752, in steps of 32. A size that is a multiple of 16 but not of 32, such as 1040, returns a 400 on them.
integer
default:1
The number of images to generate. Only 1 is supported.
string
default:"b64_json"
The format of the returned image.Options: url, b64_jsonIn both formats, Nunchux keeps the generated image for 7 days, so that it appears in your request history. Then Nunchux deletes it.
integer
Qwen Image Edit, Qwen Image Edit 2511, Qwen Image Edit 2511 Lightning, Qwen Image Edit 2509, Qwen Image Edit 2509 Lightning, FLUX.2 dev, FLUX.2 Klein 4B Base Edit, FLUX.2 Klein 9B Base Edit, FLUX 3 Image Klein Edit, FLUX 3 Image Klein Base Edit and Qwen Image 2.1 Edit only. The number of denoising steps. Range: 1 to 8 on the two Lightning models, 1 to 16 on FLUX 3 Image Klein Edit, 16 to 50 on FLUX 3 Image Klein Base Edit, 1 to 50 on the others. Default: 8 on the two Lightning models, 16 on FLUX 3 Image Klein Edit, 40 on Qwen Image Edit 2511, Qwen Image Edit 2509 and Qwen Image 2.1 Edit, 50 on the others. More steps give more detail, but take longer. Qwen Image 2.1 Turbo Edit takes no steps: it returns a 400.
number
Qwen Image Edit, Qwen Image Edit 2511, Qwen Image Edit 2509 and Qwen Image 2.1 Edit only. How closely the edit follows the prompt, and how strongly it avoids the negative_prompt. Range: 0.0 to 20.0. Default: 4.0 on Qwen Image Edit, Qwen Image Edit 2511 and Qwen Image Edit 2509, 1.0 on Qwen Image 2.1 Edit.On Qwen Image 2.1 Edit, the default 1.0 has no effect. Send a value above 1.0 together with negative_prompt.
number
default:4
FLUX.2 dev, FLUX.2 Klein 4B Base Edit, FLUX.2 Klein 9B Base Edit and FLUX 3 Image Klein Base Edit only. How closely the edit follows the prompt. Range: 0.0 to 20.0. Default: 4.0.
string
Qwen Image Edit, Qwen Image Edit 2511, Qwen Image Edit 2509, Qwen Image 2.1 Edit, FLUX.2 Klein 4B Base Edit, FLUX.2 Klein 9B Base Edit and FLUX 3 Image Klein Base Edit only. What the edited image must not show. On Qwen Image 2.1 Edit, it takes effect only when you also send true_cfg_scale above 1.0.
string
default:"off"
FLUX 3 Image Klein Edit, FLUX 3 Image Klein Base Edit, Qwen Image 2.1 Edit and Qwen Image 2.1 Turbo Edit only. With standard, Nunchux rewrites the prompt into a detailed description of the result before the image renders. The response returns the rewritten prompt as revised_prompt. On FLUX.2 Klein 4B Base Edit and FLUX.2 Klein 9B Base Edit, any value other than off returns a 400.On FLUX 3 Image Klein Edit and FLUX 3 Image Klein Base Edit, the rewrite adds about 3 to 4 seconds. These models follow a full description much better than a short prompt, so send standard unless your prompt already describes the whole result. On Qwen Image 2.1 Edit and Qwen Image 2.1 Turbo Edit, it can add 10 to 20 seconds.Options: off, standard
integer
The random seed. The same seed with the same parameters gives the same result.
boolean
default:true
Whether Nunchux’s content filter checks this request. Only accounts approved to turn moderation off may send false. Others get a 403. See Content moderation.
Dimensions
  • Send width and height together. A request with only one of them returns a 400.
  • Every image-to-image model is priced per megapixel today and charges from the output area. A request with no dimensions returns a 400. The API does not use the source image size or a default size.
  • Both values must be integers. The string "1024" is rejected, not converted.
  • The source image is a reference, not a canvas. The model does not crop or stretch it to width and height. When the source ratio is different from the output ratio, the model re-frames the content. With several source images, width and height alone set the output size.
  • Smaller source images process faster. Larger output images take longer to generate.
A minimal request body:
A request body for Qwen Image 2.1 Edit. Its width and height are multiples of 32:
A request body for FLUX 3 Image Klein Edit, with prompt expansion. The response returns the rewritten prompt in data[0].revised_prompt:

Response

The response is JSON. The data array contains the edited image, as base64 data or as a URL.
integer
required
The Unix timestamp of the generation.
array
required
The generated items.
string
required
The model that edited the image.
string
required
The tier that served the request: radical_speed or radical_value.
Base64 format
URL format
To save a base64 result from cURL, add this pipe to the command:

Example

Several source images

Send a list in image. Say in the prompt what to take from each image. This request puts the person from the first image into the scene of the second:
Upload limit with the OpenAI SDKThe OpenAI SDK uploads the files as a form, with one image[] part for each file. A form takes up to 10 image files, so it can send as many images as any model takes. Each file must be PNG, JPEG or WebP, and 10 MB or smaller.

Tips

  • Say exactly what to change, add or remove. The models can follow instructions with more than one change.
  • With several source images, refer to each one by its place in the list, for example “the person from the first image”.
  • Use Qwen Image Edit 2511 Lightning when the edit must keep the identity of the subject, or when it changes text in the image.
  • Use FLUX.2 Klein 4B Edit for fast, high-volume edit passes.
  • Use Qwen Image Edit 2511 or Qwen Image Edit when you want more detail than the Lightning model gives and the extra time is acceptable. Qwen Image Edit 2511 takes up to 3 source images. Use negative_prompt to keep things out of the edit.
  • Use Qwen Image Edit 2509 or Qwen Image Edit 2509 Lightning when your work already depends on the 2509 release. For new work, use Qwen Image Edit 2511 or Qwen Image Edit 2511 Lightning.
  • Use FLUX.2 dev for detailed edits when you already generate with FLUX.2 dev. Steer it with guidance_scale.
  • Use FLUX 3 Image Klein Edit for fast edits, and to combine up to 10 source images. Describe the whole result in the prompt: the subject, the setting, the light and the style, or send prompt_expansion set to standard to have Nunchux write the description. It takes no guidance and no negative prompt.
  • Use FLUX 3 Image Klein Base Edit when you want more detail or more control than FLUX 3 Image Klein Edit gives, and the extra time is acceptable. It also takes up to 10 source images. Steer it with guidance_scale and negative_prompt, and send prompt_expansion set to standard for a short prompt.
  • Use Qwen Image 2.1 Edit for edits up to 2752x2752, or with up to 10 source images. Send width and height in multiples of 32.
  • Use Qwen Image 2.1 Turbo Edit for the same sizes and source images in less time. It takes no steps, guidance or negative prompt, so put everything in the prompt.
  • Use FLUX.2 Klein 4B Base Edit or 9B Base Edit when you want more control than FLUX.2 Klein Edit gives, and the extra time is acceptable. Steer them with guidance_scale and negative_prompt. They default to 50 steps.
  • Use radical_speed when response time is important. Use radical_value for large batches where cost per image is more important. Qwen Image Edit and FLUX.2 dev have radical_speed only.
  • Send smaller source images for faster processing.

Errors and limits

Refused requests
  • Nunchux charges only after a successful generation. A refused request is never billed.
  • Do not branch on a dimension-specific code. A refused size, field or image list returns invalid_request, and error.details.field names the field. engine_error means the model could not render the request, or a source image was rejected.
For authentication, credit and rate-limit errors, see Error codes. Every request counts toward the requests-per-minute cap of your plan. See Rate limits.