Create image variation
images.create_variation(ImageCreateVariationParams**kwargs) -> ImagesResponse
POST/images/variations
Creates a variation of a given image. This endpoint only supports dall-e-2.
Parameters
The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square.
n: Optional[int]
The number of images to generate. Must be between 1 and 10.
minimum1
maximum10
user: Optional[str]
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
Returns
Create image variation
from openai import OpenAI
client = OpenAI()
response = client.images.create_variation(
image=open("image_edit_original.png", "rb"),
n=2,
size="1024x1024"
)
{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}
Returns Examples
{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}