For the complete documentation index, see llms.txt. This page is also available as Markdown.

Flux Kontext Max image-to-image

This documentation is valid for the following list of our models:

  • flux/kontext-max/image-to-image

Model Overview

An image-to-image model that modifies only what the prompt instructs, leaving the rest of the image untouched.

Model
Properties of Generated Images

flux/kontext-max/image-to-image

Format: JPEG, PNG Image size can't be set directly — only a preset aspect ratio can be chosen. Default aspect ratio and size: 16:9, 1184x880 (well, not quite 16:9)

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

API Schema

post
Body
modelstring · enumRequiredPossible values:
promptstring · max: 4000Required

The text prompt describing the content, style, or composition of the image to be generated.

num_imagesnumber · min: 1 · max: 4Optional

Number of image variations to generate. Each image is a different attempt to combine the reference images (from the image_url parameter) according to the prompt.

Default: 1
seedinteger · min: 1Optional

The same seed and the same prompt given to the same version of the model will output the same image every time.

guidance_scalenumber · min: 1 · max: 20Optional

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.

safety_tolerancestring · enumOptional

The safety tolerance level for the generated image. 1 being the most strict and 5 being the most permissive.

Default: 2Possible values:
output_formatstring · enumOptional

The format of the generated image.

Default: jpegPossible values:
aspect_ratiostring · enumOptional

The aspect ratio of the generated image.

Default: 16:9Possible values:
image_urlany ofRequired

One or more image URLs used as visual references. The model merges them into a single image following the prompt instructions.

string · uriOptional
or
string · uri[] · max: 4Optional
Responses
200Success
application/json
post/v1/images/generations
curl -L \
  --request POST \
  --url 'https://api.aimlapi.com/v1/images/generations' \
  --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
      "model": "flux/kontext-max/image-to-image",
      "prompt": "Add a crown to the T-rex’s head.",
      "image_url": "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png"
    }'
200Success
{
  "data": [
    {
      "url": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png",
      "b64_json": null
    }
  ],
  "meta": {
    "usage": {
      "credits_used": 120000
    }
  }
}

Quick Example

Let's generate a new image using the one from the flux/dev Quick Example as a reference — and make a simple change to it with a prompt.

Response
Reference Image
Generated Image

More generated images

"Add a crown to the T-rex's head."

"Add a couple of silver wings"

"Remove the dinosaur. Place a book and a bouquet of wildflowers in blue and pink tones on the lounge chair. Let a light foamy surf gently wash the bottom of the chair. Don't change anything else."

"Make the dinosaur sit on a lounge chair with its back to the camera, looking toward the water. The setting sun has almost disappeared below the horizon."

Example #2: Combine two images

This time, we’ll pass two images to the model: our dinosaur and a solid blue mug. We'll ask the model to place the dinosaur onto the mug as a print.

Our input images

Our chilling T-rex

Our blue mug

Response
"Place this image with the t-rex on this mug from the second image as a print. Make it look fit and natural."

Last updated

Was this helpful?