API connection to Tor network through web server

I have an Ubuntu virtual server on which I have written a program to convert text to audio and send it to my website on the Tor network (site with .onion domain).
Let’s say this is my server address:

I want port number 2021 to be connected to a website on the Tor network:

It means that when I open this address, it will be redirected to my domain in the Tor network: => https://xxxxxxx.onion

Now in this way I can send artificial intelligence information to the Tor network.

Is there a safe and easy way to do this?

I have never seen anyone use this with Tor before, so I am not sure how you should go about it. This video explains how to send general API requests to the Tor network. Let me know if it is helpful.

1 Like

This method requires a web browser. I cannot install a browser on the site server. As a result, I could not connect to the Tor network with this method