Capabilities
Image generation
Pendra generates images from text prompts using diffusion models, served through the OpenAI-compatible images endpoint. Install an image model once and you can generate from the API, the SDKs, or the Playground.
Generate an image
Send a model and a prompt. Results come back as
base64-encoded PNGs in data[].b64_json — decode and write
them to disk.
from pendra import Pendra
import base64, pathlib
client = Pendra()
result = client.images.generations.create(
model="flux.1-schnell",
prompt="A misty Welsh valley at dawn, painted in oils",
)
pathlib.Path("out.png").write_bytes(base64.b64decode(result.data[0].b64_json))
Available models
Several text-to-image models are one install away — for example:
sdxl-turbo— fast 1–4 step generation.sdxl-base-1.0— Stable Diffusion XL base.stable-diffusion-1.5— the classic, small (~2 GB).flux.1-schnell— FLUX.1 [schnell], high quality (~10 GB).stable-diffusion-3.5-large-turbo— SD 3.5 Large Turbo.z-image-turbo— Z-Image Turbo, fast few-step generation.flux.2-klein-4b— FLUX.2 klein [4B], fast and compact.flux.2-klein-9b— FLUX.2 klein [9B], higher quality.qwen-image-2512— Qwen-Image 2512, strong at rendering text in images.
Browse what's available at /models?type=image.
Options
By default Pendra generates at each model's native resolution — the size
it was trained for, which gives the best quality, so you usually don't
need to set size at all. That's 512x512 for
stable-diffusion-1.5 and sdxl-turbo, and
1024x1024 for sdxl-base-1.0,
flux.1-schnell, and
stable-diffusion-3.5-large-turbo. You can still request a
specific size (WxH) when you need a particular
shape — but note that generating far from a model's native resolution can
distort the result (for example, duplicated subjects).
Use num_inference_steps to trade speed for quality: more
steps generally means a sharper, more coherent image but a slower
generation. Like size, it defaults per model — around
30 for the standard checkpoints (stable-diffusion-1.5,
sdxl-base-1.0) and just 4 for the distilled
"turbo" / "schnell" models (sdxl-turbo,
flux.1-schnell, stable-diffusion-3.5-large-turbo),
which are built to converge in a handful of steps — so you usually don't
need to set it. The newer models ship their own tuned defaults too —
around 8 for z-image-turbo and the
flux.2-klein models, and 20 for
qwen-image-2512 — so the same "leave it unset" advice applies.
Also tune n (up to 4 images), negative_prompt,
and seed for reproducibility. Generation is slower than chat
— expect a few to thirty seconds depending on model, size, and steps — so
render a spinner in interactive UIs.