Skip to main content
Menu
Build / Image generation
Build

Image generation

Generate images from a text prompt with a model of kind image, returned inline as base64.

3 minute readUpdated 13 November 2026curl · Python · TypeScript

Generate an image#

POST /v1/images/generations generates up to 4 images from a prompt.

No model of kind image is offered yet
The model catalog has no model of this kind today, so this endpoint answers 404 model_not_found for every model id. The samples below show the request for when one is offered.

Set PANWARD_IMAGE_MODEL to the id of a model of kind image from the model catalog. An id that is not a canonical id answers 404 model_not_found.

cat > body.json <<EOF
{"model": "$PANWARD_IMAGE_MODEL", "prompt": "A plain line drawing of a hospital ward", "n": 1}
EOF

curl https://api.panward.ai/v1/images/generations \
  -H "Authorization: Bearer $PANWARD_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json -o image.json
jq -r '.data[0].b64_json' image.json | base64 --decode > ward.png

Images are returned inline#

Images come back in the response as base64 in b64_json. Panward stores no inference content, so hosted image URLs are not offered: response_format: "url" is refused with 400 unsupported_parameter. Decode and save the images yourself, as the samples do.

Request fields#

FieldRequiredValuesLimitsNotes
modelYesstringCanonical id of a model of kind `image`.
promptYesstringmax length 32000
nNointegermin 1; max 4
sizeNostringWidth x height in pixels; allowed values depend on the model.
response_formatNob64_jsonOnly inline base64 is offered; `url` returns `400 unsupported_parameter`.
seedNointeger
userNostringmax length 256Accepted for compatibility and ignored. Never stored, never forwarded upstream.
The user field is accepted for compatibility and ignored. It is never stored and never forwarded upstream.

Receipts and billing#

The receipt's response.emitted hash covers the whole JSON body, base64 included, so keep the response as received if you want to verify it.

The response carries the same headers as a chat completion, among them panward-receipt-id, panward-tier and panward-region, and the request has a receipt like any other (Receipts and verification). panward-hold-until-verified: true is accepted: the response waits until the verification level is known and the answer is 503 verification_unavailable instead of an unverified one.

Images are billed per image.

Was this page helpful?Suggest an edit