Skip to main content

What is Prime Tunnel?

Prime Tunnel creates secure, public URLs for services running on your local machine. You start a local server, create a tunnel, and get an HTTPS URL that anyone can access. Common use cases:
  • Expose a local development server to the internet
  • Receive webhooks from external services during development
  • Share a work-in-progress app with teammates
Hosted evaluations can use Prime Tunnel too. Launch the run with --allow-tunnel-access, then create the tunnel from inside the hosted sandbox using the same API or CLI flow described here. The flag only grants tunnel permissions to the temporary PRIME_API_KEY. See Hosted Evaluations.

Complete Example

Here’s a full working example: start a local HTTP server and expose it to the internet. 1. Start a local server
2. Create a tunnel (in another terminal)
3. Access your server Open the printed URL (e.g., https://t-0-abc123def456.tunnel.pinfra.io) in any browser. Your local server is now accessible from anywhere.

Context Manager

For automatic cleanup, use the async context manager:

Tunnel Properties

Protecting a Tunnel with Basic Auth

By default, anyone with the URL can reach your tunnel. To require credentials, provide a username when creating the tunnel — a strong password is auto-generated server-side and shown exactly once. All public traffic must then include HTTP basic auth; requests without valid credentials get a 401 Unauthorized.
The CLI prints the generated password when the tunnel starts:
Browsers prompt for the credentials automatically. For programmatic access, send the Authorization header:

CLI Commands

Rate Limits

The tunnel API enforces per-user rate limits over a 60-second window. Requests over the limit return 429 Too Many Requests. There is also a per-account cap on the number of concurrent tunnels (tunnel_limit on the wallet) - delete unused tunnels before creating new ones.