Image GenerationFlux
Flux 2 Flex
Specialized image generation optimized for typography and fine detail preservation.
POST /v2/images/generate — model: "flux-2-flex"
Specialized model optimized for typography and preserving small details. Supports up to 10 reference images and offers fine control over inference steps and guidance strength.
See Image Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Description |
|---|---|---|
fluxParams.aspect_ratio | string | Aspect ratio in "W:H" format. Use "match_input_image" to match the first input image |
fluxParams.output_format | string | Output format: "jpg", "png", or "webp" |
fluxParams.output_quality | integer | Output quality (0–100). Not relevant for PNG |
fluxParams.seed | integer | Random seed for reproducible generation |
fluxParams.width | integer | Width (256–2048). Only used when aspect_ratio is custom |
fluxParams.height | integer | Height (256–2048). Only used when aspect_ratio is custom |
fluxParams.resolution | string | Resolution in megapixels (e.g. "1 MP", "2 MP"). Up to 4 MP |
fluxParams.input_images | string[] | Up to 10 reference image URLs for image-to-image generation |
fluxParams.steps | integer | Number of inference steps (1–50, default 30) |
fluxParams.guidance | number | Guidance scale (1.5–10, default 4.5). Controls prompt adherence |
fluxParams.prompt_upsampling | boolean | Automatically modify the prompt for more creative results |
Code examples
curl -X POST https://api.apiframe.ai/v2/images/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a poster with bold text reading SUMMER SALE 50% OFF, modern design",
"model": "flux-2-flex",
"fluxParams": {
"aspect_ratio": "9:16",
"steps": 30,
"guidance": 4.5,
"output_format": "png"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/images/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "a poster with bold text reading SUMMER SALE 50% OFF, modern design",
"model": "flux-2-flex",
"fluxParams": {
"aspect_ratio": "9:16",
"steps": 30,
"guidance": 4.5,
"output_format": "png",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "a poster with bold text reading SUMMER SALE 50% OFF, modern design",
model: "flux-2-flex",
fluxParams: { aspect_ratio: "9:16", steps: 30, guidance: 4.5, output_format: "png" },
}),
});
console.log(await response.json());Try it
POST
/v2/images/generateTry it