Images
POST /v1/images/generations — image generation from a prompt and references.
POST /v1/images/generations generates images in the OpenAI Images format. It
works only with image models from the catalog.
Request
curl https://llmbox.cc/v1/images/generations \
-H "Authorization: Bearer $LLMBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2",
"prompt": "A fox in a neon city, watercolor",
"n": 1,
"resolution": "1K",
"quality": "medium"
}'
Response
json
{
"created": 1790000000,
"data": [{"b64_json": "iVBORw0KGgo..."}]
}
Specifics
- The response never streams, and generation may take minutes — give your client a generous timeout.
- Images come in
data[].b64_json. If the provider returns a link, the gateway downloads the file itself — the response has no links to the provider's storage. nis 1 to 10. The response contains at mostnimages, even if the model generated more. You are billed per delivered image.- Canceling (dropping the connection) after the provider accepted the
request charges the price times
n, even though no images arrive. Before that, nothing is charged (see Balance and pricing). - For GPT Image 2, the size is set by the
resolutionfield (1K,2Kor4K), and the quality byquality. - References go in the
image/imagesfields — as a link or a base64data:URL. The request body limit is 90 MiB. - Other parameters (
size,aspect_ratio,resolution,image_size,quality,background,output_format,output_compression,negative_prompt,seed) are passed to the model as is; which fields and values it supports is up to its provider. A field the model does not know may get the request rejected with400: for example, some models set the size viaimage_sizeand do not acceptaspect_ratio.
Generation errors
| HTTP | code | What to do |
|---|---|---|
| 400 | content_policy_violation | The content policy rejected the prompt — change it. |
| 400 | invalid_image | The model rejected the reference — try a different image. |
| 422 | generation_failed | The model returned no image — retry or rephrase the prompt. |
Other codes are in Errors.