Images
Generate an image from a prompt, or edit and combine reference images. Every image costs the model's fixed credit price from /v1/models, charged when the image is delivered.
Generate
curl https://api.gluonart.com/v1/images/generations \
-H "Authorization: Bearer $GLUONART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-lite-image",
"prompt": "A lighthouse on a cliff at dawn, soft mist",
"aspect_ratio": "16:9"
}'
The response is OpenAI's images shape, with the image as base64:
{ "created": 1764633600, "data": [{ "b64_json": "iVBORw0KGgo..." }] }
| Field | Notes |
|---|---|
model | Required. An image model from /v1/models. |
prompt | Required, up to 4,000 characters. |
aspect_ratio or size | Optional. Use the one the model lists (aspect_ratios or sizes); anything else is refused with 400. Without either, the model's default shape is used. |
n | One image per request; n must be 1 if you send it. |
quality | Only for models priced at a fixed quality, and only that quality. |
response_format | b64_json only, which is also the default. Images always come back base64-encoded. |
Edit with reference images
Send reference images to /v1/images/edits as PNG, JPEG or WebP data URLs, up to 8 MB each and no more than the model's max_reference_images:
curl https://api.gluonart.com/v1/images/edits \
-H "Authorization: Bearer $GLUONART_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-3.0",
"prompt": "Turn this into a watercolor painting",
"images": [{ "image_url": "data:image/png;base64,iVBORw0KGgo..." }]
}'
Models that do not read images refuse references with 400, and so does /v1/images/generations — send them to /v1/images/edits. Requests are JSON only.
Errors you may see
400— a size, aspect ratio, quality or number of references the model does not take. The message lists what it does take.402— your balance does not cover the image:Not enough credits: this image costs 50 credits and your balance is 20.404— the model is not an image model on the API; the message lists the ones that are.