Skip to main content
By setting proxy_server to "self", Smooth creates a peer-to-peer tunnel between the remote Smooth browser and your local machine, routing all browser traffic through your network. This is useful for:
  • Accessing localhost — The tunnel lets the Smooth browser reach services running on your machine (e.g. http://localhost:3000), making it easy to test local development environments
  • Avoiding bot detection — Many websites trust residential IPs more than datacenter IPs
  • Geo-localized automations — Access location-specific content based on your actual location
  • Location-aware queries — Run searches like “restaurants near me” that rely on IP geolocation
  • Accessing region-restricted content — Browse content only available in your region

Usage

from smooth import SmoothClient

client = SmoothClient()

# Simple task using your IP
task = client.run(
    task="Search for 'coffee shops near me' and get the top 5 results",
    proxy_server="self"
)
print(task.result().output)

Accessing Localhost

Because the P2P tunnel connects the Smooth browser directly to your machine, the browser can reach any service running locally — just use localhost or 127.0.0.1 as you normally would:
from smooth import SmoothClient

client = SmoothClient()

# Access a local dev server running on port 3000
task = client.run(
    task="Go to the homepage and tell me what you see",
    url="http://localhost:3000",
    proxy_server="self"
)
print(task.result().output)
This makes it straightforward to run automations or tests against a local app without exposing it to the internet.

With Sessions

from smooth import SmoothClient

client = SmoothClient()

with client.session(proxy_server="self") as session:
    session.run_task(
        task="Search for nearby Italian restaurants",
        url="https://www.google.com/maps"
    )

    results = session.extract(
        schema={
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {"type": "string", "description": "Restaurant name"},
                    "rating": {"type": "number", "description": "Star rating"},
                    "address": {"type": "string", "description": "Street address"}
                }
            }
        },
        prompt="Extract the top 5 restaurants from the results"
    )

    for restaurant in results.output:
        print(f"{restaurant['name']} - {restaurant['rating']} stars")

How It Works

When you set proxy_server="self":
  1. Smooth establishes a peer-to-peer tunnel between the remote browser and your machine
  2. All browser traffic is routed through your local network
  3. Websites see your IP address instead of Smooth’s datacenter IP
  4. Services running on localhost become reachable from the Smooth browser
  5. The tunnel is automatically closed when the task or session ends
Pro Tip: Using your own IP is the most effective way to avoid captchas. Websites see the same IP they would see if you were browsing manually.
This feature is most useful when running automations from a local machine with a residential IP. If your code is running from a datacenter, the tunnel will still use a datacenter IP.