Flux Image To Image

POSThttps://api.newportai.com/api/async/flux_image2image

The Flux Image To Image API allows developers to generate high-quality images by combining natural language descriptions with visual references. It leverages advanced AI models to interpret source images and text prompts to produce stunning visuals—ideal for design automation, content generation, e-commerce, advertising, and game development.

  • Submit a POST request to the Flux Image To Image API to obtain a taskId.
  • Submit a POST request to the Polling API to retrieve the generated image results.
  • Configure a Callback URL to receive results automatically on completion.

Request Headers

Content-Type string Required

Enum: application/json

Authorization string Required

Bearer authentication token. Example: Bearer {{APIKey}}.

Request Body

imageUrl string Required

The URL of a publicly accessible image to be used as a visual reference or structural starting point.

prompt string Required

A text description specifying the desired modifications or the content to be generated.

width integer Required

The width of the output image in pixels. Must be a multiple of 16 (maximum: 1600).

height integer Required

The height of the output image in pixels. Must be a multiple of 16 (maximum: 1600).

num integer Optional

The number of images to generate (range: 1–10). Default: 4.

seed integer Optional

Controls the random number generator used during image creation, determining the starting point for the AI model's sampling process. Default: -1 (randomized).

Response

code integer

Returns 0 for success, or a specific error code.

message string

Returns "success" or a descriptive error message.

data object
taskId string

The unique identifier for the task. Use this ID with the Polling API to retrieve the generated output.

Errors

10192Illegal param

Polling

Use the Polling API to retrieve the processing results.

Callback

Alternatively, you can enable Callback to receive task results automatically upon completion.

0Task Completed
{
  "code": 0,
  "message": "success",
  "data": {
    "task": {
      "taskId": "fd39d658e949436182248f1d092e2440",
      "status": 3,
      "taskType": "flux_image2image"
    },
    "images": [
      {
        "imageType": "png",
        "imageUrl": "https://dreamface-resource-cv.oss-us-east-1.aliyuncs.com/aigc-dreamface-flux/2025-06-27/bea4135c8b80e76b.png"
      },
      {
        "imageType": "png",
        "imageUrl": "https://dreamface-resource-cv.oss-us-east-1.aliyuncs.com/aigc-dreamface-flux/2025-06-27/42f5873243dbb6ff.png"
      },
      {
        "imageType": "png",
        "imageUrl": "https://dreamface-resource-cv.oss-us-east-1.aliyuncs.com/aigc-dreamface-flux/2025-06-27/76ecd9d3cfc481c8.png"
      },
      {
        "imageType": "png",
        "imageUrl": "https://dreamface-resource-cv.oss-us-east-1.aliyuncs.com/aigc-dreamface-flux/2025-06-27/5ae27ad21d592dfe.png"
      }
    ]
  }
}
Request
cURL
curl -X POST 'https://api.newportai.com/api/async/flux_image2image' \
  -H "Authorization: Bearer {{key}}" \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt":"a boy singing",
    "seed":-1,
    "width":512,
    "height":512,
    "num":4,
    "imageUrl":"https://d2t5pyzt5qvy2d.cloudfront.net/api/static_resource/prod/default/INj5UrnnrKIzCR1uYBWv0.png"
  }'
0Successful
{
  "code": 0,
  "message": "success",
  "data": {
    "taskId": "cdcd619445ed4ac499ae7492724bcbc0"
  }
}