Developer Resources
Flux 2 API Documentation
Integrate state-of-the-art Flux.1 & Flux.2 generation models into your applications. Simple, scalable, and built for developers.
1 Authentication
The Flux 2 API uses Bearer Token authentication. Pass your API Key in the request header.
Authorization: Bearer sk-your-api-key-here
Keep your API key secure. Do not share it in client-side code.
Available Models & Pricing
| Model Name | Type | Cost (Credits) | Description |
|---|---|---|---|
| pro-text-to-image | Text to Image | 30 Credits | High-fidelity, realistic generation. Best for professional use. |
| pro-image-to-image | Image to Image | 30 Credits | Transform existing images with high precision. |
| flex-text-to-image | Text to Image | 100 Credits | Versatile creative styles, higher cost due to complexity. |
| flex-image-to-image | Image to Image | 100 Credits | Creative image remixing and advanced style transfer. |
2 Create Task
POST
https://flux2api.com/v1/generateAsync Generation
Pricing Policy
Credits are deducted based on the model family selected. Resolution (1K/2K) does not affect price.
- Pro Models: 30 Credits per request
- Flex Models: 100 Credits per request
Initiate a generation task. The API returns a task_id immediately, which you use to poll for results.
Body Parameters
| Parameter | Type | Description |
|---|---|---|
| model | string | The Model ID (e.g., pro-text-to-image). |
| prompt | string | The text description for the image. |
| aspect_ratio | string | Optional. 1:1, 16:9, 9:16, 4:3, 3:4. Default: 1:1. |
| resolution | string | Optional. 1K or 2K. Default: 1K. |
| images | array | Required for Image-to-Image. Array of image URL strings. |
| callBackUrl | string | Optional. Webhook URL for task completion notification. |
Request Example
cURL (Pro Model - 30 Credits)
curl -X POST https://flux2api.com/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "pro-text-to-image",
"prompt": "A futuristic cyberpunk city with neon lights, realistic style",
"aspect_ratio": "16:9",
"resolution": "1K"
}'Image-to-Image Example (Flex Model - 100 Credits)
{
"model": "flex-image-to-image",
"prompt": "Turn the cat into a tiger",
"images": [
"https://example.com/cat.jpg"
]
}Success Response
{
"code": 200,
"message": "success",
"data": {
"task_id": "npro89sfd789sdf789sdf789grsa"
}
}3 Check Status
GET
https://flux2api.com/v1/statusPoll this endpoint to check the progress of your task. We recommend polling every 2-3 seconds.
Query Parameters
| task_id | The ID received from the generate endpoint. |
cURL
curl -X GET "https://flux2api.com/v1/status?task_id=npro89sfd789sdf789sdf789grsa" \
-H "Authorization: Bearer YOUR_API_KEY"Response (Completed)
{
"code": 200,
"message": "success",
"data": {
"task_id": "npro89sfd789sdf789sdf789grsa",
"status": "SUCCESS", // Status: PENDING, RUNNING, SUCCESS, FAILED
"response": [
"https://generated-image-url.com/image1.png" // Array of result URLs
],
"created_at": "2024-03-20T10:00:00Z"
}
}Need Help?
Check out our support channel or email us.
