Modal logo
GuideExamplesReferencePlayground
Log In Sign Up
Changelog API Reference modal.Appmodal.Clientmodal.CloudBucketMountmodal.Clsmodal.Cronmodal.Dictmodal.Environmentmodal.Errormodal.FilePatternMatchermodal.Functionmodal.FunctionCallmodal.Imagemodal.Periodmodal.Probemodal.Proxymodal.Queuemodal.Retriesmodal.Sandboxmodal.SandboxSnapshotmodal.Secretmodal.Tunnelmodal.Volumemodal.Workspacemodal.asgi_appmodal.batchedmodal.billingmodal.call_graphmodal.concurrentmodal.configmodal.container_processmodal.current_function_call_idmodal.current_input_idmodal.enable_outputmodal.entermodal.exceptionmodal.exitmodal.fastapi_endpointmodal.file_iomodal.forwardmodal.interactmodal.io_streamsmodal.is_localmodal.methodmodal.parametermodal.web_servermodal.wsgi_app CLI Reference modal appmodal billingmodal bootstrapmodal changelogmodal configmodal containermodal dashboardmodal deploymodal dictmodal environmentmodal imagemodal profilemodal queuemodal runmodal secretmodal servemodal setupmodal shellmodal skillsmodal tokenmodal volume

modal.Tunnel

class Tunnel(object)

A port forwarded from within a running Modal container. Created by modal.forward().

Important: This is an experimental API which may change in the future.

__init__(self, host, port, unencrypted_host, unencrypted_port)

url 

url(self)

Get the public HTTPS URL of the forwarded port.

tls_socket 

tls_socket(self)

Get the public TLS socket as a (host, port) tuple.

tcp_socket 

tcp_socket(self)

Get the public TCP socket as a (host, port) tuple.

modal.Tunnelurltls_sockettcp_socket
Modal logo © Modal 2026
About Status Changelog Documentation Slack Community Pricing Examples