API reference · Images
Create an image
POSThttps://api.useunbound.ai/v1/images/generations
Generates one or more images from a prompt. The exact price is held before generation; if fewer images are delivered than requested only those are charged, and a failed generation is not charged. A parameter the model does not support is rejected with 400, never silently ignored. The call waits for the result and returns it in the same response.
Headers
AuthorizationrequiredBearer <key>, with a key from Settings → API.Idempotency-KeyAny unique string up to 200 characters. Repeating a request with the same key returns the same images and is charged once.
Body
application/json
modelrequiredAn image model id from
GET /v1/models.promptrequiredWhat to generate.
nNumber of images, up to the model limit.
sizeOpenAI-style size such as
1024x1024. Mapped to the nearest aspect ratio and resolution.aspect_ratioUnbound field, for example
16:9. Takes precedence oversize.resolutionUnbound field, for example
2k. Takes precedence oversize.qualityOnly for models that declare quality levels.
seedOnly for models that support a seed.
negative_promptOnly for models that support it.
response_formatBase64 in the response, or signed links that expire after one hour.
Response
The generated images.
createdrequireddatarequiredb64_jsonBase64 image data, when
response_formatisb64_json.mime_typeSent with
b64_json.urlA signed link, when
response_formatisurl.
Errors
- 400The request is malformed, or a parameter is not supported by the model.
- 401The API key is missing, revoked or expired.
- 402Not enough credit, or the key reached its spending limit. Nothing was charged.
- 403The key does not have the scope this endpoint needs.
- 404The model does not exist or is not available through the API.
- 409The generation was cancelled before it finished. Nothing was charged.
- 429Too many requests for this key. Retry after the number of seconds in the Retry-After header.
- 502The upstream provider failed. The hold was released; you were not charged.
All errors use the envelope described in the introduction. None of them result in a charge.