Reference · Local AI servers
vLLM port 8000: host binding, --api-key and the endpoints it leaves open
vllm serve listens on every IPv4 interface on port 8000 unless --host says otherwise, and --api-key or VLLM_API_KEY guards only some paths. Check the binding, pin it to 127.0.0.1 and put a proxy in front.
| Target artifact | vLLM's OpenAI-compatible HTTP server, started with vllm serve, on TCP port 8000 unless --port changes it. |
|---|---|
| Default behaviour | With no --host, it binds an empty host address, which means every IPv4 interface, and logs it as 0.0.0.0. There is no API key until you set --api-key or VLLM_API_KEY, and even then the key covers only some paths, such as those under /v1; /invocations, /metrics, /tokenize, /health and /version answer without it. |
| Safe state | Started with --host 127.0.0.1; any access from other machines goes through a reverse proxy that allows only the endpoints you need and adds its own authentication; an API key set as well; VLLM_SERVER_DEV_MODE unset; no --grpc-port reachable from untrusted networks. |
| Check on Linux | sudo ss -tlnp | grep -E ':8000\b' |
| Check in Docker | docker ps --format 'table {{.Names}}\t{{.Ports}}' |
| Check from another device | curl --max-time 5 -i http://SERVER_IP:8000/version |
| Fix on Linux | add --host 127.0.0.1 to the vllm serve command |
| Fix in Docker | publish with -p 127.0.0.1:8000:8000, never -p 8000:8000 |
Read the result
| What you see | Meaning |
|---|---|
0.0.0.0:8000 in ss | Every IPv4 interface: vLLM's default when --host is not given |
127.0.0.1:8000 | This computer only |
0.0.0.0:8000->8000/tcp in docker ps | Published on every host address, as in vLLM's documented Docker command |
127.0.0.1:8000->8000/tcp | Only the host itself can connect |
vLLM's command-line reference lists no default for --host. Its server code builds the listening address as (args.host or "", args.port); Python binds an empty host to INADDR_ANY, every IPv4 interface, and vLLM's start-up log reports the address as http://0.0.0.0:8000.
From another device, a status line in reply to /version means the server answers from there, with or without an API key, because /version is not protected. "Connection refused" or a timeout means it does not.
What --api-key protects
--api-key, or the VLLM_API_KEY environment variable, makes clients send the key as a Bearer token, but only on some paths. vLLM's security documentation says not to rely on it alone.
- Needs the key: paths under
/v1,/v2,/inferenceand/cohere, such as/v1/chat/completions,/v1/embeddingsand/v1/models. - Answers without it:
/invocations, a SageMaker-compatible endpoint that routes to the same inference functions as/v1;/generative_scoring,/pooling,/classify, and/scoreand/rerankoutside/v1;/metrics, with model, throughput, queue and KV-cache statistics;/kv_event_sources,/tokenize,/detokenize,/health,/ping,/versionand/load; and operational endpoints such as/pause,/abort_requestsand/update_weightswhen the model supports text generation.
So anyone who can reach the port can still run the model through /invocations, key or no key. The key is a second layer; where the server listens is the first.
curl --max-time 5 -H "Authorization: Bearer YOUR_KEY" http://127.0.0.1:8000/v1/modelsGenerate a key with openssl rand -hex 32, and pass it in VLLM_API_KEY rather than with --api-key, so it does not appear in the server's command line.
Keep it on 127.0.0.1
vllm serve
vllm serve NousResearch/Meta-Llama-3-8B-Instruct --host 127.0.0.1 --port 8000Use your own model name in place of the example. Then run the check again; it should show 127.0.0.1:8000.
Docker (vllm/vllm-openai)
vLLM's Docker documentation publishes the port with -p 8000:8000, on every host address. This is the same command with the port on the loopback address and the key passed in from your shell:
docker run --runtime nvidia --gpus all -v ~/.cache/huggingface:/root/.cache/huggingface --env "HF_TOKEN=$HF_TOKEN" --env "VLLM_API_KEY=$VLLM_API_KEY" -p 127.0.0.1:8000:8000 --ipc=host vllm/vllm-openai:latest --model Qwen/Qwen3-0.6BInside the container vLLM still listens on all of the container's addresses; the host side of -p decides who can connect. Ports published by Docker bypass UFW; see Docker published ports.
Reaching it from another computer
ssh -N -L 8000:127.0.0.1:8000 USER@AI_SERVERWhile the tunnel runs, http://127.0.0.1:8000/v1 on the laptop reaches the server. For several users, vLLM's security documentation recommends a reverse proxy that explicitly allows only the endpoints you want to expose, and adds authentication, rate limiting and logging.
Settings that open more
--grpc-port: starts a gRPC service on that port, bound to the same host address as the HTTP server. vLLM's documentation says the gRPC interface has no authentication, authorization or encryption, and must not be exposed to the internet or untrusted clients. Without the option, no gRPC server starts.VLLM_SERVER_DEV_MODE=1: adds development endpoints, including/collective_rpc, which executes arbitrary RPC methods on the engine. The documentation says never to set it in production.- Several machines: communication between the nodes of a multi-node deployment is insecure by default, and PyTorch's
TCPStorelistens on all network interfaces. SetVLLM_HOST_IPto a specific address and keep the nodes on a dedicated, isolated network. --allowed-local-media-path: lets API requests read local images or videos from the folders you name. It is empty by default; keep it empty on any server other people can reach.--allowed-origins: cross-origin browser access is off by default. Leave it empty unless a specific web app needs it.
Troubleshooting
Requests without the key are refused, but /version still answers
That is expected: the key covers only some paths. Keep the port off the network, and filter paths in a reverse proxy if other machines need it.
The key is set, but the check still shows 0.0.0.0
The key does not change where vLLM listens. Add --host 127.0.0.1, or publish the Docker port on 127.0.0.1.
Something else answers on port 8000
Another program owns the port; the last column of sudo ss -tlnp names it. Chroma's server also uses port 8000 by default; see Qdrant and Chroma.