#simple node js application doesn't work

11 messages · Page 1 of 1 (latest)

tight orchid
#

Hi i have a simple js application with openai modules to use chatgpt but it throws a long error and i don't know how to solve it, here's the code:

const configuration = new Configuration({
  apiKey: "api key",
});
const openai = new OpenAIApi(configuration);
const response = openai.createCompletion({
  model: "text-davinci-003",
  prompt: "Say this is a test",
  temperature: 0,
  max_tokens: 7,
});
console.log(response.data);```

to run this i use node ai.js in terminal
scenic oar
#

What’s the error that it throws?

#

I see that there’s a rejectUnauthorized: true, in the last screenshot you sent, this might be because the API key you passed in was invalid, have you double checked the API key?

tight orchid
scenic oar
#

Can you show us more of that error? Try to find if there is a HTTP status code that was returned to you so we can figure out what error status it is

tight orchid
scenic oar
#

Yeah, so it looks like you’re out of usage in your billing account, you can log into the API online and go to the “Usage” section, and update your billing soft and hard limits

tight orchid
#

oh...my credits expired

tight orchid
scenic oar
#

No worries at all I’m glad to help