Endpoints
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 — higher is slower but can be sharper. When omitted,
defaults per model:
4 for the distilled turbo/schnell models
(sdxl-turbo, flux.1-schnell,
stable-diffusion-3.5-large-turbo), which converge in a handful
of steps; ~8 for z-image-turbo and
20 for flux.2-klein and
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.