How to write the right backend for proxying fetch requests on the service /?

I use fetch queries on on React to use ChatGPT, I have a working backend code and it is hosted on the server / and it works correctly. But it turned out that there are restrictions on vercel servers and if the response should come from a relatively large chat, then it falls into an error and nothing comes, that is, short answers from the gpt chat come correctly, and large ones fall into an error.

I decided to post it on another service /, but the code with vercel does not work on this service, and it did not work out to register it correctly myself. In fact, you need a very simple code on the backend so that when you request a fetch on its domain/api, it redirects the request from its foreign ip address to and the answer was passed back. Who can help?