Skip to content

FLUX API

Model Introduction

Exchange Token provides FLUX image generation through two dedicated API paths:

  • POST /v1/flux-2-pro
  • POST /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.ai

Authentication

FLUX endpoints use the following authentication header:

text
x-key: YOUR_API_KEY

Content Type

text
Content-Type: application/json

Submit an Image Generation Task

Request Paths

  • POST /v1/flux-2-pro
  • POST /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_ID

Request 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

ParameterTypeRequiredDescription
promptstringYesText prompt for image generation or editing
input_imagestringNoFirst input image
input_image_2 to input_image_8stringNoAdditional input images, up to 8 total
seedintegerNoOptional seed for reproducible results
widthintegerNoOutput width, minimum 64
heightintegerNoOutput height, minimum 64
safety_toleranceintegerNoInteger from 0 to 5
output_formatstringNoSupported values: jpeg, png

Status Values

The current FLUX query API returns these task states:

  • Pending
  • Ready
  • Error

Notes

  • If you need multiple reference images, send input_image together with input_image_2 through input_image_8 in the same JSON body.
  • Poll the same task ID until status changes to Ready or Error.