Images - Generate
Generates a batch of images from a text caption
POST {endpoint}/openai/images/generations:submit?api-version=2023-10-01-preview
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
endpoint
|
path | True |
string (url) |
Supported Cognitive Services endpoints (protocol and hostname, for example: https://aoairesource.openai.azure.com. Replace "aoairesource" with your Azure OpenAI account name). |
api-version
|
query | True |
string |
The requested API version. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
api-key | True |
string |
Provide your Cognitive Services Azure OpenAI account key here. |
Operation-Id |
string (uuid) |
ID of the status monitor for the operation. If the Operation-Id header matches an existing operation and the request is not identical to the prior request, it will fail with a 400 Bad Request. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
prompt | True |
string minLength: 1 |
A text description of the desired image(s). |
n |
integer (int32) minimum: 1 |
The number of images to generate. |
|
size |
Size |
||
user |
string |
A unique identifier representing your end-user, which can help to monitor and detect abuse. |
Responses
Name | Type | Description |
---|---|---|
202 Accepted |
Accepted Headers
|
|
Other Status Codes |
An error occurred. Headers
|
Security
api-key
Provide your Cognitive Services Azure OpenAI account key here.
Type:
apiKey
In:
header
Examples
Creating an image generation operation.
Sample request
POST https://aoairesource.openai.azure.com/openai/images/generations:submit?api-version=2023-10-01-preview
{
"prompt": "An avocado chair",
"size": "512x512",
"n": 3
}
Sample response
operation-location: https://aoairesource.openai.azure.com/openai/dalle/operations/images/f508bcf2-e651-4b4b-85a7-58ad77981ffa?api-version=2023-08-01-preview
x-ms-request-id: 29fd3fe5-ab2f-44e0-aefa-0dfe9bd1c03f
{
"id": "f508bcf2-e651-4b4b-85a7-58ad77981ffa",
"status": "notRunning"
}
Definitions
Name | Description |
---|---|
Error |
Error |
Error |
ErrorCode |
Error |
ErrorResponse |
Generate |
GenerateImagesCreation |
Generate |
GenerateImagesResponse |
Inner |
InnerError |
Inner |
InnerErrorCode |
Operation |
OperationState |
Size |
Size |
Error
Error
Name | Type | Description |
---|---|---|
code |
ErrorCode |
|
details |
Error[] |
The error details if available. |
innererror |
InnerError |
|
message |
string minLength: 1 |
The message of this error. |
target |
string |
The location where the error happened if available. |
ErrorCode
ErrorCode
Value | Description |
---|---|
conflict |
The requested operation conflicts with the current resource state. |
invalidPayload |
The request data is invalid for this operation. |
forbidden |
The operation is forbidden for the current user/api key. |
notFound |
The resource is not found. |
unexpectedEntityState |
The operation cannot be executed in the current resource's state. |
itemDoesAlreadyExist |
The item does already exist. |
serviceUnavailable |
The service is currently not available. |
internalFailure |
Internal error. Please retry. |
quotaExceeded |
Quota exceeded. |
jsonlValidationFailed |
Validation of jsonl data failed. |
fileImportFailed |
Import of file failed. |
tooManyRequests |
Too many requests. Please retry later. |
unauthorized |
The current user/api key is not authorized for the operation. |
contentFilter |
Image generation failed as a result of our safety system. |
ErrorResponse
ErrorResponse
Name | Type | Description |
---|---|---|
error |
Error |
GenerateImagesCreation
GenerateImagesCreation
Name | Type | Default value | Description |
---|---|---|---|
n |
integer (int32) minimum: 1 |
1 |
The number of images to generate. |
prompt |
string minLength: 1 |
A text description of the desired image(s). |
|
size | 1024x1024 |
Size |
|
user |
string |
A unique identifier representing your end-user, which can help to monitor and detect abuse. |
GenerateImagesResponse
GenerateImagesResponse
Name | Type | Description |
---|---|---|
id |
string (uuid) |
The Id of the asynchronous operation that can be used to query its status later. |
status |
OperationState |
InnerError
InnerError
Name | Type | Description |
---|---|---|
code |
InnerErrorCode |
|
innererror |
InnerError |
InnerErrorCode
InnerErrorCode
Value | Description |
---|---|
invalidPayload |
The request data is invalid for this operation. |
OperationState
OperationState
Value | Description |
---|---|
notRunning |
The operation is not yet queued to be processed in the future. |
running |
The operation has started to be processed. |
succeeded |
The operation has successfully be processed and is ready for consumption. |
failed |
The operation has completed processing with a failure and cannot be further consumed. |
Size
Size
Value | Description |
---|---|
256x256 |
The desired size of the generated image is 256x256 pixels. |
512x512 |
The desired size of the generated image is 512x512 pixels. |
1024x1024 |
The desired size of the generated image is 1024x1024 pixels. |