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.17

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.17
File Size Uploaded Provenance Actions
prime_tunnel-0.1.17.tar.gz 27.2 kB With provenance Details for prime_tunnel-0.1.17.tar.gz

Built distribution (wheel)

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

Total release size: 48.5 kB

Release files / prime_tunnel-0.1.17.tar.gz

Download URL prime_tunnel-0.1.17.tar.gz
Size 27.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dbdb41d14246b3f9a9a825a13413d8f8738e1cf44fae493b5c6235a1f9438b8e
BLAKE2b-256 checksum
How to use checksums
c553feb14c6188ef6abcd1a57a75acf5283f933f798031eecd7082efc645c591
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 2, 2026.

Transparency log

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

Download URL prime_tunnel-0.1.17-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d78793706724709b57335ac40cff421357ed5953496bbc532c5db4040e416d0
BLAKE2b-256 checksum
How to use checksums
c4157e0ae988c2a526941b882951856b8ab9cdd065e52771c4e6f4abc7b3f519
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 2, 2026.

Transparency log

Security for prime-tunnel 0.1.17

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prime_tunnel-0.1.17.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 2, 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