Skip to main content

Gradio Tunneling

English | 简体中文

A tunneling tool that provides reverse proxy functionality for non-Gradio web services, allowing you to expose your local services to the internet with customizable subdomains.

https://github.com/arkohut/gradio-tunneling/assets/39525455/f38b7db2-517b-4e30-b15e-8787485095d0

Use with AI coding agents

This repo ships an agent skill at .agents/skills/gradio-tunneling/ so AI coding agents (pi, and others that support the Agent Skills standard) can set up tunnels for you on request — just say "expose port 7860" / “内网穿透 7860". It includes a helper script that starts the tunnel in the background, waits for the public URL, and stops it later:

bash .agents/skills/gradio-tunneling/scripts/tunnel.sh 7860            # prints PUBLIC_URL=...
bash .agents/skills/gradio-tunneling/scripts/tunnel.sh 7860 myapp      # with subdomain
bash .agents/skills/gradio-tunneling/scripts/tunnel.sh --stop 7860

Setup

Requires Python 3.8 or higher.

Since gradio-tunneling is a CLI tool, installing it into an isolated environment with pipx or uv tool is recommended — it keeps the gradio-tun command on your PATH without touching your project venvs.

# Recommended: uv tool (fast, no extra setup if you already use uv)
uv tool install gradio-tunneling

# Or: pipx
pipx install gradio-tunneling

# Or: plain pip (works fine, but pollutes the current environment)
pip install gradio-tunneling

To upgrade later:

uv tool upgrade gradio-tunneling
# or
pipx upgrade gradio-tunneling

Once installed, two equivalent commands are available on your PATH:

  • gradio-tun — short form (used throughout this README)
  • gradio-tunneling — long form, kept for backward compatibility

Verify it's reachable:

gradio-tun --help

Run tunnel

You can specify the port in two ways:

gradio-tun 7860 [--sd your-subdomain]
# or
gradio-tun --port 7860 [--sd your-subdomain]
  • PORT or --port PORT: Specify the port number for the tunnel
  • --sd: (Optional) Specify a custom subdomain. Note: For security reasons, your input will be converted into a unique string. Using the same --sd value will always generate the same unique string.

Examples:

# Using positional port argument
gradio-tun 7860

# Using --port flag
gradio-tun --port 7860

# With custom subdomain
gradio-tun 7860 --sd mycustomsubdomain
# This will generate a URL with a unique string (e.g., abc123def...)
# Using "mycustomsubdomain" again will generate the same unique string

About Custom Subdomains

When you use the --sd option:

  • The subdomain you provide won't be used directly in the URL
  • Instead, it will be converted into a unique string for security
  • If you use the same --sd value later, you'll get the same unique string
  • This helps you get consistent URLs while maintaining security

For example, if you always use --sd myapp, you'll get the same unique subdomain each time, making your URL predictable for your users.

Important Note

The generated tunnel URL will expire after 72 hours. After expiration, you'll need to restart the tunnel to get a new URL. If you're using a custom subdomain with --sd, using the same value will generate the same subdomain in the new URL.

Metadata

Release files for gradio-tunneling 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gradio-tunneling 0.9.1
File Size Uploaded
gradio_tunneling-0.9.1.tar.gz 22.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for gradio-tunneling 0.9.1
File Interpreter ABI Platform
gradio_tunneling-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.0 MB

Release files / gradio_tunneling-0.9.1.tar.gz

Download URL gradio_tunneling-0.9.1.tar.gz
Size 22.9 MB
Tags Source
SHA-256 checksum
How to use checksums
a6912d4d3990dfafda061f95ae94622584c49cafde9a864b6b9117f11ec1a298
BLAKE2b-256 checksum
How to use checksums
c219631d07f08e5b3638f044ebc0f50b580cea5658fed6bd2b0fe7ac34c482e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / gradio_tunneling-0.9.1-py3-none-any.whl

Download URL gradio_tunneling-0.9.1-py3-none-any.whl
Size 23.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4687dbc37b6d99bc34c84bbb4c59f4e31809fa63ae02b9580108791fec7775c0
BLAKE2b-256 checksum
How to use checksums
0d109ad04f955adbed251258345dd35b7560f39a82d4aae8b040e128b12db60a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page