Skip to main content
POST
  • Flux 2.0 image generation model
  • Choose flux-2-flex (faster, for quick iteration) or flux-2-pro (higher quality, better details) via the model parameter
  • Supports text-to-image and image-to-image, up to 8 reference images
  • Billed by resolution (1K/2K)
  • Async task mode, returns task_id for querying results
Important Change: For better performance and cost control, we no longer support passing base64 image data directly in image_urls. Please use the Upload Image API first to upload images and get URLs, then call this endpoint.

Authorization

string
required
All endpoints require Bearer Token authenticationGet your API Key: Visit the API Key Management Page to get your API KeyAdd to request header:

Request Parameters

string
required
Image generation model nameOptions:
  • flux-2-flex - Faster, suitable for quick iteration
  • flux-2-pro - Higher quality, better details
string
required
Text description for image generation
string
default:"1:1"
Image aspect ratioSupported aspect ratios:
  • 1:1 - Square (default)
  • 4:3 / 3:4 - Traditional display ratio
  • 16:9 / 9:16 - Widescreen/portrait
  • 3:2 / 2:3 - Standard photo
string[]
Reference image URL array for image-to-image⚠️ URL format only (base64 not supported)
  • Publicly accessible image URL (http:// or https://)
  • Use the Upload Image API to upload local images and get URLs
Limits:
  • Maximum 8 reference images
object
Metadata parameters for additional configuration options

Response

string
Unique task identifier for querying task status
string
Object type, fixed as generation.task
string
Model name used for generation
string
Task status
  • queued - Waiting to be processed
  • in_progress - Processing
  • completed - Successfully completed
  • failed - Failed
integer
Task progress percentage (0-100)
integer
Task creation timestamp (Unix timestamp)
object
Task metadata

Use Cases

Case 1: Text-to-Image (Quick Iteration)

Case 2: Text-to-Image (High Quality Output)

Case 3: Image-to-Image (Multiple Reference Images)

Case 4: Portrait Poster

Query Task ResultsImage generation is an async task. After submission, a task ID is returned. Use the Get Image Task Status endpoint to query generation progress and results.