Images
Create an image from a prompt, or upload a PNG and describe the changes you want.
Before you start
Your organisation needs an image service and a token with the images scope. Find available models with GET /v1/models?scope=images. Use one of the returned model IDs in your request; the examples below use qwen-image-2.1.
Each request returns one PNG as base64. Allow up to 15 minutes for model loading and generation, subject to your service timeout. Billed image services charge the model's token prices; request, image, pixel and concurrency limits still apply. Chat processors are not applied to image prompts or uploads.
Generate an image
/v1/images/generationsSend a text prompt as JSON.
Request
modelrequiredstring- An available image model ID or alias.
promptrequiredstring- Describe the image. Maximum 8,000 characters.
sizestring- Width x height, for example 1024x1024 (the default). Both dimensions must be multiples of 32. Default service limits are 1024 per side and 1,048,576 pixels; your administrator may configure different limits.
stepsinteger- Sampling steps, 1 to 50 by default (your administrator may configure a different range). Defaults to 40. More steps take longer and cost proportionally more.
nnumber- Only 1 is supported.
response_formatstring- Only b64_json is supported.
output_formatstring- Only png is supported.
service_iduuid- Optional service override. Omit to use your organisation default.
curl --fail-with-body --max-time 900 https://api.inferada.com/v1/images/generations \
-H "Authorization: Bearer inf_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"qwen-image-2.1","prompt":"A red fox in a snowy forest, watercolor","size":"1024x1024"}' \
-o generated-image.jsonResponse · 200
createdinteger- Response creation time in Unix seconds.
data[0].b64_jsonstring- The complete PNG encoded as base64. Decode this value to save or display the image.
usageobject- input_tokens, output_tokens and total_tokens the request is billed on. Output tokens count one per 16x16 pixel block per step (163,840 for 1024x1024 at 40 steps); input tokens cover the prompt and any reference image. Omitted when unknown.
Save the returned image:
jq -er '.data[0].b64_json' generated-image.json | base64 -d > generated-image.pngEdit an existing image
/v1/images/editsSend the same fields as generation using multipart form data, plus one PNG image.
Request
imagerequiredfile- Exactly one PNG, at most 8 MiB and within your service dimension and pixel limits.
promptrequiredstring- Describe the changes you want, up to 8,000 characters.
modelrequiredstring- An available image model ID or alias.
curl --fail-with-body --max-time 900 https://api.inferada.com/v1/images/edits \
-H "Authorization: Bearer inf_YOUR_TOKEN" \
-F model=qwen-image-2.1 \
-F 'prompt=Change the forest to autumn colors' \
-F size=1024x1024 \
-F 'image=@generated-image.png;type=image/png' \
-o edited-image.jsonResponse · 200
The response uses the same created, data[0].b64_json and usage fields as generation.
Limits and errors
Multiple images, masks, JPEG/WebP uploads, output URLs, streaming and custom sampler parameters are not supported. Unknown fields and prompt-embedded backend arguments are rejected. Invalid requests return 400 or 422. Scope or model restrictions return 403; rate or concurrency limits return 429. An unavailable service returns 503, backend failures return 502 and backend timeouts return 504. The gateway does not retry image jobs automatically.