Image generations
Pictures an AI model draws straight into the library: one run per picture, drawn in the background — create it, read it until it ends, and its media_id is the new file. Pictures of the library to work from make it an edit; :cancel stops one the provider has not drawn yet.
List image generations
One picture drawn by an AI model for this website and put into its media library: what was asked — the prompt, the model, the size, the pictures it worked from — whether it is done, the file it became and what it cost. The picture is drawn in the background — create the run, then read it until state is final.
path Parameters
website_idId of the parent website.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: create_time desc. Sortable: create_time.
filterAIP-160 subset (§8). Filterable: create_time, media_id, model_id, state. A field outside the list is INVALID_ARGUMENT.
List image generations › Responses
One page of image_generations.
This page of image_generations, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Create image generation
Draws one picture with an AI model and puts it into the website's media library. Answers at once with the run, RUNNING, and its deadline_time: the picture is drawn in the background, so read the run until state is SUCCEEDED — its media_id is the new file — FAILED or CANCELLED.
Name the model with model_id (one with the IMAGE_GENERATION capability) and say what to draw in prompt. To change a picture or show a product, list up to four files of the library in reference_media_ids; that needs a model with IMAGE_EDITING, and a TRANSPARENT background one with TRANSPARENT_BACKGROUND. The file is stored with title and alt_text in folder_id, or in the library's «AI Images» folder.
Refused before anything is drawn: a blank prompt, a size outside 64–4096 pixels, a picture to work from that is not a PNG, JPEG or WebP file of this library, a folder that is not of it (INVALID_ARGUMENT); more pictures in the last minute than the account may start, or every place of the service's pool taken (RESOURCE_EXHAUSTED, with the seconds to wait). What the AI platform refuses — a model that cannot do what is asked, no connection the account may use, the balance — and what the provider fails at, such as a prompt it will not draw, end the run FAILED with the reason in its error. Send a request_id to make the call safe to repeat: a repeat returns the first run and draws nothing.
path Parameters
website_idId of the parent website.
Create image generation › Request Body
promptWhat to draw, in words — the subject, the setting, the style, the light. Not blank, at most 4000 characters. With reference_media_ids it says what to do with those pictures: "the product of the first picture on a beach at sunset".
model_idThe ai_models entry that draws the picture: one with the IMAGE_GENERATION capability. Its provider is the one asked, through a connection the account may use.
widthThe width of the picture in pixels, from 64 to 4096; 1024 when left out. A model may round it to a size it draws.
heightThe height of the picture in pixels, from 64 to 4096; 1024 when left out.
qualityHow carefully the picture is drawn: LOW, MEDIUM, HIGH, XHIGH or MAX. Left out, the provider's default; a model whose provider has no such setting ignores it.
backgroundOPAQUE, or TRANSPARENT for a picture with no background — a logo, a cut-out product — which only a model with the TRANSPARENT_BACKGROUND capability draws. Left out, the provider picks.
reference_media_idsUp to four files of this website's media library — PNG, JPEG or WebP pictures — for the model to work from, in the order the prompt refers to them: the picture to change, or a product to show. Needs a model with the IMAGE_EDITING capability. Each is sent at most 2048 pixels on its longer side.
connection_modeWhose key may pay for the picture: ANY (the default — the account's own key first, then the platform's), BYOK_ONLY or MANAGED_ONLY.
titleThe title the file is stored with in the media library, at most 255 characters; its file name is made from it.
alt_textThe text the file is stored with for readers who cannot see it, at most 512 characters.
folder_idThe folder of the media library the file goes into. Left out, the library's «AI Images» folder, made if it is not there.
request_idAn idempotency key you choose, at most 64 characters. Creating with a key already used on this website returns the run that key created instead of drawing another picture.
Create image generation › Responses
The created resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
promptWhat to draw, in words — the subject, the setting, the style, the light. Not blank, at most 4000 characters. With reference_media_ids it says what to do with those pictures: "the product of the first picture on a beach at sunset".
model_idThe ai_models entry that draws the picture: one with the IMAGE_GENERATION capability. Its provider is the one asked, through a connection the account may use.
widthThe width of the picture in pixels, from 64 to 4096; 1024 when left out. A model may round it to a size it draws.
heightThe height of the picture in pixels, from 64 to 4096; 1024 when left out.
qualityHow carefully the picture is drawn: LOW, MEDIUM, HIGH, XHIGH or MAX. Left out, the provider's default; a model whose provider has no such setting ignores it.
backgroundOPAQUE, or TRANSPARENT for a picture with no background — a logo, a cut-out product — which only a model with the TRANSPARENT_BACKGROUND capability draws. Left out, the provider picks.
reference_media_idsUp to four files of this website's media library — PNG, JPEG or WebP pictures — for the model to work from, in the order the prompt refers to them: the picture to change, or a product to show. Needs a model with the IMAGE_EDITING capability. Each is sent at most 2048 pixels on its longer side.
connection_modeWhose key may pay for the picture: ANY (the default — the account's own key first, then the platform's), BYOK_ONLY or MANAGED_ONLY.
titleThe title the file is stored with in the media library, at most 255 characters; its file name is made from it.
alt_textThe text the file is stored with for readers who cannot see it, at most 512 characters.
folder_idThe folder of the media library the file goes into. Left out, the library's «AI Images» folder, made if it is not there.
stateRUNNING while the picture is drawn and stored, then SUCCEEDED, FAILED or CANCELLED. A run still RUNNING past deadline_time was interrupted and reads FAILED.
media_idThe file of the media library the picture became, once SUCCEEDED. Deleting the file leaves the run as it is.
usageWhat the picture consumed, once the provider said: input_tokens, output_tokens, image_count and megapixels_milli (thousandths of a megapixel); cost, as Money, when the platform's key paid from the AI balance; and connection_kind, BYOK or MANAGED. A cancelled picture the provider had drawn already is charged and carries it too.
errorWhy a FAILED run failed, in the same shape as an API error: code, status, message and, where there is one, a PRECONDITION_FAILURE whose type says why — the AI platform's refusal before the provider was asked (MODEL_INCOMPATIBLE, NO_USABLE_CONNECTION, INSUFFICIENT_BALANCE, MODEL_NOT_PRICED, …) or the provider's failure (CONTENT_MODERATED, TIMEOUT, …).
deadline_timeWhen the run must have ended: the provider's time for one picture and a minute to store it (RFC 3339, UTC).
end_timeWhen the run ended, once it has (RFC 3339, UTC).
Get image generation
One picture drawn by an AI model for this website and put into its media library: what was asked — the prompt, the model, the size, the pictures it worked from — whether it is done, the file it became and what it cost. The picture is drawn in the background — create the run, then read it until state is final.
path Parameters
website_idId of the parent website.
image_generation_idId of the parent image_generation.
Headers
If-None-MatchA matching etag answers 304 with no body (§16).
Get image generation › Responses
The resource.
nameThe resource name (§5) — the identity of this resource, and the path that addresses it: websites/{website}/cms_pages/{cms_page}. It is the handle to store, not a human label.
idThe last segment of name on its own, for a client that needs to build a child URL. Unique inside its parent, never across the platform.
create_timeWhen the resource was created (RFC 3339, UTC).
update_timeWhen the resource last changed (RFC 3339, UTC).
etagVersion of the persisted state. Send it back in If-Match on Update or Delete and the write is rejected with ABORTED if anyone else changed the resource meanwhile (§14).
promptWhat to draw, in words — the subject, the setting, the style, the light. Not blank, at most 4000 characters. With reference_media_ids it says what to do with those pictures: "the product of the first picture on a beach at sunset".
model_idThe ai_models entry that draws the picture: one with the IMAGE_GENERATION capability. Its provider is the one asked, through a connection the account may use.
widthThe width of the picture in pixels, from 64 to 4096; 1024 when left out. A model may round it to a size it draws.
heightThe height of the picture in pixels, from 64 to 4096; 1024 when left out.
qualityHow carefully the picture is drawn: LOW, MEDIUM, HIGH, XHIGH or MAX. Left out, the provider's default; a model whose provider has no such setting ignores it.
backgroundOPAQUE, or TRANSPARENT for a picture with no background — a logo, a cut-out product — which only a model with the TRANSPARENT_BACKGROUND capability draws. Left out, the provider picks.
reference_media_idsUp to four files of this website's media library — PNG, JPEG or WebP pictures — for the model to work from, in the order the prompt refers to them: the picture to change, or a product to show. Needs a model with the IMAGE_EDITING capability. Each is sent at most 2048 pixels on its longer side.
connection_modeWhose key may pay for the picture: ANY (the default — the account's own key first, then the platform's), BYOK_ONLY or MANAGED_ONLY.
titleThe title the file is stored with in the media library, at most 255 characters; its file name is made from it.
alt_textThe text the file is stored with for readers who cannot see it, at most 512 characters.
folder_idThe folder of the media library the file goes into. Left out, the library's «AI Images» folder, made if it is not there.
stateRUNNING while the picture is drawn and stored, then SUCCEEDED, FAILED or CANCELLED. A run still RUNNING past deadline_time was interrupted and reads FAILED.
media_idThe file of the media library the picture became, once SUCCEEDED. Deleting the file leaves the run as it is.
usageWhat the picture consumed, once the provider said: input_tokens, output_tokens, image_count and megapixels_milli (thousandths of a megapixel); cost, as Money, when the platform's key paid from the AI balance; and connection_kind, BYOK or MANAGED. A cancelled picture the provider had drawn already is charged and carries it too.
errorWhy a FAILED run failed, in the same shape as an API error: code, status, message and, where there is one, a PRECONDITION_FAILURE whose type says why — the AI platform's refusal before the provider was asked (MODEL_INCOMPATIBLE, NO_USABLE_CONNECTION, INSUFFICIENT_BALANCE, MODEL_NOT_PRICED, …) or the provider's failure (CONTENT_MODERATED, TIMEOUT, …).
deadline_timeWhen the run must have ended: the provider's time for one picture and a minute to store it (RFC 3339, UTC).
end_timeWhen the run ended, once it has (RFC 3339, UTC).
Cancel (image generation)
Stops a picture that the provider has not drawn yet: the run is CANCELLED at once, and a picture the provider is drawing already is dropped when it comes — and charged, because the provider bills it when it is asked for. Once the provider has answered, the picture is being stored and the call answers FAILED_PRECONDITION (IMAGE_ALREADY_DRAWN) — delete the file instead; on a run that has ended, FAILED_PRECONDITION (IMAGE_GENERATION_FINISHED).
path Parameters
website_idId of the parent website.
image_generation_idId of the parent image_generation.
Cancel (image generation) › Request Body optional
Cancel (image generation) › Responses
The affected resource, or the method’s own response object (§10).