agentic icon indicating copy to clipboard operation
agentic copied to clipboard

429 error very frequently.

Open Abhineetnehra opened this issue 2 years ago • 2 comments

Describe the feature

No error, just looking for ideas. The delay between each API call is 10 seconds, and I'm not sure why I get 429 error sometimes after 5 successful calls,  sometime after 17 calls, and sometime after 50 calls. There could be a reason why, when the server is most busy, it throws the 429 error early. Could someone please suggest a better approach to avoiding (error 429: too many requests) in a much better way so as to increase the number of successful API responses.

Abhineetnehra avatar Jan 11 '23 13:01 Abhineetnehra

For me, I have found that using prompts that result in shorter text helps preventing 429 errors (i.e. "write a short paragraph about..." instead of "write an essay about..."). So I prefer using many "shorter prompts" instead of just a big one. Of course this trick may not be useful for your usecase, buy anyway that's my two cents.

InspectorPepinillo avatar Jan 11 '23 21:01 InspectorPepinillo

I see this as well and the best advice I have for now is to add a reasonable amount of retry logic around your usage of chatgpt. This obviously isn't ideal, but it may be the best we can do with the current restrictions OpenAI & Cloudflare have in place.

If anyone has any deeper insight as to why the 429s happen seemingly at random, please share your learnings. Hopefully we can make this package more robust as a community.

transitive-bullshit avatar Jan 12 '23 09:01 transitive-bullshit

I see this as well and the best advice I have for now is to add a reasonable amount of retry logic around your usage of chatgpt. This obviously isn't ideal, but it may be the best we can do with the current restrictions OpenAI & Cloudflare have in place.

If anyone has any deeper insight as to why the 429s happen seemingly at random, please share your learnings. Hopefully we can make this package more robust as a community.

I am currently trieng to develop a WhatsApp Bot and i have noticed that if 2-3 users write at the same time i get the error. maybe a load balancer or a queue for the questions so this way you can avoid it?

xKliment avatar Jan 19 '23 10:01 xKliment

I'm getting this error as well. Would setting a proxy server for the different accounts help?

emipc avatar Jan 25 '23 13:01 emipc

I'll test now with 10 users and a load balancer.

Each user going to make 3 requests.

samuelfaj avatar Jan 25 '23 20:01 samuelfaj

Try upgrading to the latest version; we're now using the official API, so you should never hit 429 rate limit errors: https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v4.0.0

transitive-bullshit avatar Feb 01 '23 12:02 transitive-bullshit