I still get openai.error.ServiceUnavailableError

Hey there, I am using ChatGPT via API over Telegram Bots.
Everything works fine. People ask the AI in my Group via /ask and the bot answers.

But sometimes it stops responding, after watching PyCharm I get this error openai.error.ServiceUnavailableError - Too many requests…

The bot stops working and I need to manually restart. Did someone resolve this type of problem?
Is there a code, which restarts a .py automatically after a crash? Or is there a way to have an error like that and it continues?

Hi Siuuu. You’re not the only one encountering this issue.

The error is telling us that there’s too much traffic. This is likely a temporary issue that will resolve itself. If it doesn’t clear up, then I would recommend reaching out to OpenAI’s support team.

1 Like

I suspect it is too much traffic from specific IP addresses

When people use VPN’s or proxies, they tend to share a common IP address range, and also company or education sites where several users access the internet through the same common network connection

I think, over time, the VPN IP addresses (and cloudflare relay servers) are getting blacklisted as “high users” at ChatGPT. That would explain why it took a while to show up and is getting worse over time

2 Likes

I wish we had a way to merge all these threads…

2 Likes

I wish there was an AI that could answer questions about how to get access to the ChatGPT API, and how to train using big text files, and that could fix code problems when calling the API

They could call it GPT3.6 and Codex :slight_smile:

3 Likes

okey thank you.
Yea I thought about its about the traffic.
The only thing I want to solve is, that my bot should at least write something like “Error, please try again” instead of crashing and manually starting it again.

Hi, I still have this problem now when I use text-davinci-003, how do you solve it or should I just wait when the traffic issue is gone?

Thanks!

I just keep restarting the bot. Currently working on a code, which restarts automatically. I also tried a sleep timer for making less requests and avoid error but doesn’t work. Also changing to davinci model 2 made the bot worse.

Hi Siuuu,

Could you please tell me what do you mean by restarting the bot?
Thanks!

My bot runs via PyCharm, I need to press run again to make the bot work.

Hello Guys, I think I found a good fix. I saw it in the Image Generation Help.

https://beta.openai.com/docs/guides/images/language-specific-tips

The last chapter explains the error problem of rate limits. We can use "try: and except for error statements. I will run it and try if it works, I will keep it.

Their example, which I use for text, not for photo

try:
  openai.Image.create_variation(
    open("image.png", "rb"),
    n=1,
    size="1024x1024"
  )
  print(response['data'][0]['url'])
except openai.error.OpenAIError as e:
  print(e.http_status)
  print(e.error)

Hi, did you find if it works?
thanks!

Hi, I have a little try myself, I think it works now, thank you very much!

1 Like

Until now I only got 1 error, but with printing the Error, for nearly 3 Days I have no error. Earlier I got about 3 crashes a day.

So I think it works!

Update, got a new error after that:

telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 670

Seems like too many requests again, or a wrong starting sign… My only solution is to dublicate the bot and if it crashes, it shall run the second bot. But shell commands can’t be run in Pycharm so idk what to do now.