1. Flux-2
liangxin
  • Market
  • Image Models
    • Seedream
      • Seedream4.5 - Text to Image
      • Seedream5.0 Lite - Text to Image
    • Z-image
      • Z-Image
    • Google
      • Google - Gemini 2.5 Flash Image Preview
      • Google - Nano Banana Pro
      • Google - Nano Banana Pro Flash
      • Google - imagen4-fast
      • Google - imagen4-ultra
    • Flux-2
      • Flux-2 - Pro Text to Image
        POST
  • Get Task Details
    GET
  1. Flux-2

Flux-2 - Pro Text to Image

POST
/api/v1/jobs/createTask
Create a Flux 2 Pro text-to-image task.

Model Value#

flux-2-pro

Request Body#

FieldTypeRequiredNotes
modelstringYesMust be flux-2-pro.
callBackUrlstringNoPublic HTTPS URL for final callback.
input.promptstringYesNon-empty prompt.
input.widthintegerNoMust be provided together with height; range 256 to 1440. Defaults to 1024 when both dimensions are omitted.
input.heightintegerNoMust be provided together with width; range 256 to 1440. Defaults to 768 when both dimensions are omitted.
input.aspect_ratiostringNoAlternative to explicit dimensions. Supported aliases map to dimensions: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9.
input.input_imagestringNoFirst reference image URL.
input.input_image_2stringNoSecond reference image URL.
input.input_image_3stringNoThird reference image URL.
input.input_image_4stringNoFourth reference image URL.
input.reference_imagesstring[]NoAlternative list form. Combined total with input_image* must be at most 4.
input.seedintegerNoOptional deterministic seed.
input.prompt_upsamplingbooleanNoOptional prompt upsampling flag.
If only one of width or height is provided, the request returns HTTP 400.

Minimal Runnable Example#

The request body shown in this page is intentionally minimal: only model and input.prompt are required. Add optional fields from the table above only when your use case needs them. To receive a webhook, add a top-level callBackUrl field with a public HTTPS URL.

Query Task Status#

Use GET /api/v1/jobs/recordInfo?taskId=... to retrieve progress and final results. For production usage, pass callBackUrl when creating the task and still keep polling as a fallback.

Callback#

callBackUrl is optional. When provided, LiangXin sends the same payload shape as recordInfo after the task reaches success or fail. Your server should return any 2xx status. Webhook delivery is retried briefly, but clients should not rely on webhooks only.

Response And Error Format#

Successful task creation returns HTTP 200 and a public taskId. Store this ID and query it with GET /api/v1/jobs/recordInfo.
Task-layer validation and upstream errors use this envelope:
{
  "code": 400,
  "msg": "input.prompt is required",
  "data": null
}
Authentication errors are returned before the task layer and use the platform error envelope:
{
  "error": {
    "message": "invalid token",
    "type": "new_api_error",
    "code": ""
  }
}
Common HTTP statuses: 400 invalid request, missing model, unsupported model, invalid model parameter, or price not configured; 401 invalid or missing API key; 403 insufficient quota or access denied; 413 request body too large; 422 upstream validation rejected the request; 429 current group/upstream load is saturated; 500 upstream or internal task error.

Request

Header Params

Body Params application/json

Examples

Responses

🟢200200 - Task accepted
application/json
Body

🟠400400 - Invalid request
🟠401401 - Invalid API key
🟠403403 - Insufficient quota or access denied
🟠413413 - Request body too large
🟠422422 - Upstream validation failed
🟠429429 - Upstream load saturated
🔴500500 - Upstream or internal error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/api/v1/jobs/createTask' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "flux-2-pro",
  "input": {
    "prompt": "A sharp commercial photo of a red running shoe splashing through rain"
  }
}'
Response Response Example
200 - 200 - Task accepted
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_flux-2-pro_1777600000000"
  }
}
Modified at 2026-05-01 06:34:47
Previous
Google - imagen4-ultra
Next
Get Task Details
Built with