> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/ai/ai-model-hub/models/image-generation-models/flux-2-klein-4b.md).

# FLUX.2-klein-4B

**Summary:** FLUX.2-klein-4B is a compact, efficient text-to-image model developed by Black Forest Labs, designed to deliver high-quality image generation with a reduced 4B parameter footprint. Building on the FLUX architecture, the klein variant prioritises speed and resource efficiency while maintaining strong visual fidelity, making it well-suited for content creation, rapid prototyping, and applications where low-latency generation is essential.

|                                                                                                                                                                                                                                    **Image quality**                                                                                                                                                                                                                                   |                                                                                                                                                                                                                                                                                                                                         **Speed**                                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                                                                                          **Input**                                                                                                                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                       **Output**                                                                                                                                                                                                                                                                                                                                       |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| ![Intelligence active](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-b23196ddc0cba1be0b981aa5572379cec1538be3%2Fai-model-hub-intelligence.png?alt=media)![Intelligence active](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-b23196ddc0cba1be0b981aa5572379cec1538be3%2Fai-model-hub-intelligence.png?alt=media) | ![Speed active](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-be3201cb2eba83650220699adf5b3d9120c83377%2Fai-model-hub-speed.png?alt=media) ![Speed active](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-be3201cb2eba83650220699adf5b3d9120c83377%2Fai-model-hub-speed.png?alt=media) ![Speed active](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-be3201cb2eba83650220699adf5b3d9120c83377%2Fai-model-hub-speed.png?alt=media) | ![Text active](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-cc6707e286bceb4641047e45e095950e8db880fd%2Fai-model-hub-text.png?alt=media) ![Image inactive](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-bac2752d06f18e86dc7f0b9531ab32ec58f30aec%2Fai-model-hub-image.png?alt=media) ![Audio inactive](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-8b0332538fcac6644893a504f9fbbd1ba2b56d21%2Fai-model-hub-audio.png?alt=media) | ![Model icon](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-5836c279ec99bb7eede99a473d3e251311a90f71%2Fai-model-hub-text.png?alt=media) ![Model icon](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-c461ddda51ca34c71f1e06542247105a4745c243%2Fai-model-hub-image.png?alt=media) ![Audio inactive](https://1737632334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MifAzdGvKLDTtvJP8sm%2Fuploads%2Fgit-blob-8b0332538fcac6644893a504f9fbbd1ba2b56d21%2Fai-model-hub-audio.png?alt=media) |
|                                                                                                                                                                                                                                        *Medium*                                                                                                                                                                                                                                        |                                                                                                                                                                                                                                                                                                                                           *High*                                                                                                                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                            *Text*                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                                                                                                                                                                                                         *Image*                                                                                                                                                                                                                                                                                                                                        |

## Central parameters

**Description:** Compact 4B-parameter image generation model optimised for fast, high-quality visual output with low resource overhead.

**Model identifier:** `black-forest-labs/FLUX.2-klein-4B`

## IONOS CLOUD AI Model Hub lifecycle and alternatives

| <code class="expression">space.vars.ionos\_cloud</code> **start date** | **End of Life** | **Alternative** | **Successor** |
| :--------------------------------------------------------------------: | :-------------: | :-------------: | :-----------: |
|                             *June 16, 2026*                            |       N/A       |       N/A       |               |

## Origin

|                                **Provider**                               | **Country** |                           **License**                           | **Flavor** | **Release** |
| :-----------------------------------------------------------------------: | :---------: | :-------------------------------------------------------------: | :--------: | :---------: |
| [<mark style="color:blue;">**Black Forest Labs**</mark>](https://bfl.ai/) |   Germany   | [<mark style="color:blue;">**License**</mark>](https://bfl.ai/) |    Base    |    *TBD*    |

## Technology

| **Input Length** | **Iterations** | **Quantization** | **Multilingual** |                                      **Further details**                                      |
| :--------------: | :------------: | :--------------: | :--------------: | :-------------------------------------------------------------------------------------------: |
|       *256*      |       *4*      |      *8bit*      |       *Yes*      | [<mark style="color:blue;">**Hugging Face**</mark>](https://huggingface.co/black-forest-labs) |

## Modalities

| **Text** | **Image** |   **Audio**   |
| :------: | :-------: | :-----------: |
|   Input  |   Output  | Not supported |

## Endpoints

| **Chat Completions** | **Embeddings** |  **Image generation** | **Image editing** |
| :------------------: | :------------: | :-------------------: | :---------------: |
|     Not supported    |  Not supported | v1/images/generations |  v1/images/edits  |

## Features

| **Streaming** | **Reasoning** | **Tool calling** | **Image editing** |
| :-----------: | :-----------: | :--------------: | :---------------: |
| Not supported | Not supported |   Not supported  |     Supported     |

## Usage example

| **Parameter**   | **Values**                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `n`             | An integer between `1` and `10` (inclusive). **Limit:** The total output cannot exceed 12,582,912 pixels per request (`n` × width × height). For example, if requesting `2048x2048` images, `n` can be at most `3`.                                                                                                                                                                                  |
| `output_format` | `jpg`, `jpeg`, `png`, `webp`                                                                                                                                                                                                                                                                                                                                                                         |
| `size`          | A string in `widthxheight` format. Both dimensions must be between 64 and 2048 (inclusive) and are automatically rounded down to the nearest multiple of 16. The default for image generation is `1024x1024`. For image editing, the default is the input image's aspect ratio and size, scaled down to fit these limits. Examples: `1024x1024`, `1536x1024`, `1024x1536`, `2048x2048`, `2048x1152`. |

Image editing requires a single input image with a minimum dimension of 64 pixels on each side and an aspect ratio no more extreme than 8 to 1 (or 1 to 8). Requests that do not meet these limits are rejected with a `400 Bad Request` error detailing the exceeded limit.

### Generate an Image

The following example demonstrates how to generate an image using **FLUX.2-klein-4B**.

**API Endpoint:** `POST https://openai.inference.de-txl.ionos.com/v1/images/generations`

**Request:**

```json
{
  "model": "black-forest-labs/FLUX.2-klein-4B",
  "prompt": "A futuristic city with flying cars at sunset",
  "n": 1,
  "size": "1024x1024",
  "output_format": "jpeg"
}
```

**Response:**

```json
{
  "created": 1589478378,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
    }
  ]
}
```

### Edit an image

The following example demonstrates how to edit an image using **FLUX.2-klein-4B**.

**API Endpoint:** `POST https://openai.inference.de-txl.ionos.com/v1/images/edits`

**Request format:** `multipart/form-data`

**Request:**

```json
{
  "model": "black-forest-labs/FLUX.2-klein-4B",
  "prompt": "Add a rainbow in the sky above the cityscape",
  "url": "https://example.com/cityscape.png",
  "n": 1,
  "size": "1024x1024",
  "response_format": "b64_json"
}
```

**Response:**

```json
{
  "created": 1589478378,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
    }
  ]
}
```

## Rate limits

Rate limits ensure fair usage and reliable access to the AI Model Hub. The [<mark style="color:blue;">default rate limits</mark>](/cloud/ai/ai-model-hub/how-tos/rate-limits.md) apply to this model, separately from other models.

The default limit is 5 requests per second, with bursts of up to 10 requests. Each request counts once, however many images it generates.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ionos.com/cloud/ai/ai-model-hub/models/image-generation-models/flux-2-klein-4b.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
