Skip to main content

openai.openai.createimage

Home > @runlightyear/openai > OpenAI > createImage

OpenAI.createImage() method

Given a prompt and/or an input image, the model will generate a new image.

Signature:
createImage(props: CreateImageProps): Promise<CreateImageResponse>;

Parameters

ParameterTypeDescription
propsCreateImageProps
Returns:

Promise<CreateImageResponse>

Example

Create an image

const result = await openai.createImage({
prompt: "A cute baby sea otter",
n: 2,
size: "1024x1024",
});
const images = result.data.data;
console.log("Url: ", images[0].url);