Skip to main content

Prime Tunnel SDK

Expose local services via secure tunnels on Prime infrastructure.

Installation

uv pip install prime-tunnel

Or with pip:

pip install prime-tunnel

Quick Start

from prime_tunnel import Tunnel

# Create and start a tunnel
async with Tunnel(local_port=8765) as tunnel:
    print(f"Tunnel URL: {tunnel.url}")
    # Your local service on port 8765 is now accessible at tunnel.url

If a tunnel stops serving while it should stay at the same URL, restart its client. The registration is kept, so tunnel.url does not change:

await tunnel.restart()

A tunnel that was deleted, expired, or stayed disconnected for too long cannot be restarted: restart() raises TunnelGoneError, and tunnel.is_gone turns true as soon as the tunnel service rejects the client. Stop it and start a new tunnel, which gets a new URL. await tunnel.status() reports the client process and the service's record of the tunnel:

status = await tunnel.status()
if status.gone:
    await tunnel.stop()

Keeping a tunnel up

keep_serving() checks that requests reach your service through the tunnel's URL, and restarts the client if they stop. Give it a path on your service that returns 2xx, and run it as a task:

watch = asyncio.create_task(tunnel.keep_serving("/health"))

If your service itself is down, nothing is restarted. If the tunnel was deleted or expired, the task raises TunnelGoneError, and you need a new tunnel with a new URL. Cancel the task to stop watching.

CLI Usage

# Start a tunnel
prime tunnel start --port 8765

# List active tunnels
prime tunnel list

# Get tunnel status
prime tunnel status <tunnel_id>

Documentation

Full API reference: https://github.com/PrimeIntellect-ai/prime/tree/main/packages/prime-tunnel

  • prime - Full CLI + SDK with pods, inference, and more (includes this package)

License

MIT License - see LICENSE file for details

Metadata

Release files for prime-tunnel 0.1.18

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

Source distribution (sdist)

Source distribution for prime-tunnel 0.1.18
File Size Uploaded Provenance Actions
prime_tunnel-0.1.18.tar.gz 28.0 kB With provenance Details for prime_tunnel-0.1.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prime-tunnel 0.1.18
File Interpreter ABI Platform Actions
prime_tunnel-0.1.18-py3-none-any.whl Python 3 none any Details for prime_tunnel-0.1.18-py3-none-any.whl

Total release size: 49.8 kB

Release files / prime_tunnel-0.1.18.tar.gz

Download URL prime_tunnel-0.1.18.tar.gz
Size 28.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5f3654fae379289acb1c6c2a5bbd7d95d2ad1b71d97e3beacecae29acfdae4da
BLAKE2b-256 checksum
How to use checksums
c949da942db50679910616b8af05eedd95d01bacf6be53c2c0ce62e3c440791c
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 Nov 20, 2026.

Transparency log

Release files / prime_tunnel-0.1.18-py3-none-any.whl

Download URL prime_tunnel-0.1.18-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e145b933d6a27505ca9b68d477e570958c21da9a2700bd8637b0bd5cf8bd5ad
BLAKE2b-256 checksum
How to use checksums
1d30b5f478351537a117360719d8a71fb3a884a7623c192d8612567e8a0ee76d
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 Nov 20, 2026.

Transparency log

Security for prime-tunnel 0.1.18

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prime_tunnel-0.1.18.tar.gz

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 Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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