Incorrect function call in documentation

Is it my imagination, or is the documentation wrong about the call used to generate an image?

It says to use:

const response = await openai.createImage({
  model: "dall-e-3",
  prompt: "a white siamese cat",
  n: 1,
  size: "1024x1024",
});
image_url = response.data.data[0].url;

This function does not exist on that object. Instead, the correct call should look like:

const image = await openai.images.generate({ 
  model: "dall-e-3", 
  prompt: "A cute baby sea otter" 
});

Am I missing something? I don’t understand. It seems utterly bizarre to me that the primary source of documentation from OpenAI should be wrong.

Please someone tell me I have misunderstood!

You have two different documents, both somewhat correct, both somewhat unclear. (“documentation”, and “API reference”)

The answer which you seek is here, a recent rewrite and version bump of python library and methods gives two possibilities of proper usage.

For those still using the prior version, erasing all existing documentation would not be ideal, either.

For Node v4 SDK, you can refer to the API reference as your source for implementation, although the extraction of responses still can use some of the migration tips within the particular link above.

1 Like

I’m sorry, I am just not getting this.

I am by no means a stupid person, but I cannot find any reference to this image generation node API.

Is there a definitive, complete documentation for the node library that does not require me to visit several pages to put together the reality of the current API?

If so, why is this not at the top of the API page?

As I say, I am happy to accept that I may well be missing something. But neither the npmjs page nor the GitHub page appear to reference it.

I will look at the migration guide when I get home.

To clarify, I am interested in the node API.

Ok, I found it on the API page. I was indeed missing it, not appearing on mobile. It is in the column to the right on desktop.

https://platform.openai.com/docs/api-reference/images

1 Like