Image generation
Describe the image you want and get it back as a PNG.
Generate an image
Send a model and a prompt. Each image comes back
as a base64 PNG in data[].b64_json, ready to decode and save.
from pendra import Pendra
import base64, pathlib
client = Pendra(api_key="pdr_sk_...")
result = client.images.generations.create(
model="z-image-turbo",
prompt="A misty Welsh valley at dawn, painted in oils",
)
pathlib.Path("out.png").write_bytes(base64.b64decode(result.data[0].b64_json))
Response
Models
z-image-turbois fast and a good place to start.qwen-image-2512is best at putting readable text in an image.flux-3-image-klein,flux.2-klein,krea-2-turbo,sdxl-turboandstable-diffusion-3.5-large-turboare also available.
See them all in the models list.
Options
nmakes up to 4 images at once.negative_promptdescribes what to leave out.seedgives you the same image again for the same prompt.sizesets the shape, such as1024x768.num_inference_stepstrades speed for detail, from 1 to 50.
Each model already uses the size and number of steps that suit it best, so you can usually leave those two out. Sizes far from the model's own can look distorted.
An image takes a few seconds to half a minute, depending on the model and settings, so show a loading state in your app.
For every field and response, see the
Images API reference.