API reference

Generate images synchronously

POST/v1/images/generations

Output counts, reference images and sizes depend on the selected model. Check its capabilities first. Single-image text-to-image models accept one output and no reference images. For aspect-ratio models, size selects a ratio and does not guarantee exact output pixels. Unsupported parameters are rejected, never silently ignored.

Boundaries for synchronous output

Output counts, reference images and sizes depend on the selected model. Check its capabilities first. Single-image text-to-image models accept one output and no reference images. For aspect-ratio models, size selects a ratio and does not guarantee exact output pixels. Unsupported parameters are rejected, never silently ignored.

For quote confirmation, long-term history, and disconnect recovery, use the persistent image workflow rather than automatically repeating synchronous generation requests. File archival headers in synchronous responses only describe the saving stage. Ordinary file retention differs from task reference protection; see Billing.

Recoverable generation (GloopAPI extension)

Default requests retain the OpenAI-compatible synchronous created / data response. For durable tasks, explicitly send Prefer: respond-async and Idempotency-Key. This is a public GloopAPI extension for all API clients, not a standard OpenAI Images asynchronous protocol.

POST /v1/images/generations
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Prefer: respond-async
Idempotency-Key: image-order-001

{"model":"lustify-v8","prompt":"A mountain lake at sunset","n":1,"size":"1024x1024","response_format":"url","moderation":"auto"}

Returns 202 Accepted, Preference-Applied: respond-async and Location: /v1/image-tasks/{id}. The body is the existing ImageTask object (id, status, billing_status, results), not a synchronous data array. The server freezes the current price and uses normal Key permissions, reservations, workers and archival. This accepts the current price directly; use image-quotes / image-tasks when the user must confirm a quote first.

The asynchronous entry accepts model, prompt, n, size, response_format (url or omitted), and moderation; user, image_urls and extra_body are rejected. Omitted size or auto means 1024x1024; unsupported sizes are rejected. Check /v1/image-models for capabilities. Image tasks and file storage must be enabled.

Save the request key and task ID. Query GET /v1/image-tasks/{id}; if the first response is lost, recover through GET /v1/image-task-requests/{key}. The same Key and parameters return the original task; changed parameters return 409 idempotency_conflict. A timeout or lookup 404 does not prove that generation never ran: do not automatically resend with a new key.

After settlement, use GET /v1/image-tasks/{id}/result to read the original image result. URLs may expire. For an existing file, use file_id to obtain a download URL. If saving failed, retry with POST /v1/files/{file_id}/retry.

Image moderation

Models supporting this capability default to moderation=auto; low requests unblurred output without bypassing model restrictions. Models without this capability reject an explicit moderation parameter. Use the actual public model ID; a name suffix does not change model behavior.

Authentication and permissions

Use your current GloopAPI key. Available models, capabilities and permissions depend on its catalog and the endpoint documentation.

Authorization: Bearer $GLOOP_API_KEY

Authentication schemes: BearerAuth

Request

Request headers

  • PreferstringOptional

    Optional GloopAPI async extension; use with Idempotency-Key.

    Enum
    ["respond-async"]
  • Idempotency-KeystringOptional

    Required in async mode; same Key and parameters recover the original task; different parameters return 409.

    Maximum length
    191

Request body · application/json

Type
object
Required fields
modelprompt

Request body required

  • image_urlsarrayOptional

    Accepted only by models supporting reference images; model capabilities define the count limit.

    image_urls child fields (1)
    • []stringOptional
  • modelstringRequired

    Public model ID from the current key's catalog.

  • promptstringRequired

    Generation prompt.

  • nintegerOptional

    Requested output image count, still constrained by the selected model's maximum.

  • sizestringOptional

    Choose a supported size. Aspect-ratio models use it to select proportions, without guaranteeing exact pixel dimensions.

  • response_formatstringOptional

    Model-specific output format; do not assume every model supports every format.

  • userunknownOptional

    JSON value defined by the selected tool's schema or protocol; do not assume fixed fields.

  • extra_bodyunknownOptional

    JSON value defined by the selected tool's schema or protocol; do not assume fixed fields.

  • moderationstringOptional

    Models supporting this capability default to moderation=auto; low requests unblurred output without bypassing model restrictions. Models without this capability reject an explicit moderation parameter. Use the actual public model ID; a name suffix does not change model behavior.

    Enum
    ["auto","low"]

Responses and errors

HTTP 200

Images generated synchronously successfully

application/json

Type
object
Required fields
createddata
  • createdintegerRequired

    Image response generation time in Unix seconds.

  • dataarrayRequired

    Array of data for the current page/catalog.

    data child fields (1)
    • []objectOptional
      [] child fields (7)
      • file_idstringOptional

        Public ID of a managed file for the same account and key.

      • storage_statusstringOptional

        Historical file archive status. New generated results are not stored automatically; use the provider results directly.

      • storage_errorstringOptional

        Public category for file archival failure.

      • expires_atintegerOptional

        Expiration in Unix seconds; 0 means no fixed expiration.

      • urlstringOptional

        Access URL for a result or reference; signed URLs are only valid briefly.

      • b64_jsonstringOptional

        Image Base64 string; do not request it as a URL.

      • revised_promptstringOptional

        Revised prompt returned by the service, if any.

HTTP 202

Recoverable image task accepted (GloopAPI extension).

Response header Location
{"schema":{"type":"string"},"description":"/v1/image-tasks/{id}"}
Response header Preference-Applied
{"schema":{"type":"string","enum":["respond-async"]}}

application/json

Type
object
Required fields
modelpromptsizenreferencesidstatuscreated_atupdated_atreserved_quotafinal_quotabilling_statusresults
  • modelstringRequired

    Public model ID from the current key's catalog.

  • promptstringRequired

    Generation prompt.

  • sizestringRequired

    Choose a supported size. Aspect-ratio models use it to select proportions, without guaranteeing exact pixel dimensions.

  • nintegerRequired

    Requested output image count, still constrained by the selected model's maximum.

  • referencesarrayRequired

    List of reference images for generation.

    references child fields (1)
    • []objectOptional
      [] child fields (3)
      • file_idstringOptional

        Public ID of a managed file for the same account and key.

      • asset_idstringOptional

        Upload asset ID for the same account and key.

      • urlstringOptional

        Public HTTPS URL; userinfo and fragment are prohibited, and SSRF checks apply.

        Format
        "uri"
      oneOf branch 1

      Required in this branch: file_id

      oneOf branch 2

      Required in this branch: asset_id

      oneOf branch 3

      Required in this branch: url

  • source_task_idstringOptional

    Public source task ID, for provenance only.

  • quote_idstringOptional

    Public quote ID; must satisfy price and request binding on creation.

  • idstringRequired

    Public identifier of this object, used for its corresponding detail path.

  • statusstringRequired

    unknown is not automatically resubmitted; reserved billing may still be pending.

    Enum
    ["queued","dispatching","running","succeeded","partial_succeeded","failed","unknown","deleted"]
  • created_atintegerRequired

    Creation time in Unix seconds.

  • updated_atintegerRequired

    Last update time in Unix seconds.

  • reserved_quotaintegerRequired

    Reserved quota in platform quota units, not a USD amount.

  • final_quotaintegerRequired

    Final charge in platform quota units; null means not yet determined.

  • billing_statusstringRequired

    Reservation/settlement/refund status; check separately from task and archival status.

  • error_codestringOptional

    Public error code usable for branching logic.

  • error_messagestringOptional

    User-facing description processed through public error classification.

  • resultsarrayRequired

    Generated output item. New results are not stored automatically; each historical file has its own storage state.

    results child fields (1)
    • []objectOptional
      [] child fields (7)
      • file_idstringOptional

        Public ID of a managed file for the same account and key.

      • storage_statusstringOptional

        Historical file archive status. New generated results are not stored automatically; use the provider results directly.

      • storage_errorstringOptional

        Public category for file archival failure.

      • expires_atintegerOptional

        Expiration in Unix seconds; 0 means no fixed expiration.

      • urlstringOptional

        Access URL for a result or reference; signed URLs are only valid briefly.

      • b64_jsonstringOptional

        Image Base64 string; do not request it as a URL.

      • revised_promptstringOptional

        Revised prompt returned by the service, if any.

  • billingobjectOptional

    Caller USD charge converted using the task’s frozen quota scale. final_amount is present only after settlement or refund; a missing amount does not mean zero cost.

    billing child fields (4)
    • currencystringRequired
      Enum
      ["USD"]
    • reserved_amountstringRequired

      Reserved USD amount as a decimal string.

    • final_amountstringOptional

      Final USD charge after settlement or refund. Omitted while settlement is pending.

    • maximum_amountstringOptional

      Certified maximum USD wallet charge under the frozen image quote. Missing means no maximum is certified; reserved_amount alone is not a maximum.

HTTP 400

Invalid request fields or parameters.

application/json

Type
object
Required fields
error

HTTP 401

The key is missing, invalid, expired, or revoked.

application/json

Type
object
Required fields
error

HTTP 402

Insufficient account or Key quota for async reservation.

application/json

Type
object
Required fields
error

HTTP 403

Insufficient IP, account, model, or tool permissions.

application/json

Type
object
Required fields
error

HTTP 404

Object/capability unavailable, or feature switch disabled.

application/json

Type
object
Required fields
error

HTTP 409

Idempotency/quote conflict, object not ready, or still referenced.

application/json

Type
object
Required fields
error

HTTP 429

Request/queue rate limit.

application/json

Type
object
Required fields
error

HTTP 500

Internal authentication or data storage failure.

application/json

Type
object
Required fields
error

HTTP 503

Service, pricing, or storage unavailable.

application/json

Type
object
Required fields
error