cogentapps / chat-with-gpt

An open-source ChatGPT app with a voice
https://www.chatwithgpt.ai
MIT License
2.31k stars 493 forks source link

Issue Connecting with Open AI API #19

Open jsanchezl12 opened 1 year ago

jsanchezl12 commented 1 year ago

Hello, I am having trouble with the API Key setting, maybe is something that I need to configure? I just set my API Key, and run it locally, but it stills showing an error

image image

I run it as docker container

image
cogentapps commented 1 year ago

If you're sure you set the API key correctly, it's probably just OpenAI's servers being overloaded. I noticed the completion API started to return a higher rate of errors a few hours ago, usually with an HTTP response that says "this model is overloaded, try again". See if clicking Regenerate fixes it. I'll add automatic retry logic soon which should help.

jsanchezl12 commented 1 year ago

Thanks 👍

I test it in the page but is not working, maybe we can't access anymore. 😓 Link

image
johnvesalius commented 1 year ago

I'm seeing the same. I can connect with the same API key using curl without issues, but the web app fails with a "401 Unauthorized". The API key is entered correctly. Not sure how to troubleshoot further.

cogentapps commented 1 year ago

So, the 401 unauthorized error (as seen in the image above) is not related. The chatapi/sync endpoint is for storing and syncing the message you submitted, but only works when you are signed in. (It should only run when signed in, but that logic isn’t implemented yet, so there’s an error.)

In the network debugger you can look for a request to the OpenAI chat completion endpoint right when you submit your message. That’s the important one. For me, it’s been failing off and on over the last few days, usually with a 429 Too Many Requests error and a message that says the model is overloaded. Since it’s an OpenAI API error, there’s not much that can be done in the app, except resubmitting the request.

I saw several threads about this issue on the OpenAI Discord - I imagine they’re having to scale up server capacity to meet demand for GPT-4 and these are just growing pains.

johnvesalius commented 1 year ago

Makes sense, thanks!