Create Image
Create an image from a prompt.
In: header
Header Parameters
A text description of the desired image(s).
Allows to set transparency for the background of the generated image(s). This parameter is supported on a subset of models.Must be one of transparent, opaque or auto (default value). When auto is provided, opaque will be used.
If transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp.
"auto""auto" | "transparent" | "opaque"The model to use for image generation.
""Control the content-moderation level for images generated. Must be either low for less restrictive filtering or auto (default value).
"auto"The number of images to generate. Must be between 1 and 10.
11 <= value <= 4The compression level (0-100%) for the generated images. This parameter is only supported with the webp or jpeg output formats, and defaults to 95.
950 <= value <= 100The format in which the generated images are returned. Must be one of png, jpeg, or webp.
"png""png" | "webp" | "jpeg"The quality of the image that will be generated. auto (default value) sets quality to medium.
"auto""low" | "medium" | "high" | "auto"The format in which generated images are returned. Must be one of url or b64_json. Currently url is not supported.
"b64_json""url" | "b64_json"The size of the generated images. Default (auto) size is 512x512.
"auto"The style of the generated images. Must be one of vivid or natural. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.
"vivid"A unique identifier representing your end-user, which can help to monitor and detect abuse.
""Response Body
curl -X POST "https://loading/v1/images/generations" \
-H "OpenAI-Organization: 5eb7cf5a86d9755df3a6c593" \
-H "OpenAI-Project: 5eb7cf5a86d9755df3a6c593" \
-H "Content-Type: application/json" \
-d '{
"model": "random",
"prompt": "Black Swan",
"size": "1024x1024"
}'{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"input_tokens": 50,
"input_tokens_details": {
"image_tokens": 40,
"text_tokens": 10
},
"output_tokens": 50,
"total_tokens": 100
}
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.