---
title: "flux-klein-4b"
description: "Lightweight and fast text-to-image generation using Flux Klein 4B"
url: "https://docs.api.pruna.ai/guides/models/flux-2-klein-4b"
image: "https://docs.api.pruna.ai/_og/d/c_Ocean.takumi,title_flux-klein-4b,description_Lightweight+and+fast+text-to-image+generation+using+Flux+Klein+4B,props_eyJ0aGVtZSI6eyJtb2RlIjoibGlnaHQiLCJjb2xvcnMiOnsicHJpbWFyeSI6IiM3YzNhZWQifX19,p_Ii9ndWlkZXMvbW9kZWxzL2ZsdXgtMi1rbGVpbi00YiI,s_21Tk4zuYkN6QGRP_.png"
---

# Flux Klein 4B

Lightweight and efficient text-to-image generation with excellent speed-to-quality ratio

## [Overview](#overview)

flux-klein-4b is a compact 4 billion parameter model based on Flux architecture, optimized for fast inference while maintaining high image quality. It's ideal for applications requiring quick turnaround times without sacrificing visual fidelity.

**Rate Limit:** 150 requests per minute

**Pricing:**

| output_megapixels      | Price          |
| :--------------------- | :------------- |
| 0.25, 0.5, 1 (default) | $0.002 / image |
| 2                      | $0.003 / image |
| 4                      | $0.005 / image |

**Category:** Text-to-Image Generation

## [Quickstart](#quickstart)

### [Asynchronous Request (Default)](#asynchronous-request-default)

```bash
curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: flux-klein-4b' \
  -d '{
    "input": {
      "prompt": "A serene mountain landscape at dawn with mist rolling through the valleys",
      "aspect_ratio": "16:9"
    }
  }'
```

Response:

```text
{
  "id": "1zww7deyssrme0csqwr90phzzr",
  "model": "flux-klein-4b",
  "input": { ... },
  "get_url": "https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr"
}
```

Check status and get results:

```bash
curl -X GET 'https://api.pruna.ai/v1/predictions/status/1zww7deyssrme0csqwr90phzzr' \
  -H 'apikey: YOUR_API_KEY'
```

### [Synchronous Request (Try-Sync)](#synchronous-request-try-sync)

```bash
curl -X POST 'https://api.pruna.ai/v1/predictions' \
  -H 'Content-Type: application/json' \
  -H 'apikey: YOUR_API_KEY' \
  -H 'Model: flux-klein-4b' \
  -H 'Try-Sync: true' \
  -d '{
    "input": {
      "prompt": "A serene mountain landscape at dawn with mist rolling through the valleys",
      "aspect_ratio": "16:9"
    }
  }'
```

Response (if completed within 60 seconds):

```text
{
  "status": "succeeded",
  "generation_url": "/v1/predictions/delivery/xezq/abc123.../output.jpg"
}
```

## [Parameters](#parameters)

### [Required Parameters](#required-parameters)

| Parameter | Type   | Description                                        |
| :-------- | :----- | :------------------------------------------------- |
| prompt    | string | Text description of the image you want to generate |

### [Optional Parameters](#optional-parameters)

| Parameter              | Type    | Default | Description                                                                      |
| :--------------------- | :------ | :------ | :------------------------------------------------------------------------------- |
| aspect_ratio           | string  | "1:1"   | Aspect ratio of output. Options: "1:1", "16:9", "21:9", "3:2", "2:3", "4:5", "5:4", "3:4", "4:3", "9:16", "9:21", "match_input_image" |
| images                 | array   |         | List of input images for image-to-image generation. Maximum 5 images. Must be jpeg, png, gif, or webp |
| output_megapixels      | string  | "1"     | Resolution of the output image in megapixels. Options: "0.25", "0.5", "1", "2", "4" |
| go_fast                | boolean | false   | Run faster predictions with additional optimizations                             |
| seed                   | integer | random  | Random seed for reproducible generation                                          |
| output_format          | string  | "jpg"   | Output format: "png", "jpg", or "webp"                                           |
| output_quality         | integer | 95      | Quality for jpg/webp (0-100)                                                     |
| disable_safety_checker | boolean | false   | Disable safety checker for generated images                                      |