Flux Image Generation
Overview
- Method:
POST - Path:
/v1/images/generations - Content-Type:
application/json - Description: This request format is consistent with OpenAI DALL-E.
Supported sizes and ratios
| Size | Ratio |
|---|---|
| 1024x1024 | 1:1 |
| 512x1024 | 1:2 |
| 1024x512 | 2:1 |
| 768x512 | 3:2 |
| 512x768 | 2:3 |
| 960x1280 | 3:4 |
| 1280x960 | 4:3 |
| 720x1280 | 9:16 |
| 1280x720 | 16:9 |
| 576x1344 | 9:21 |
| 1344x576 | 21:9 |
Authentication
Authorization: Bearer sk-xxx(required)
Request Example
Header
| Header | Example | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Authorization | Bearer sk-xxxx | Yes |
Request Body (JSON)
json
{
"prompt": "A detailed image describing a vast Stone Age city...",
"model": "flux-kontext-pro",
"size": "3:4",
"output_format": "png",
"seed": 12345,
"prompt_upsampling": true,
"safety_tolerance": 6
}Parameter Description
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| prompt | string | Yes | - | Text description of the image, max 1000 (or 4000) chars |
| model | string | Yes | - | Model name; supports flux, flux-dev, flux-pro, flux-pro-max, flux.1.1-pro, flux-kontext-max, flux-kontext-pro |
| size | string | No | 1:1 | Image size, supports related ratios or numeric formats (width/height multiples of 32) |
| output_format | string | No | png | jpeg or png |
| seed | integer | No | - | Random seed |
| prompt_upsampling | boolean | No | true | Enable prompt optimization |
| safety_tolerance | integer | No | 6 | Safety tolerance 0-6 (0 strictest, 6 lenient) |
Response Example (200)
json
{
"created": 1725007743,
"data": [
{
"revised_prompt": "A detailed image illustrating a sprawling Stone Age city...",
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-ckj8cP1MmQK3ZdLPGoozEzD9/vv/img-l4C07hxN49jraolwGOXGc6Ce.png?..."
}
]
}