Skip to main content

Image-to-image

Send a source image and a text prompt that describes the edit. 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-qwen-image-edit-2511
string
required
The source image, as a data URI (for example data:image/png;base64,...) or as a public URL. 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.
string
required
A text description of the edit. Say what to change, add or remove.
string
default:"radical_speed"
The balance of speed and cost. See Performance tiers.Options: radical_speed, radical_value
integer
required
Output width in pixels. Send it together with height. Range: 1 to 8192.
integer
required
Output height in pixels. Send it together with width. Range: 1 to 8192.
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
The random seed. The same seed with the same parameters gives the same result.
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.
  • Smaller source images process faster. Larger output images take longer to generate.
A minimal request body:

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.
Base64 format
URL format
To save a base64 result from cURL, add this pipe to the command:

Example

Tips

  • Say exactly what to change, add or remove. The models can follow instructions with more than one change.
  • Use Qwen Image Edit 2511 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 radical_speed when response time is important. Use radical_value for large batches where cost per image is more important.
  • 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 refusal always carries the engine_error code.
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.