Cannot use dalle3 in node.js api

I cant access dalle 3 from the api.
i installed the latest version of openai.
I tried using:

  1. import { OpenAIApi,Configuration } from “openai”;
    After creating a client with the configurations i tried using the createImage function but i cannot pass model parameter to define model:“dall-e-3”.

  2. I also tried to import OpenAI from “openai”
    but it says the following: “This expression is not constructable…” when trying to create new OpenAI().

These are the two possible methods i found.
What am i doing wrong?

1 Like

Make sure you have the latest version of the library as things are changing quickly… * v4.17.4

1 Like

you want to do something like this:

const response = await openai.images.generate({
  model: "dall-e-3",
  n: 1,
  size: "1024x1024",
  quality: "hd",