On this page
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: file links
Every image generation returns a short download link in data[0].url, alongside s3_url and app_url. Links are the delivery method — Fluxpool does not return inline base64.
- •
urlworks for 24 hours and redirects to a fresh S3 link each time.s3_urlis the storage link behind it (1 hour), andapp_urlopens the image in the app (it never expires, and needs sign-in). - •The link serves the image once the generation completes — see Async generation below.
- •To check readiness cheaply, send a
HEADtourl: it answers409until the image is done, then302.
| 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.5, seedream-5.0-flash, flux-2-max, flux-2-klein, qwen-image-2.0-pro | 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 with the links the image will be served from.
{
"created": 1785845810,
"id": "6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"status": "pending",
"model": "flux-2-pro",
"type": "image",
"data": [
{
"url": "https://api.fluxpool.ai/v1/files/6dcc89ce-964e-466e-8100-ba2bdfb6d07c?e=…&s=…",
"s3_url": "https://…amazonaws.com/…",
"app_url": "https://app.fluxpool.ai/library?space=…&asset=6dcc89ce-964e-466e-8100-ba2bdfb6d07c",
"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— Short download link (https://api.fluxpool.ai/v1/files/…), valid 24 hours. Answers409until the generation completes, then redirects to a fresh S3 link.data[].s3_url— The S3 link behind it, valid 1 hour.data[].app_url— Opens the image in your Fluxpool library. Never expires; needs sign-in to that workspace.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 short link that serves the image once it is ready.
You have two ways to check completion — poll the structured status endpoint, or poll the short link. Or skip polling and get a webhook when it finishes.
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 short link in data[0].url (no API key needed):
curl -sI "https://api.fluxpool.ai/v1/files/6dcc89ce-964e-466e-8100-ba2bdfb6d07c?e=…&s=…" It answers 409 while the image is being made and 302 to the file once it is ready.
Status values:
| Status | Description |
|---|---|
| processing | Generation is in progress |
| completed | Generation finished — data array contains results |
| failed | Generation failed — error object contains details |
Rather not poll? Webhooks (beta) send your server a signed POST when a generation completes or fails.
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
- →Webhooks & polling — Poll a generation, or get a signed webhook when it finishes
- →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!