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 serverhttps://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 a401 Unauthorized.
Authorization header:
CLI Commands
Rate Limits
The tunnel API enforces per-user rate limits over a 60-second window.| Endpoint | Method | Limit |
|---|---|---|
/api/v1/tunnel | POST | 600 requests / 60s |
/api/v1/tunnel | GET | 300 requests / 60s |
/api/v1/tunnel/{id} | GET | 300 requests / 60s per tunnel |
/api/v1/tunnel/{id} | DELETE | 100 requests / 60s |
/api/v1/tunnel | DELETE | 100 requests / 60s (bulk) |
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.