#Getting error 401
4 messages · Page 1 of 1 (latest)
this is the code ```js
const { OpenAIApi } = require("openai");
const apiKey = "the key";
const openai = new OpenAIApi(apiKey);
openai.createCompletion({
model: "text-davinci-003",
prompt: "what is an atom made of",
temperature: 0.5,
max_tokens: 60,
top_p: 1.0,
frequency_penalty: 0.5,
presence_penalty: 0.0,
})
.then(response => {
console.log(response.choices[0].text.trim());
})
.catch(error => {
console.error('Error:', error.message);
});```