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

# Flux 2 Flex - Create image from text

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

## Request

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

Create highly customizable images using FLUX.2 [flex] from Black Forest Labs, a flexible text-to-image model with an extended resolution range.

**Key Features:**
- Professional quality with fine-grained control
- Text-to-image generation
- Image-to-image editing (up to 4 input images)
- Wide resolution range (256-1920px) for large-format output
- Adjustable guidance and inference steps
- Selectable output format (JPEG or PNG)
- Reproducible results with seed

**Use Cases:**
- Large-format marketing materials and posters
- Product photography variations
- Concept art and illustrations
- Image editing and enhancement

## Request body

- Ttif2fRequestContent
  - `prompt` string, required: Text description of the image you want to generate. **FLUX.2 [flex]** offers flexible, professional-grade image generation with fine-grained control over guidance, steps, and a wide resolution range for large-format output. **Tips for better results:** - Be specific about subjects, scenes, and visual details - Describe lighting, atmosphere, and mood - Mention art style or photographic techniques if desired **Examples:** - Simple: `"a cat sitting on a windowsill"` - Detailed: `"a fluffy orange tabby cat sitting on a rustic wooden windowsill, golden hour lighting, soft focus background"` - Creative: `"futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk aesthetic, dramatic lighting"`
  - `width` integer: Width of the image in pixels. **Valid range:** 256 to 1920 pixels **Default:** 1024 pixels **Common sizes:** - Square: 1024×1024 - Landscape: 1920×1080 (16:9) - Portrait: 1080×1920 (9:16)
  - `height` integer: Height of the image in pixels. **Valid range:** 256 to 1920 pixels **Default:** 768 pixels **Tip:** Total megapixels affect generation cost. Higher resolution = higher cost.
  - `seed` integer, nullable: Random seed for reproducible results. **Use case:** Generate variations of the same image by using the same seed with slightly modified prompts. **Valid range:** 0 to 4,294,967,295 **Default:** Random seed (if not provided)
  - `guidance` number, nullable: Guidance scale for the generation. Higher values make the model follow the prompt more closely. Valid range: 1.5 to 10.0.
  - `steps` integer, nullable: Number of inference steps. More steps generally produce higher quality but take longer. Valid range: 1 to 50.
  - `safety_tolerance` integer, nullable: Tolerance level for input and output moderation. Between 0 and 5, 0 being most strict, 5 being least strict.
  - `prompt_upsampling` boolean: Automatically enhance and expand your prompt for better generation results. **When to enable:** - Using simple, short prompts - Want AI to add creative details - Experimenting with variations **When to disable:** - Using detailed, specific prompts - Need exact control over output - Following brand guidelines
  - `output_format` 'jpeg' | 'png', nullable: Format of the output image
  - `input_image` string, nullable: Base64-encoded input image for **image-to-image generation** or **image editing**. **Supported formats:** JPEG, PNG, WebP **Use cases:** - Modify existing images - Style transfer - Composition refinement **Note:** Can provide up to 4 input images using `input_image`, `input_image_2`, `input_image_3`, and `input_image_4`.
  - `input_image_2` string, nullable: Second base64-encoded input image for multi-image generation.
  - `input_image_3` string, nullable: Third base64-encoded input image for multi-image generation.
  - `input_image_4` string, nullable: Fourth base64-encoded input image for multi-image generation.
  - `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)
