---
title: "Flux 2 Klein - Create image from text"
method: POST
path: "/v1/ai/text-to-image/flux-2-klein"
tags: ["text-to-image"]
---

# Flux 2 Klein - Create image from text

`POST /v1/ai/text-to-image/flux-2-klein`

## Request

- Base URL: `https://api.magnific.com`
- URL: `https://api.magnific.com/v1/ai/text-to-image/flux-2-klein`
- Auth: API key in header `x-magnific-api-key`

Generate images with sub-second speed using FLUX.2 [klein], the fastest model in the FLUX.2 family by Black Forest Labs.

**Key Features:**
- Sub-second generation time
- Up to 4 reference images for style/subject transfer
- 10 preset aspect ratios with 1k or 2k resolution options
- Adjustable safety tolerance (0-5)
- Multiple output formats (PNG/JPEG)

**Use Cases:**
- Real-time applications requiring fast generation
- Style transfer with reference images
- Rapid prototyping and iteration
- High-volume image generation

## Request body

- Ttif2kRequestContent
  - `prompt` string, required: Text description of the image you want to generate. **FLUX.2 [klein]** is the fastest model in the FLUX.2 family, optimized for sub-second generation while maintaining high quality. It supports up to 4 reference images for style and subject transfer. **Tips for better results:** - Be specific about subjects, scenes, and visual details - Use reference images to guide style and composition - Combine prompt with reference images for best results **Examples:** - Simple: `"a mountain landscape at sunset"` - Detailed: `"portrait of a person in natural lighting, soft focus background"` - With style: `"abstract art in the style of watercolor painting"`
  - `aspect_ratio` 'square_1_1' | 'classic_4_3' | 'traditional_3_4' | 'widescreen_16_9' | 'social_story_9_16' | 'standard_3_2' | 'portrait_2_3' | 'horizontal_2_1' | 'vertical_1_2' | 'social_post_4_5': Aspect ratio of the generated image. Determines the proportional relationship between width and height. | Aspect Ratio | Base Dimensions (1k) | |--------------|---------------------| | `square_1_1` | 1024 × 1024 | | `widescreen_16_9` | 1344 × 768 | | `social_story_9_16` | 768 × 1344 | | `portrait_2_3` | 832 × 1216 | | `traditional_3_4` | 960 × 1280 | | `vertical_1_2` | 704 × 1408 | | `horizontal_2_1` | 1408 × 704 | | `social_post_4_5` | 896 × 1152 | | `standard_3_2` | 1216 × 832 | | `classic_4_3` | 1280 × 960 |
  - `resolution` '1k' | '2k': Resolution multiplier for the generated image. - `1k`: Uses base dimensions (default) - `2k`: Doubles the base dimensions (capped at 2048px per side) Final dimensions are calculated by multiplying base dimensions by the resolution factor, then scaling proportionally if either dimension exceeds 2048px, and aligning to multiples of 16.
  - `seed` integer, nullable: Random seed for reproducible results. **Use case:** Generate variations of the same image by using the same seed with modified prompts. **Valid range:** 0 to 4,294,967,295 **Default:** Random seed (if not provided)
  - `input_image` string, nullable: Base64-encoded reference image for **style/subject transfer**. **Supported formats:** JPEG, PNG **Use cases:** - Style transfer from reference images - Subject preservation - Composition guidance **Note:** Supports up to 4 reference images using `input_image`, `input_image_2`, `input_image_3`, and `input_image_4`.
  - `input_image_2` string, nullable: Second base64-encoded reference image for multi-image generation.
  - `input_image_3` string, nullable: Third base64-encoded reference image for multi-image generation.
  - `input_image_4` string, nullable: Fourth base64-encoded reference image for multi-image generation.
  - `safety_tolerance` integer: Content moderation tolerance level. **Range:** 0 to 5 - **0:** Most strict filtering - **5:** Least strict filtering **Default:** 2 **Note:** Lower values filter more content. Choose based on your application requirements.
  - `output_format` 'jpeg' | 'png', nullable: Output image format. **PNG:** Lossless, supports transparency, larger file **JPEG:** Lossy, smaller file, no transparency
  - `webhook_url` string, uri: Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.

## Response `200`

OK - Task created successfully

- CreateImageFromTextFlux200Response
  - `data` Task, required
    - `task_id` string, uuid, required: Task identifier
    - `status` 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED', required: Task status

## Other responses

- `400`: Bad Request - The server could not understand the request due to invalid syntax.
- `401`: Unauthorized - The client must authenticate itself to get the requested response.
- `500`: Internal Server Error - The server has encountered a situation it doesn't know how to handle.
- `503`: Service Unavailable

---

[API](https://skmtc.dev/magnific/apis/magnific-api.md) · [All operations](https://skmtc.dev/magnific/apis/magnific-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magnific/apis/magnific-api/revisions/60711fb082c7?raw)
