Flux 2 API
activeHigh-quality AI image generation with excellent prompt following and photorealistic output.
Quick Start
Send a request to the Flux 2 API:
curl -X POST https://apiin.one/api/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-2",
"prompt": "A serene Japanese garden with cherry blossoms, koi pond, and wooden bridge, photorealistic",
"aspect_ratio": "16:9",
"type": "pro",
"resolution": "1K"
}'API Endpoint
/api/v1/images/generationsHeaders
| Header | Tür | Gerekli | Açıklama |
|---|---|---|---|
Authorization | string | Gerekli | Bearer YOUR_API_KEY |
Content-Type | string | Gerekli | application/json |
Body Parameters
| Parametre | Tür | Gerekli | Açıklama |
|---|---|---|---|
model | string | Gerekli | Model identifier: "flux-2" |
prompt | string | Gerekli | Text description of the image (3–5000 chars) |
aspect_ratio | string | İsteğe Bağlı | Output aspect ratio (e.g. 1:1, 16:9, 9:16) (Varsayılan: 1:1) |
type | string | İsteğe Bağlı | Generation mode: "pro" (higher quality) or "flex" (faster/cheaper) (Varsayılan: pro) |
resolution | string | İsteğe Bağlı | Output resolution: "1K" or "2K" (Varsayılan: 1K) |
input_urls | array | İsteğe Bağlı | Array of image URLs for image-to-image (max 8 images) |
Example Request
{
"model": "flux-2",
"prompt": "A serene Japanese garden with cherry blossoms, koi pond, and wooden bridge, photorealistic",
"aspect_ratio": "16:9",
"type": "pro",
"resolution": "1K"
}Example Response
Successful task creation response.
{
"code": 200,
"message": "success",
"data": {
"task_id": "n41xxxx_flux2",
"status": "IN_PROGRESS"
}
}Check Task Status
For asynchronous tasks, poll the status endpoint to check when your task is complete:
/api/v1/tasks/{task_id}curl https://apiin.one/api/v1/tasks/task_abc123 \
-H "Authorization: Bearer aio_your_key"Use Cases
- ✓Generate product mockups and marketing visuals from text descriptions
- ✓Create AI-generated artwork and illustrations for content
- ✓Build AI image generation features into your application
- ✓Produce photorealistic stock images on demand
API Tester
Test the Flux 2 API directly from your browser:
Error Codes
{
"error": {
"code": 400,
"message": "Invalid parameters",
"type": "invalid_request"
}
}Frequently Asked Questions
How much does the Flux 2 API cost?
Credits vary by mode and resolution. Pro mode at 1K costs ~10 credits, 2K costs ~20 credits. Flex mode at 1K costs ~6 credits. Free credits included on sign up.
What is the difference between Pro and Flex mode?
Pro mode produces higher quality results. Flex mode is faster and cheaper, suitable for rapid iteration. Set the "type" parameter to "pro" or "flex".
Can I use reference images?
Yes. Flux 2 supports image-to-image by providing up to 8 input image URLs via the "input_urls" parameter alongside your text prompt.
What resolutions are supported?
Flux 2 supports 1K and 2K resolution output. Set via the "resolution" parameter.
Is the Flux 2 API compatible with OpenAI?
Yes. API in One uses an OpenAI-compatible REST format. If you're already using the OpenAI Images API, switching to Flux 2 requires minimal code changes.
Why Use Flux 2 Through API in One?
Ready to use Flux 2?
Get Your API Key →