Api interrupting for localhost

I have a solution in Laravel that generates texts for my project. Then I use “php artisan serve” and access the url to start writing the texts and saving them in my database.

It turns out that after a few minutes, the sending is simply interrupted without any error or warning. Then I need to change the localhost port so that it works again, for example

And I have to be doing this all the time, at each interval of time the openai stops responding to a specific address.

What could it be and how do I resolve it?