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
A misty Welsh valley at dawn, painted in oils, generated by Pendra

Models

  • z-image-turbo is fast and a good place to start.
  • qwen-image-2512 is best at putting readable text in an image.
  • flux-3-image-klein, flux.2-klein, krea-2-turbo, sdxl-turbo and stable-diffusion-3.5-large-turbo are also available.

See them all in the models list.

Options

  • n makes up to 4 images at once.
  • negative_prompt describes what to leave out.
  • seed gives you the same image again for the same prompt.
  • size sets the shape, such as 1024x768.
  • num_inference_steps trades 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.