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 stable-diffusion-1.5 and sdxl-turbo; 1024x1024 for sdxl-base-1.0, flux.1-schnell, 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: ~30 for standard checkpoints (stable-diffusion-1.5, sdxl-base-1.0) and 4 for distilled turbo/schnell models, which converge in a handful of steps.
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.