Image Generation
Generate images with curated AI models through a single OpenAI-compatible endpoint.
The image generation endpoint accepts a text prompt and returns one or more generated images. All image models use the same request format — switch models by changing one parameter.
Requires authentication via Bearer token. See Authentication.
Send a JSON body with the following parameters:
The text description of the image to generate.
"prompt": "A dragon perched on a neon-lit Tokyo rooftop at midnight, cinematic lighting, 8K" - •Maximum length: 4,000 characters (model-dependent — some models support longer prompts)
- •Supports English and multilingual prompts (model-dependent — Qwen-family models have strong multilingual support)
- •More descriptive prompts generally produce better results
The model to use for generation. See Supported Models below.
"model": "flux-2-pro" - •Defaults to
flux-2-proif omitted - •Each model has different capabilities, speeds, and costs
- •See the full model list: Models Reference
The dimensions of the generated image. Format: WIDTHxHEIGHT.
"size": "1024x1024" Default: 1024x1024
- •Common values:
512x512,1024x1024,1024x1536,1536x1024. Some models accept up to2048x2048. - •Fluxpool maps
sizeto the provider's aspect-ratio input when appropriate. You can also pass an explicitparameters.aspect_ratiofor finer control. - •Requesting an unsupported size for a model returns a
400error - •Larger sizes cost more — see Pricing
Return: presigned URL
Every image generation returns an S3 presigned URL in data[0].url. This is the canonical delivery method — Fluxpool does not currently support inline base64 responses.
- •Presigned URLs are valid for 1 hour. Download or persist the image before it expires.
- •The URL becomes fetchable once the generation completes — see Async & polling below.
- •To check readiness cheaply, do
GETthe URL with headerRange: bytes=0-0(S3 presigned GET URLs rejectHEAD).
| Parameter | Type | Default | Description |
|---|---|---|---|
| parameters.aspect_ratio | string | null | Explicit aspect ratio override (e.g. "16:9", "1:1"). Takes precedence over size when both are provided. |
| parameters.negative_prompt | string | null | What to exclude from the image. Passed through to models that support it; ignored otherwise. |
| parameters.seed | integer | random | Seed for reproducible output when the underlying model supports seeding. |
| inputs | object[] | null | Preferred shape. Each item is {type, source, value}. source: "url" for hosted images, source: "data" for base64 data-URIs (server uploads them inline; ~4.5MB decoded cap per item). See Image-to-Image. |
| input_images | string[] | null | Legacy. Prefer inputs. Array of https:// URLs for image-to-image workflows, kept for backwards compatibility. |
| edit_mode | string | null | Editing mode flag for supported edit-capable models. |
Not all parameters are supported by all models. Unsupported parameters are silently ignored. See Models Reference for per-model parameter support.
The live catalog of image models is served by the API. Call GET /v1/models to see everything you can call today and pick a model whose id to pass in the model parameter.
| Model ID | Notes |
|---|---|
flux-2-pro | Verified example — safe default for testing the endpoint. |
seedream-5.0, seedream-5.0-flash, flux-2-max, flux-2-klein, qwen-image-2.0-pro, qwen-image-max | Also available; fetch GET /v1/models for the authoritative list. |
More models are added regularly. See Models Reference for the up-to-date catalog and the Changelog for new additions.
A successful request returns a JSON object with a generation id, a top-level status, and a data[] array containing at least one presigned S3 URL.
{
"created": 1785845810,
"id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "pending",
"model": "flux-2-pro",
"type": "image",
"data": [
{
"url": "https://fluxpool-output.s3.ap-southeast-1.amazonaws.com/...?X-Amz-...",
"generation_id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "pending",
"model": "flux-2-pro",
"revised_prompt": null
}
]
} Field descriptions:
id— Generation ID. Use this to pollGET /v1/generations/{id}.status— One ofpending,processing,completed,failed.created— Unix timestamp the generation was accepted.type—imagefor this endpoint.data[].url— Presigned S3 URL. Becomes fetchable once the generation completes; expires 1 hour after issue.data[].revised_prompt— Prompt as revised by the model, if applicable. Usuallynull.
Image generations on Fluxpool are always asynchronous. The POST returns immediately with a generation id, a top-level status, and a presigned S3 URL that becomes fetchable once the image is ready.
You have two ways to check completion — poll the presigned URL directly, or poll the structured status endpoint.
Option 1 — poll the generation status endpoint:
curl https://api.fluxpool.ai/v1/generations/6dcc89ce-964e-466e-8100-ba2bdfb6d07c \
-H "Authorization: Bearer fp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Option 2 — poll the presigned S3 URL directly (cheapest with a byte-range GET):
curl -I --range 0-0 "https://fluxpool-output.s3.ap-southeast-1.amazonaws.com/...?X-Amz-..." Note: S3 presigned GET URLs reject HEAD with a 403. Use GET with Range: bytes=0-0 for a cheap readiness probe.
Status values:
| Status | Description |
|---|---|
| processing | Generation is in progress |
| completed | Generation finished — data array contains results |
| failed | Generation failed — error object contains details |
Webhook delivery is on the roadmap — see Async & polling. Until then, poll one of the two endpoints above.
Errors return a JSON object with an error field.
{
"error": {
"code": "invalid_model",
"message": "Model 'flux-9.9-ultra' is not available.",
"type": "invalid_request_error"
}
} | HTTP Status | Code | Description | Fix |
|---|---|---|---|
| 400 | invalid_request | Malformed JSON or missing required fields | Check request body format |
| 401 | unauthorized | Invalid or missing API key | Check your API key in Authentication |
| 402 | insufficient_credits | Not enough credits for this generation | Top up credits |
| 422 | invalid_parameter | Unsupported size, parameter value, or model | Check parameter constraints above |
| 429 | CONCURRENCY_LIMIT_REACHED | All of your plan's generations are running | Wait for one to finish, then retry with exponential backoff |
| 500 | internal_error | Server error | Retry after a few seconds with exponential backoff |
| 503 | model_unavailable | Model temporarily unavailable | Retry or use an alternative model |
All errors include a human-readable message. How many generations can run at once depends on your plan — see Limits.
Complete code examples. Copy, paste, generate.
from openai import OpenAI
client = OpenAI(base_url="https://api.fluxpool.ai/v1", api_key="fp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
response = client.images.generate(
model="flux-2-pro",
prompt="A dragon perched on a neon-lit Tokyo rooftop at midnight, cinematic lighting, 8K",
size="1024x1024"
)
print(response.data[0].url) Transform an existing image using a text prompt.
response = client.images.generate(
model="flux-2-pro",
prompt="Same scene but in cyberpunk style, neon lights, rain",
size="1024x1024",
extra_body={"input_images": ["https://your-cdn.com/source-image.jpg"]}
) Inline images (no upload step)
Skip the upload step by passing a base64 data URI in the new inputs field. The server decodes it and stores the file for the generation. Cap is ~4.5 MB decoded per item; larger images should be resized client-side or uploaded via the two-step flow.
import base64
with open("source.png", "rb") as f:
data_uri = f"data:image/png;base64,{base64.b64encode(f.read()).decode()}"
response = client.images.generate(
model="flux-2-pro",
prompt="Same scene but in cyberpunk style, neon lights, rain",
extra_body={"inputs": [{"type": "image", "source": "data", "value": data_uri}]}
) Payloads over ~13 MB (encoded) are refused by the gateway before they reach us. Between ~6 MB and 13 MB encoded, our own HTTP 413 fires with a message pointing at the two-step upload path.
- →Video Generation — Generate video with the same API pattern
- →Models Reference — Full parameter support per model
- →Async & polling — How to poll presigned URLs (webhooks coming soon)
- →SDKs & Libraries — Use the OpenAI SDK today
- →Pricing — Per-model generation costs
Was this page helpful?
How can we improve this page?
Thanks for your feedback!