Skip to content
Browse the docs

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

  • Authorizationstringrequired

    Bearer <key>, with a key from Settings → API.

  • Idempotency-Keystring

    Any unique string up to 200 characters. Repeating a request with the same key returns the same images and is charged once.

Body

application/json

  • modelstringrequired

    An image model id from GET /v1/models.

  • promptstringrequired

    What to generate.

  • ninteger

    Number of images, up to the model limit.

    Minimum 1

  • sizestring

    OpenAI-style size such as 1024x1024. Mapped to the nearest aspect ratio and resolution.

  • aspect_ratiostring

    Unbound field, for example 16:9. Takes precedence over size.

  • resolutionstring

    Unbound field, for example 2k. Takes precedence over size.

  • qualitystring

    Only for models that declare quality levels.

  • seedinteger

    Only for models that support a seed.

  • negative_promptstring

    Only for models that support it.

  • response_formatstringdefault "b64_json"

    Base64 in the response, or signed links that expire after one hour.

    One ofb64_jsonurl

Response

The generated images.

  • createdintegerrequired

  • dataobject[]required

    • b64_jsonstring

      Base64 image data, when response_format is b64_json.

    • mime_typestring

      Sent with b64_json.

    • urlstring

      A signed link, when response_format is url.

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.