Skip to content

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

SizeRatio
1024x10241:1
512x10241:2
1024x5122:1
768x5123:2
512x7682:3
960x12803:4
1280x9604:3
720x12809:16
1280x72016:9
576x13449:21
1344x57621:9

Authentication

  • Authorization: Bearer sk-xxx (required)

Request Example

HeaderExampleRequired
Content-Typeapplication/jsonYes
AuthorizationBearer sk-xxxxYes

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

ParameterTypeRequiredDefaultDescription
promptstringYes-Text description of the image, max 1000 (or 4000) chars
modelstringYes-Model name; supports flux, flux-dev, flux-pro, flux-pro-max, flux.1.1-pro, flux-kontext-max, flux-kontext-pro
sizestringNo1:1Image size, supports related ratios or numeric formats (width/height multiples of 32)
output_formatstringNopngjpeg or png
seedintegerNo-Random seed
prompt_upsamplingbooleanNotrueEnable prompt optimization
safety_toleranceintegerNo6Safety 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?..."
    }
  ]
}