text-to-image

Flux 2 Klein - Create image from text

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
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

Request body

promptstring 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 RatioBase Dimensions (1k)
square_1_11024 × 1024
widescreen_16_91344 × 768
social_story_9_16768 × 1344
portrait_2_3832 × 1216
traditional_3_4960 × 1280
vertical_1_2704 × 1408
horizontal_2_11408 × 704
social_post_4_5896 × 1152
standard_3_21216 × 832
classic_4_31280 × 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.

seedinteger 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_imagestring 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_2string nullable

Second base64-encoded reference image for multi-image generation.

input_image_3string nullable

Third base64-encoded reference image for multi-image generation.

input_image_4string nullable

Fourth base64-encoded reference image for multi-image generation.

safety_toleranceinteger

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_urlstring 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.

Example request

{
  "prompt": "a beautiful sunset over the ocean with dramatic clouds",
  "aspect_ratio": "square_1_1",
  "resolution": "1k",
  "seed": 42,
  "webhook_url": "https://www.example.com/webhook"
}

Response

OK - Task created successfully

Example response

{
  "data": {
    "task_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
    "status": "CREATED"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.