Get API Key Get API
Docs

FLUX.2 Image Generation

Submit asynchronous FLUX.2 text-to-image or reference-image generation tasks. The API returns a task ID; poll the task endpoint for the generated image.

Request example

curl --request POST \
  --url https://api.openveer.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "flux-2-pro",
    "prompt": "A blue cat sitting on the grass",
    "resolution": "2MP",
    "size": "16:9",
    "output_format": "jpeg"
  }'

Response example

{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KFG5BBFNK1YQDTJDZY0P0QT2"
    }
  ]
}

Supported Models

Model Description
flux-2-flex Fine-grained generation with adjustable sampling steps and guidance.
flux-2-pro Balanced quality and speed for general-purpose production workflows.
flux-2-max Highest-quality FLUX.2 model for maximum detail.

All three models support text-to-image generation and reference-image generation.

Authorizations

Authorization string

All endpoints require Bearer Token authentication.

Get an API key from API Key Management, then add it to the request header:

Authorization: Bearer YOUR_API_KEY

Body

model string

Model name:

  • flux-2-flex
  • flux-2-pro
  • flux-2-max
nsfw_check boolean

Whether to run content moderation before submitting the image task.

  • true: use omni-moderation-latest to review prompts and input images
  • false or omitted: do not send a moderation request, adding no moderation cost or latency (default)
prompt string

Text description of the image to generate or the edit to apply to the reference images.

resolution string

Output resolution preset. Supported values:

  • 1MP
  • 2MP (default)
  • 3MP
  • 4MP

Here, 1MP equals 1,048,576 pixels.

Legacy aliases remain accepted: 512 / 512P / 1M map to 1MP, 1K / 1024 map to 2MP, 2K / 2048 map to 3MP, and 4K maps to 4MP. Any other value causes the task to fail.

The preset determines the output dimensions when size is an aspect ratio.

size string

Output aspect ratio or pixel dimensions.

size also supports auto: when image_urls is provided, the output follows the reference image aspect ratio while keeping the current resolution tier; without a reference image, it uses the default 1:1.

Supported size options:

  • 1:1 (default)
  • 4:3
  • 3:4
  • 16:9
  • 9:16
  • 3:2
  • 2:3
  • 21:9
  • 9:21
  • auto - Follow the reference image aspect ratio

You may also provide a pixel string such as 1024x1536. Exact pixel dimensions are subject to the same pixel limits as width and height and take priority over resolution and an aspect ratio.

width integer

Exact output width in pixels. It must be provided together with height, and each dimension must be at least 64 pixels. Supplying only one dimension causes the task to fail.

A complete width and height pair has the highest priority and overrides resolution and size.

height integer

Exact output height in pixels. It must be provided together with width, and each dimension must be at least 64 pixels. Supplying only one dimension causes the task to fail.

The output must not exceed 4 MP (width × height ≤ 4,194,304), and the output plus all reference images must not exceed 9 MP in total.

image_urls array

Reference images for image-to-image generation. Publicly accessible image URLs and Base64 input are supported.

  • Maximum: 8 images
  • The output plus all reference images must not exceed 9 MP in total
output_format string

Output image encoding. Supported values: jpeg, png, and webp.

n integer

Number of images generated per task. The only supported value is 1; submit multiple tasks concurrently if you need multiple images.

seed integer

Random seed. Reuse the same seed and parameters for reproducible output; omit it to use a random seed.

prompt_upsampling boolean

Whether to enhance and rewrite the prompt before generation. The default is false. Pass false explicitly to disable prompt rewriting.

safety_tolerance integer

Safety tolerance from 0 to 5. Higher values are more permissive.

steps integer

Sampling steps from 1 to 50. Higher values can improve detail but take longer.

This parameter is supported only by flux-2-flex. Do not send it with flux-2-pro or flux-2-max.

guidance number

Prompt guidance from 1.5 to 10. Higher values follow the prompt more closely.

This parameter is supported only by flux-2-flex. Do not send it with flux-2-pro or flux-2-max.

Resolution Reference Table

Aspect ratio 1MP 2MP (default) 3MP 4MP
1:1 1024×1024 1440×1440 1536×1536 2048×2048
4:3 1152×864 1664×1248 1824×1360 2336×1760
3:4 864×1152 1248×1664 1360×1824 1760×2336
16:9 1344×752 1920×1072 2048×1152 2720×1536
9:16 752×1344 1072×1920 1152×2048 1536×2720
3:2 1248×832 1728×1152 1872×1248 2496×1664
2:3 832×1248 1152×1728 1248×1872 1664×2496
21:9 1504×640 2176×928 2304×992 3072×1312
9:21 640×1504 928×2176 992×2304 1312×3072

Dimension priority is: paired width + height → a pixel-string size → resolution + aspect-ratio size → the default 2MP + 1:1.

Usage Examples

Text-to-image

{
  "model": "flux-2-pro",
  "prompt": "A cinematic city at night with neon reflections on wet streets",
  "resolution": "1MP",
  "size": "16:9"
}

Reference-image generation

{
  "model": "flux-2-pro",
  "prompt": "Place the person from the first image in the scene from the second image and match the lighting",
  "image_urls": [
    "https://example.com/person.jpg",
    "https://example.com/scene.jpg"
  ],
  "resolution": "2MP",
  "output_format": "webp"
}

Exact output dimensions

{
  "model": "flux-2-max",
  "prompt": "A highly detailed botanical illustration",
  "width": 1024,
  "height": 1536
}

FLUX.2 Flex controls

{
  "model": "flux-2-flex",
  "prompt": "A minimalist poster with the headline SUMMER SALE and the subheading 50% OFF",
  "resolution": "3MP",
  "size": "3:4",
  "steps": 50,
  "guidance": 6.5
}

Response

code integer

Response status code.

data array
Submission result array.
status string

Submission status. A successfully accepted task returns submitted.

task_id string

Unique task identifier. Use it to poll the task endpoint.

Retrieve the Result

Poll GET /v1/tasks/{task_id} until the task reaches completed or failed. See the Task Status API for the complete response schema.

Task statuses:

Status Meaning
submitted / pending Accepted or queued; continue polling.
processing Image generation is in progress; continue polling.
completed Generation succeeded; the image is available in result.images.
failed Generation failed; read data.error.message. The task is fully refunded.

A completed task includes one generated image:

{
  "code": 200,
  "data": {
    "id": "task_01KFG5BBFNK1YQDTJDZY0P0QT2",
    "status": "completed",
    "progress": 100,
    "result": {
      "images": [
        {
          "url": ["https://upload.openveer.com/f/image/xxxxxxxx-flux-2.jpeg"],
          "expires_at": 1785220083
        }
      ]
    }
  }
}

The image URL is data.result.images[0].url[0]. Its expiration is defined by the Unix timestamp in data.result.images[0].expires_at; download the image before that time.

Invalid parameters and failed tasks

Invalid model parameters do not produce a synchronous 4xx response. The submission still returns HTTP 200 with a task_id; keep polling until the task becomes failed, then read the specific reason from data.error.message. Failed tasks are fully refunded.

{
  "code": 200,
  "data": {
    "status": "failed",
    "error": {
      "type": "task_failed",
      "code": "task_failed",
      "message": "`steps` must be between 1 and 50 (got 0)"
    }
  }
}

error.code is always task_failed; the specific reason is in error.message.

Notes

  1. Tasks are processed asynchronously. The submission response returns a task_id for polling.
  2. n defaults to 1, which is the only supported value.
  3. Reference images may use publicly accessible image URLs or Base64 input.
  4. Up to 8 reference images are supported, subject to the 9 MP combined input-and-output limit.
  5. Exact output dimensions can be set with a pixel-string size, or with paired width and height. When used, both dimensions must be at least 64 pixels; output is limited to 4 MP.
  6. Result URL expiration is determined by the expires_at value returned in the task response.
  7. Invalid model parameters are returned asynchronously: poll until failed and read data.error.message.

This documentation is built and hosted on Mintlify, a developer documentation platform.