Expose HTTP & TCP ports
Each pod can expose up to 10 ports. HTTP ports are served over HTTPS through the Apipods proxy; TCP ports are mapped to a public IP address.
Declare ports
Set ports when you create the pod, or change it later with PATCH (a running pod is restarted to apply it).
curl -X PATCH https://api.apipods.com/v1/pods/pod_8f2k1x9q \
-H "Authorization: Bearer $APIPODS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ports": [
{
"port": 8888,
"protocol": "http"
},
{
"port": 8000,
"protocol": "http"
},
{
"port": 22,
"protocol": "tcp"
}
]
}'HTTP ports
Each HTTP port gets a URL of the form https://<pod id without prefix>-<port>.proxy.apipods.net. For pod pod_8f2k1x9q and port 8000 that is https://8f2k1x9q-8000.proxy.apipods.net.
- TLS is terminated at the proxy. Your server listens on plain HTTP.
- Your server must listen on
0.0.0.0, not127.0.0.1. - WebSockets and server-sent events are supported.
- Requests idle for more than 100 seconds are closed. Stream output or use a TCP port for long requests.
- The URL is public. Add authentication to anything you expose, for example an API key check in your app.
# inside the pod
$ python -m vllm.entrypoints.openai.api_server --model Qwen/Qwen3-8B --host 0.0.0.0 --port 8000
# from your laptop
$ curl https://8f2k1x9q-8000.proxy.apipods.net/v1/modelsTCP ports
TCP ports are mapped to a random public port on the host's public IP. The mapping appears in the pod object and as environment variables inside the pod:
| Field / variable | Example | Notes |
|---|---|---|
ports[].publicIp | 203.0.113.42 | Same as APIPODS_PUBLIC_IP |
ports[].publicPort | 40122 | Random, 10000 to 65000 |
APIPODS_TCP_PORT_22 | 40122 | One variable per TCP port: APIPODS_TCP_PORT_<port> |
The mapping is stable while the pod stays on the same host and may change after a stop and start. Read it from the API instead of hard-coding it.
Limits
- Up to 10 ports per pod, HTTP and TCP combined.
- UDP is not supported.
- Ports 1 to 1023 can be used inside the container, but TCP ports are always mapped to a high public port.
- Every host has a public IP, so TCP ports are always available.