Image generation
Generate an image from a text prompt. OpenAI-compatible images endpoint.
POST
/api/v1/images/generations
New to image generation? Start with the
Image generation guide. This page
is the field-by-field reference.
Body
application/json
model
string
Required
Image model ID, e.g.
sdxl-turbo. List models at /models?type=image.
prompt
string
Required
The text description of the image to generate.
size
string
default: model's native resolution
Output dimensions as
WxH. When omitted, Pendra uses the
model's native resolution (512x512 for
sdxl-turbo and flux.2-klein;
1024x1024 for flux.1-schnell,
z-image-turbo, qwen-image-2512, and
stable-diffusion-3.5-large-turbo), which gives the best
quality. Supported sizes depend on the model.
n
integer
default: 1
Number of images to generate (up to 4).
negative_prompt
string
Text describing what to avoid in the image.
num_inference_steps
integer
default: model-dependent
Diffusion steps, from 1 to 50 — higher is slower but can be sharper.
Values outside that range are rejected. When omitted, defaults to the
model's recommended step count (the Playground's default):
4 for sdxl-turbo, flux.1-schnell,
stable-diffusion-3.5-large-turbo and
flux.2-klein, which converge in a handful of steps;
8 for z-image-turbo and
krea-2-turbo; 20 for
qwen-image-2512.
seed
integer
Fix the seed for reproducible output.
response_format
string
default: b64_json
Only
b64_json is supported — responses always return a base64-encoded PNG.
Response
An OpenAI-shaped image response. data contains one entry per
requested image, each carrying a base64-encoded PNG in b64_json
— decode it before writing to disk.
Timeouts
Image requests can run up to ~30 minutes, since generation can be slow on busy workers. Pendra keeps the connection alive while the worker renders, so a long job won't be cut off mid-generation. For interactive UX, render a spinner; you'll usually get a response in 5–30 seconds depending on model and size.
Usage tracking
Image requests appear under Images in the console usage view alongside chat and embeddings.