GPT 4 API sometimes can't handle more than 5 consecutive API calls

I have a script that calls GPT4 many times in a row with different inputs. Occasionally it completes the first 5, and then it gets “stuck” infinitely without any error code. Any idea why this may be the case? It works fine with 3.5turbo.

1 Like

Hey @polonuim210 nice to meet you, Diego here from Argentina. I’m a little bit new to into the tech but experience enough to identify this use case.

I’ve face this situation before. It often happens when you ran out of tokens.
My guess is that, the prompt + input passed has a certain token length.

once you get the answer that consumes more tokens. So I guess eventually it gets “Stuck” because it ran out of tokens. But this is just a guess.

it would come really handy if you had any errors or do a try / catch to log a more detailed error once it get stuck!

Hope this helps, and if you find the right answer, please let me know.

Happy coding.