Facing issue while editing the image using openAI

const response = await openai.images.createVariation({
image: file,


let response = await openai.images.edit({
image: file,
prompt: ‘Convert this image into an AI Avatar’,
// n: 1,
// size: “1024x1024”,
// response_format: ‘b64_json’

Using this both function to create the image passing the buffer of the file
then also its not giving any output its just stuck on it

I’m curious if you are actually doing something with “response” after this segment of code. This only demonstrates how to make the call to the API using the node.js openai library.

Here’s clearly formatted code as a final answer, using node library as it was in July. You’ll likely want to adapt code to the latest node.js python 4.0+ version, with the github showing new API methods.

Actually I have now resolved that issue now I am getting limit exceded and my file size is of only 3 KB

response = await openai.images.createVariation(
model: “dall-e-2”,
image: path,
n: 1,
size: “512x512”

In Response I am getting an error that Limit exceeded

Have you added a payment method and credits to your account? DALL-E images are $0.02 to $0.12 each depending on what type you request.

platform.openai.com, then go to your account and billing in the left bar.