#NodeJS Code Samples on OpenAI.com

2 messages · Page 1 of 1 (latest)

wide plaza
#

The nodejs example from your docs says base image, masking layer, then prompt. However if you try running this you'll run into an error. After testing I found the masking later goes after the prompt, but the documentation says otherwise. API is definitely a little buggy.

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

From your docs - does not work out of the box like this

const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createImageEdit(
  fs.createReadStream("otter.png"),
  fs.createReadStream("mask.png"),
  "A cute baby sea otter wearing a beret",
  2,
  "1024x1024"
);
gaunt siren
#

what version of openAI is this? 🙂