# FLUX.3 Klein Image Editing

> Edits and composes images from text instructions and up to ten references with FLUX.3 Klein, with optional bounding-box controls for object placement and transformation.


## Overview

- **Endpoint**: `https://fal.run/blackforestlabs/flux-3/klein/edit-image`
- **Model ID**: `blackforestlabs/flux-3/klein/edit-image`
- **Category**: image-to-image
- **Kind**: inference
**Description**: FLUX.3 Klein Image Editing creates edited compositions from a target caption and one to ten reference images. It supports optional layout boxes to place new objects or move, resize and remove referenced objects. Image size, output count, seed, prompt expansion and PNG, JPEG or WebP output are configurable. The standard endpoint defaults to 12 inference steps.

**Tags**: image editing, image to image, reference images, typography, graphic design, flux



## Pricing

Planned per-image pricing by output resolution: **768×768: $0.008**, **1K: $0.009**, **1.5K: $0.011**, **2K: $0.014**, and **4K: $0.036**. The same schedule is planned for text-to-image generation and image editing.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`prompt`** (`string`, _required_):
  A complete caption of the target image with the edit folded in. Refer to the references by their order: the first image, the second image.
  - Examples: "A miniature grey amigurumi knight figure crocheted from thick woolen yarn stands on a cliff of stacked yarn skeins at night, lit by a full moon, next to a large fluffy knitted dragon in terracotta and mustard yarn, with a soft out-of-focus backdrop of indigo knitted yarn."

- **`enable_prompt_expansion`** (`boolean`, _optional_):
  If set to true, the prompt is expanded into a detailed caption (grounded in the reference images when editing) before generation. Default value: `true`
  - Default: `true`

- **`seed`** (`integer`, _optional_):
  The same seed and the same prompt given to the same version of the model will output the same image every time.

- **`num_images`** (`integer`, _optional_):
  The number of images to generate. Default value: `1`
  - Default: `1`
  - Range: `1` to `4`

- **`enable_safety_checker`** (`boolean`, _optional_):
  If set to true, the safety checker will be enabled. Default value: `true`
  - Default: `true`

- **`output_format`** (`OutputFormatEnum`, _optional_):
  The format of the generated image. Default value: `"png"`
  - Default: `"png"`
  - Options: `"jpeg"`, `"png"`, `"webp"`

- **`sync_mode`** (`boolean`, _optional_):
  If `True`, the media will be returned as a data URI and the output data won't be available in the request history.
  - Default: `false`

- **`image_urls`** (`list<string>`, _required_):
  The reference images to edit or compose from (up to 10).
  - Array of string
  - Examples: ["https://storage.googleapis.com/falserverless/example_inputs/z-image-turbo-i2i-input.png"]

- **`image_size`** (`ImageSize | Enum`, _optional_):
  The size of the generated image, 256 to 4096 pixels per side. If not set, a single reference image's own size (scaled to at most 4 megapixels) is used, or the first reference image's size (at most 1 megapixel) when several are given.
  - One of: ImageSize | Enum

- **`bounding_boxes`** (`list<EditBoundingBox>`, _optional_):
  Optional layout, with (0, 0) at the top-left of each image: keep, move, resize or remove objects from the references, or place new ones. Name boxes in the prompt by label, e.g. `<dragon>`.
  - Array of EditBoundingBox



**Required Parameters Example**:

```json
{
  "prompt": "A miniature grey amigurumi knight figure crocheted from thick woolen yarn stands on a cliff of stacked yarn skeins at night, lit by a full moon, next to a large fluffy knitted dragon in terracotta and mustard yarn, with a soft out-of-focus backdrop of indigo knitted yarn.",
  "image_urls": [
    "https://storage.googleapis.com/falserverless/example_inputs/z-image-turbo-i2i-input.png"
  ]
}
```

**Full Example**:

```json
{
  "prompt": "A miniature grey amigurumi knight figure crocheted from thick woolen yarn stands on a cliff of stacked yarn skeins at night, lit by a full moon, next to a large fluffy knitted dragon in terracotta and mustard yarn, with a soft out-of-focus backdrop of indigo knitted yarn.",
  "enable_prompt_expansion": true,
  "num_images": 1,
  "enable_safety_checker": true,
  "output_format": "png",
  "image_urls": [
    "https://storage.googleapis.com/falserverless/example_inputs/z-image-turbo-i2i-input.png"
  ],
  "bounding_boxes": [
    {
      "label": "dragon",
      "description": "a large fluffy knitted dragon in terracotta and mustard yarn"
    }
  ]
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<ImageFile>`, _required_):
  The generated images.
  - Array of ImageFile

- **`timings`** (`Timings`, _required_):
  The timings of the generation process.

- **`seed`** (`integer`, _required_):
  Seed used to generate the first image.

- **`has_nsfw_concepts`** (`list<boolean>`, _required_):
  Whether the generated images contain NSFW concepts.
  - Array of boolean

- **`prompt`** (`string`, _required_):
  The prompt used for generating the image.



**Example Response**:

```json
{
  "images": [
    {
      "url": "",
      "content_type": "image/png",
      "file_name": "z9RV14K95DvU.png",
      "file_size": 4404019
    }
  ],
  "prompt": ""
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/blackforestlabs/flux-3/klein/edit-image \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "prompt": "A miniature grey amigurumi knight figure crocheted from thick woolen yarn stands on a cliff of stacked yarn skeins at night, lit by a full moon, next to a large fluffy knitted dragon in terracotta and mustard yarn, with a soft out-of-focus backdrop of indigo knitted yarn.",
     "image_urls": [
       "https://storage.googleapis.com/falserverless/example_inputs/z-image-turbo-i2i-input.png"
     ]
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "blackforestlabs/flux-3/klein/edit-image",
    arguments={
        "prompt": "A miniature grey amigurumi knight figure crocheted from thick woolen yarn stands on a cliff of stacked yarn skeins at night, lit by a full moon, next to a large fluffy knitted dragon in terracotta and mustard yarn, with a soft out-of-focus backdrop of indigo knitted yarn.",
        "image_urls": ["https://storage.googleapis.com/falserverless/example_inputs/z-image-turbo-i2i-input.png"]
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("blackforestlabs/flux-3/klein/edit-image", {
  input: {
    prompt: "A miniature grey amigurumi knight figure crocheted from thick woolen yarn stands on a cliff of stacked yarn skeins at night, lit by a full moon, next to a large fluffy knitted dragon in terracotta and mustard yarn, with a soft out-of-focus backdrop of indigo knitted yarn.",
    image_urls: ["https://storage.googleapis.com/falserverless/example_inputs/z-image-turbo-i2i-input.png"]
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/blackforestlabs/flux-3/klein/edit-image)
- [API Documentation](https://fal.ai/models/blackforestlabs/flux-3/klein/edit-image/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=blackforestlabs/flux-3/klein/edit-image)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
