Images
Generate an image from a prompt. The request is the OpenAI Images format, so the OpenAI SDKs work unchanged; the image comes back as base64 in the response, one per request.
POST
/v1/images/generationsRequest#
curl https://api.ahurasense.com/v1/images/generations \
-H "Authorization: Bearer $AHURA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-image-2.5",
"prompt": "A small red kite over a green hill, flat illustration",
"size": "1024x1024"
}'modelstringrequired- A catalog id whose modality is
image. See Models. promptstringrequired- What to draw, up to 4,000 characters.
sizestringoptional- Width by height, such as
1024x1024. Each model lists its sizes incapabilities.sizes; omit it for the model’s default. The size decides the price tier. nintegeroptionaldefault 1- Only
1is accepted. Send several requests for several images. response_formatstringoptionaldefault b64_json- Only
b64_jsonis available;urlis refused with400. userstringoptional- An identifier for your end user, passed through.
Response#
response
{
"created": 1789744085,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAABgAAAAQACAIAAACoEwUVAAB…",
"revised_prompt": "Flat vector-style illustration: a small bright red diamond kite…"
}
]
}b64_json is the PNG, base64-encoded; decode it and write the bytes. A 1024×1024 image is roughly 1.5 MB of base64. revised_prompt is present when the model rewrote the prompt before drawing. The usual headers apply: X-Ahura-Request-Id and X-Ahura-Model.
Timing and billing#
- Generation is synchronous and takes roughly 10 to 30 seconds. Set your client timeout accordingly.
- Billed per image, at the tier the requested size falls in. The rate is in the model’s
pricesblock fromGET /v1/models; a failed request is not charged. - Image requests do not use the response cache and are not rate-limited differently from chat.
Errors#
| Status | Code | Meaning |
|---|---|---|
| 400 | size_unsupported | The size is not one the model offers; the message lists them. |
| 400 | response_format_unsupported | Only b64_json is available. |
| 400 | n_unsupported | One image per request. |
| 400 | model_wrong_modality | The model is not an image model. |
| 404 | model_not_found | Not in the catalog, or not in your key’s allowlist. |
| 503 | media_unavailable | The image service is down or overloaded. Retry after a few seconds. |
Something missing or wrong on this page? Tell us, and quote the page title.