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/generations

Request#

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 in capabilities.sizes; omit it for the model’s default. The size decides the price tier.
nintegeroptionaldefault 1
Only 1 is accepted. Send several requests for several images.
response_formatstringoptionaldefault b64_json
Only b64_json is available; url is refused with 400.
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 prices block from GET /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#

StatusCodeMeaning
400size_unsupportedThe size is not one the model offers; the message lists them.
400response_format_unsupportedOnly b64_json is available.
400n_unsupportedOne image per request.
400model_wrong_modalityThe model is not an image model.
404model_not_foundNot in the catalog, or not in your key’s allowlist.
503media_unavailableThe 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.