Given a prompt and/or an input image, the model will generate a new image. See the Image generation guide and the Official OpenAI docs.

create()

Creates an image given a prompt. Official OpenAI Docs

example.ts
await io.openai.images.create("dalle-3", {
  model: "dall-e-3",
  prompt:
    "I would like to generate an image of an american giraffe riding a bycicle in a suburban neighborhood, into the sunset.",
});

backgroundCreate()

Creates a an image given a prompt, but runs the request in the background using io.backgroundFetch()

example.ts
await io.openai.images.backgroundCreate("dalle-3", {
  model: "dall-e-3",
  prompt:
    "I would like to generate an image of an american giraffe riding a bycicle in a suburban neighborhood, into the sunset.",
});

edit()

Creates an edited or extended image given an original image and a prompt. Official OpenAI Docs

example.ts
await io.openai.images.edit("dalle-2", {
  model: "dall-e-2",
  image: fs.createReadStream("./giraffe.jpg"),
  prompt: "A painting of a giraffe in a suburban neighborhood",
  response_format: "url",
});

createVariation()

Creates a variation of a given image. Official OpenAI Docs

example.ts
await io.openai.images.createVariation("dalle-3", {
  model: "dall-e-2",
  image: fs.createReadStream("./giraffe.jpg"),
  response_format: "url",
});