How to use Routstr using our Tor endpoint instead of api.routstr.com
localhost:9050
for SOCKS5 proxy), you can configure your API client to use Routstr’s onion service endpoint and route requests through your local Tor proxy.
Here’s an example using the Python OpenAI client:
import httpx
: The httpx
library is used as the underlying HTTP client for openai-python
. It allows for advanced configurations like proxy settings.base_url
: This is set to Routstr’s onion service address (http://mcfftxiqtpwvrsly4ue6fgc6nvo637emrofmnftitn3frmf55frcleid.onion/v1
). Ensure you use the correct and current onion address.http_client=httpx.Client(...)
: An httpx.Client
instance is passed to the OpenAI
client.proxies={"http://": "socks5://localhost:9050"}
: This crucial line configures httpx
to route all HTTP traffic through the SOCKS5 proxy running on localhost:9050
, which is the default for many Tor clients.localhost:9050
.