Image generation API

Generate an image from a text prompt with the Pendra API. OpenAI-compatible, with every field and each model's defaults.

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
An image model, such as z-image-turbo. See each model's defaults below.
prompt string Required
What the image should show.
size string default: the model's own size
Width and height as WxH, such as 1024x1024. Leave it out for the size the model was made for, which looks best.
n integer default: 1
How many images to make, from 1 to 4.
negative_prompt string
What the image should avoid.
num_inference_steps integer default: the model's own
From 1 to 50. More steps are slower but can be sharper.
seed integer
Set it to get the same image again for the same request.
response_format string default: b64_json
Always b64_json.

Response

data has one entry per image, each a base64-encoded PNG in b64_json. Decode it to save the file.

Each model's defaults

ModelSizeSteps
flux.1-schnell1024x10244
flux.2-klein512x5124
krea-2-turbo768x7688
qwen-image-25121024x102420
sdxl-turbo512x5124
stable-diffusion-3.5-large-turbo1024x10244
z-image-turbo1024x10248

Good to know

  • Most images take 5 to 30 seconds. A request can run for up to 30 minutes on a busy worker, and the connection stays open while it works.
  • Image requests show under Images in the console's usage view.