Flux 2 API
FLUX.2 API with VezAPI. Explore model capabilities, credit pricing, request parameters, and integration examples.
FLUX.2 API documentation
Integrate FLUX.2 with your VezAPI key. The operations below share the same authentication and account balance.
https://api.vezapi.comSend Authorization: Bearer YOUR_VEZAPI_KEY. Use a unique Idempotency-Key for each submission; reuse it only when checking the same request.
Flux-2 - Image to Image
/api/v1/jobs/createTaskModel IDs: flux-2/flex-image-to-image
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | The model name to use for generation. Required field. - Must be `flux-2/flex-image-to-image` for this endpoint Values: Default: |
callBackUrloptional | string | The URL to receive generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when generation completes - Callback includes generated content URLs and task information - Your callback endpoint should accept POST requests with JSON payload containing results - Alternatively, use the Get Task Details endpoint to poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation |
inputoptional | object | Input parameters for the generation task |
input.input_urlsrequired | array | Input reference images (1-8 images). (File URL after upload, not file content; Accepted types: image/jpeg, image/png, image/webp; Max size: 10.0MB)
|
input.promptrequired | string | Must be between 3 and 5000 characters. (Max length: 5000 characters)
|
input.aspect_ratiorequired | string | Required. Aspect ratio for the generated image. Select 'auto' to match the first input image ratio (requires input image). Values: |
input.resolutionrequired | string | Required. Output image resolution. Values: |
input.nsfw_checkeroptional | boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "flux-2/flex-image-to-image",
"input": {
"input_urls": [
"https://example.com/input.png",
"https://example.com/input.png"
],
"prompt": "Replace the can in image 2 with the can from image 1",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Response message, error description upon failure |
datarequired | object | |
data.taskIdrequired | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
Flux-2 - Text to Image
/api/v1/jobs/createTaskModel IDs: flux-2/flex-text-to-image
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | Model name for the generation task. Required field. - This endpoint must use the `flux-2/flex-text-to-image` model Values: Default: |
callBackUrloptional | string | Callback URL to receive notifications when the generation task is completed. Optional configuration, recommended for production environments. - After the task is generated, the system will POST task status and results to this URL - The callback content includes the generated resource URL and task-related information - Your callback endpoint needs to support receiving POST requests with JSON payloads - Alternatively, you can call the task details endpoint to actively poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation |
inputoptional | object | Input parameters for the generation task |
input.promptrequired | string | Generation prompt, length must be between 3-5000 characters. (Maximum length: 5000 characters)
|
input.aspect_ratiorequired | string | Required. Aspect ratio of the generated image. Values: |
input.resolutionrequired | string | Required. Output image resolution. Values: |
input.nsfw_checkeroptional | boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "flux-2/flex-text-to-image",
"input": {
"prompt": "A humanoid figure with a vintage television set for a head, featuring a green-tinted screen displaying a `Hello FLUX.2` writing in ASCII font. The figure is wearing a yellow raincoat, and there are various wires and components attached to the television. The background is cloudy and indistinct, suggesting an outdoor setting",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Response message, error description upon failure |
datarequired | object | |
data.taskIdrequired | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
Flux-2 - Pro Image to Image
/api/v1/jobs/createTaskModel IDs: flux-2/pro-image-to-image
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | The model name to use for generation. Required field. - Must be `flux-2/pro-image-to-image` for this endpoint Values: Default: |
callBackUrloptional | string | The URL to receive generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when generation completes - Callback includes generated content URLs and task information - Your callback endpoint should accept POST requests with JSON payload containing results - Alternatively, use the Get Task Details endpoint to poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation |
inputoptional | object | Input parameters for the generation task |
input.input_urlsrequired | array | Input reference images (1-8 images). (File URL after upload, not file content; Accepted types: image/jpeg, image/png, image/webp; Max size: 10.0MB)
|
input.promptrequired | string | Must be between 3 and 5000 characters. (Max length: 5000 characters)
|
input.aspect_ratiorequired | string | Required. Aspect ratio for the generated image. Select 'auto' to match the first input image ratio (requires input image). Values: |
input.resolutionrequired | string | Required. Output image resolution. Values: |
input.nsfw_checkeroptional | boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "flux-2/pro-image-to-image",
"input": {
"input_urls": [
"https://example.com/input.png",
"https://example.com/input.png"
],
"prompt": "The jar in image 1 is filled with capsules exactly same as image 2 with the exact logo",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Response message, error description upon failure |
datarequired | object | |
data.taskIdrequired | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
Flux-2 - Pro Text to Image
/api/v1/jobs/createTaskModel IDs: flux-2/pro-text-to-image
| Parameter | Type | Description & constraints |
|---|---|---|
modelrequired | string | The model name to use for generation. Required field. - Must be `flux-2/pro-text-to-image` for this endpoint Values: Default: |
callBackUrloptional | string | The URL to receive generation task completion updates. Optional but recommended for production use. - System will POST task status and results to this URL when generation completes - Callback includes generated content URLs and task information - Your callback endpoint should accept POST requests with JSON payload containing results - Alternatively, use the Get Task Details endpoint to poll task status - To ensure callback security, see [Webhook Verification Guide](/common-api/webhook-verification) for signature verification implementation |
inputoptional | object | Input parameters for the generation task |
input.promptrequired | string | Must be between 3 and 5000 characters. (Max length: 5000 characters)
|
input.aspect_ratiorequired | string | Required. Aspect ratio for the generated image. Values: |
input.resolutionrequired | string | Required. Output image resolution. Values: |
input.nsfw_checkeroptional | boolean | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request example
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "flux-2/pro-text-to-image",
"input": {
"prompt": "Hyperrealistic supermarket blister pack on clean olive green surface. No shadows. Inside: bright pink 3D letters spelling \"FLUX.2\" pressing against stretched plastic film, creating realistic deformation and reflective highlights. Bottom left corner: barcode sticker with text \"GENERATE NOW\" and \"PLAYGROUND\". Plastic shows tension wrinkles and realistic shine where stretched by the volumetric letters.",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'Responses and errors
HTTP 200
Request successful
| Parameter | Type | Description & constraints |
|---|---|---|
codeoptional | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). Values: |
msgoptional | string | Response message, error description upon failure |
datarequired | object | |
data.taskIdrequired | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
Task status and callbacks
For asynchronous tasks, keep the returned taskId. Query GET /api/v1/jobs/recordInfo?taskId=... or provide callBackUrl when creating the task. Only the account that created a task can access it or derive new resources from it.
A timeout can mean the submission was accepted. Inspect the existing request in your dashboard; do not create another task automatically. Callback delivery is retried and may arrive more than once. Deduplicate with X-VezAPI-Event-Id.
Files, logs and billing
Generated media normally follows a 14-day provider lifetime; uploaded files expire after 24 hours. Save the files you need before expiration. VezAPI streams registered files without keeping a permanent media library. Request logs are retained for two calendar months.
Credits are reserved before submission. Final deductions match actual discounted consumption one for one. Unknown usage pauses new paid requests. If available funds cannot cover final usage while protecting other reservations, settlement stays pending until funded; model usage cannot make the wallet negative. Time-based inputs require server-side metadata reads; a failed read prevents submission.
Send a request using your VezAPI key. Successful generations use your account credits.
/api/v1/jobs/createTaskYour response will appear here.
FLUX.2 API pricing
Rates below are reference estimates; final deductions equal actual discounted consumption, one for one. At the standard pack rate, 1,000 credits ≈ $10. Larger packs reduce the effective credit price.
| Specification | Credits | Unit | USD reference |
|---|---|---|---|
| Black Forest Labs Flux 2 Flex, text to image, 1.0s-1K | 14 | per image | $0.14 |
| Black Forest Labs Flux 2 Flex, text to image, 1.0s-2K | 24 | per image | $0.24 |
| Black Forest Labs Flux 2 Flex, image to image, 1.0s-2K | 24.0 | per image | $0.24 |
| Black Forest Labs flux-2 pro, text-to-image, 1.0s-2K | 7.0 | per image | $0.07 |
| Black Forest Labs Flux 2 Flex, image to image, 1.0s-1K | 14.0 | per image | $0.14 |
| Black Forest Labs flux-2 pro, image to image, 1.0s-2K | 7.0 | per image | $0.07 |
| Black Forest Labs flux-2 pro, text-to-image, 1.0s-1K | 5.0 | per image | $0.05 |
| Black Forest Labs flux-2 pro, image to image, 1.0s-1K | 5.0 | per image | $0.05 |