Images Generations
POST/v1/images/generations
Follows the OpenAI Responses API spec: https://developers.openai.com/api/reference/resources/images/methods/generate
Request
- application/json
Body
required
Identifier of the model to use.
Prompt provided to the model.
Number of images to generate.
Possible values: >= 1 and <= 10
Image size between 1x1 and 512x512.
Possible values: Value must match regular expression ^(0|[1-9][0-9]{0,2}|[1-4][0-9]{2}|512)x(0|[1-9][0-9]{0,2}|[1-4][0-9]{2}|512)$
512x512Possible values: [vivid, natural, auto]
Quality of image to generate Note: This property is accepted but ignored by the API.
Possible values: [low, standard, hd]
Format of image to generate Note: This property is accepted but ignored by the API.
Possible values: [url, b64_json]
b64_jsonUser that requested image generation. Note: This property is accepted but ignored by the API.
Responses
- 200
- 400
Successful Response
- application/json
- Schema
- Example (from schema)
Schema
data
object
required
Base64-encoded image.
Image size.
usage
object
input_tokens_details
object
{
"created": 0,
"data": {
"b64_json": "string",
"revised_prompt": "string",
"url": "string"
},
"output_format": "string",
"size": "string",
"usage": {
"total_tokens": 0,
"input_tokens": 0,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 0
},
"output_tokens": 0
}
}
Bad request Error when passing an invalid or non-existing model name or an invalid enum or an invalid type in a field
- application/json
- Schema
- Example (from schema)
Schema
error
object
required
Error returned as response for invalid or missing model name
{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}