FLUX API
Model Introduction
Exchange Token provides FLUX image generation through two dedicated API paths:
POST /v1/flux-2-proPOST /v1/flux-2-max
Both endpoints are asynchronous. Submit a generation request first, then poll the task result with GET /v1/get_result?id=....
Calling Method
API Endpoint
text
https://api.exchangetoken.aiAuthentication
FLUX endpoints use the following authentication header:
text
x-key: YOUR_API_KEYContent Type
text
Content-Type: application/jsonSubmit an Image Generation Task
Request Paths
POST /v1/flux-2-proPOST /v1/flux-2-max
Request Example
bash
curl -X POST "https://api.exchangetoken.ai/v1/flux-2-pro" \
-H "x-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cinematic portrait of a silver robot walking in neon rain",
"width": 1024,
"height": 1024,
"seed": 42,
"safety_tolerance": 2,
"output_format": "png"
}'Submit Response
The submit API returns a task ID.
json
{
"id": "sg_img_123456"
}Query Task Result
Request Path
text
GET /v1/get_result?id=TASK_IDRequest Example
bash
curl "https://api.exchangetoken.ai/v1/get_result?id=sg_img_123456" \
-H "x-key: YOUR_API_KEY"Pending Response Example
json
{
"id": "sg_img_123456",
"status": "Pending",
"progress": "45"
}Ready Response Example
json
{
"id": "sg_img_123456",
"status": "Ready",
"output": [
{
"url": "https://cdn.example.com/generated-image.png"
}
]
}Error Response Example
json
{
"id": "sg_img_123456",
"status": "Error",
"error": {
"code": "RUNTIME_CREATE_PROVIDER_FAILED",
"message": "image generation failed"
}
}Common Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text prompt for image generation or editing |
input_image | string | No | First input image |
input_image_2 to input_image_8 | string | No | Additional input images, up to 8 total |
seed | integer | No | Optional seed for reproducible results |
width | integer | No | Output width, minimum 64 |
height | integer | No | Output height, minimum 64 |
safety_tolerance | integer | No | Integer from 0 to 5 |
output_format | string | No | Supported values: jpeg, png |
Status Values
The current FLUX query API returns these task states:
PendingReadyError
Notes
- If you need multiple reference images, send
input_imagetogether withinput_image_2throughinput_image_8in the same JSON body. - Poll the same task ID until
statuschanges toReadyorError.
