Getting error 500/429 when setting up gpt3

I keep getting error 500 when trying to send a request through node/nextjs.

Though, the request goes through in curl.

for I.e.
getting error 500 through this sample project:

error 429 through this quick start open ai project

Something might be wrong with my API key??

Hey did you ever get this figured out? I’m running into the same issue.

yes-- I think it was different in the documentation than how you actually access it.

I’m not currently using open ai, but if I remember it was like

res.status(200).json({ response: completion.data.choices[0].text })

Yes. that’s the current response. Is that the wrong response? Or should it be something else?

this is wat i had way back when I used it



const { Configuration, OpenAIApi } = require('openai')

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
})
const openai = new OpenAIApi(configuration)
let outputAmt = 0;

export default async function (
  req,
  res
) {
  let promptData = req.body.prompt
  let output = req.body.output
  let temp = req.body.temp

  if (output === 'short') {
    outputAmt = 700
  } else if (output === 'long') {
    outputAmt = 3000
  }

  const completion = await openai.createCompletion('text-davinci-002', {
    prompt: promptData,
    temperature: temp,
    max_tokens: outputAmt,
  })
  res.status(200).json({ response: completion.data.choices[0].text })
}

Oh yes, I have the same thing. How did you overcome the 500 error?

getting 429 and 503 from completion apis frequently any resolution?

1 Like

Same here… about 1 in 5 API calls returns a 500 or 429…

I’m getting error 500 suddenly now also, but it was working fine before.

Is this an error with the API, like “at capacity” or how ChatGPT often crashes? Or is this an error with the code?