API reference
Generate images synchronously
/v1/images/generationsOutput 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_KEYAuthentication schemes: BearerAuth
Request
Request headers
PreferstringOptionalOptional GloopAPI async extension; use with Idempotency-Key.
- Enum
["respond-async"]
Idempotency-KeystringOptionalRequired 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_urlsarrayOptionalAccepted only by models supporting reference images; model capabilities define the count limit.
image_urls child fields (1)
[]stringOptional
modelstringRequiredPublic model ID from the current key's catalog.
promptstringRequiredGeneration prompt.
nintegerOptionalRequested output image count, still constrained by the selected model's maximum.
sizestringOptionalChoose a supported size. Aspect-ratio models use it to select proportions, without guaranteeing exact pixel dimensions.
response_formatstringOptionalModel-specific output format; do not assume every model supports every format.
userunknownOptionalJSON value defined by the selected tool's schema or protocol; do not assume fixed fields.
extra_bodyunknownOptionalJSON value defined by the selected tool's schema or protocol; do not assume fixed fields.
moderationstringOptionalModels supporting this capability default to
moderation=auto;lowrequests 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
createdintegerRequiredImage response generation time in Unix seconds.
dataarrayRequiredArray of data for the current page/catalog.
data child fields (1)
[]objectOptional[] child fields (7)
file_idstringOptionalPublic ID of a managed file for the same account and key.
storage_statusstringOptionalHistorical file archive status. New generated results are not stored automatically; use the provider results directly.
storage_errorstringOptionalPublic category for file archival failure.
expires_atintegerOptionalExpiration in Unix seconds; 0 means no fixed expiration.
urlstringOptionalAccess URL for a result or reference; signed URLs are only valid briefly.
b64_jsonstringOptionalImage Base64 string; do not request it as a URL.
revised_promptstringOptionalRevised 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
modelstringRequiredPublic model ID from the current key's catalog.
promptstringRequiredGeneration prompt.
sizestringRequiredChoose a supported size. Aspect-ratio models use it to select proportions, without guaranteeing exact pixel dimensions.
nintegerRequiredRequested output image count, still constrained by the selected model's maximum.
referencesarrayRequiredList of reference images for generation.
references child fields (1)
[]objectOptional[] child fields (3)
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_idstringOptionalPublic source task ID, for provenance only.
quote_idstringOptionalPublic quote ID; must satisfy price and request binding on creation.
idstringRequiredPublic identifier of this object, used for its corresponding detail path.
statusstringRequiredunknown is not automatically resubmitted; reserved billing may still be pending.
- Enum
["queued","dispatching","running","succeeded","partial_succeeded","failed","unknown","deleted"]
created_atintegerRequiredCreation time in Unix seconds.
updated_atintegerRequiredLast update time in Unix seconds.
reserved_quotaintegerRequiredReserved quota in platform quota units, not a USD amount.
final_quotaintegerRequiredFinal charge in platform quota units; null means not yet determined.
billing_statusstringRequiredReservation/settlement/refund status; check separately from task and archival status.
error_codestringOptionalPublic error code usable for branching logic.
error_messagestringOptionalUser-facing description processed through public error classification.
resultsarrayRequiredGenerated 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_idstringOptionalPublic ID of a managed file for the same account and key.
storage_statusstringOptionalHistorical file archive status. New generated results are not stored automatically; use the provider results directly.
storage_errorstringOptionalPublic category for file archival failure.
expires_atintegerOptionalExpiration in Unix seconds; 0 means no fixed expiration.
urlstringOptionalAccess URL for a result or reference; signed URLs are only valid briefly.
b64_jsonstringOptionalImage Base64 string; do not request it as a URL.
revised_promptstringOptionalRevised prompt returned by the service, if any.
billingobjectOptionalCaller 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_amountstringRequiredReserved USD amount as a decimal string.
final_amountstringOptionalFinal USD charge after settlement or refund. Omitted while settlement is pending.
maximum_amountstringOptionalCertified 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
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 401
The key is missing, invalid, expired, or revoked.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 402
Insufficient account or Key quota for async reservation.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 403
Insufficient IP, account, model, or tool permissions.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 404
Object/capability unavailable, or feature switch disabled.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 409
Idempotency/quote conflict, object not ready, or still referenced.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 429
Request/queue rate limit.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 500
Internal authentication or data storage failure.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional
HTTP 503
Service, pricing, or storage unavailable.
application/json
- Type
- object
- Required fields
error
errorobjectRequirederror child fields (4)
codestringOptionalmessagestringOptionaltypestringOptionalrequest_idstringOptional