Image generation
POST /v1/images/generations
Request body
| Parameter | Type | Description |
|---|---|---|
model |
string | Image model. Use schnell (fast) or dev (quality). Required |
prompt |
string | Text description of the image to generate. Required |
size |
string | Image dimensions. Default 1024x1024. |
n |
integer | Number of images to generate. Default 1. |
response_format |
string | url (default) or b64_json for base64-encoded image data. |
Example request
import os
from openai import OpenAI
client = OpenAI(
base_url="https://router.appelon.ai/v1",
api_key=os.environ["APPELON_API_KEY"]
)
response = client.images.generate(
model="schnell",
prompt="A serene Dutch landscape with windmills at sunset",
size="1024x1024"
)
image_url = response.data[0].url
print(image_url)
Response
Returns an array of image objects with URLs or base64 data.
{
"created": 1234567890,
"data": [{
"url": "https://..."
}]
}
With response_format: "b64_json":
{
"created": 1234567890,
"data": [{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}]
}
Available models
| Model | Speed | Best for |
|---|---|---|
schnell |
~2s | Rapid iteration, prototyping |
dev |
~8s | Higher quality, better prompt adherence |
Supported sizes
FLUX supports flexible aspect ratios. Common sizes:
| Size | Aspect ratio |
|---|---|
1024x1024 |
1:1 (square) |
1024x768 |
4:3 (landscape) |
768x1024 |
3:4 (portrait) |
1280x720 |
16:9 (widescreen) |
720x1280 |
9:16 (mobile) |