Hands-on tutorials

Serve an LLM API with vLLM

Install vLLM in a dedicated environment, serve a small instruction model and test an OpenAI-compatible endpoint before scaling.

Examples for Linux and NVIDIA GPUs. Adapt paths and requirements to your instance. Commands are based on upstream documentation; they have not been benchmarked on every NOSGPU configuration.

1. Check compatibility first

vLLM serves supported language models through an HTTP API. This Linux example uses an NVIDIA GPU and a fresh Python environment. Check the current vLLM GPU, driver and Python requirements before installation; not every GPU or shared configuration supports every backend. Do not reuse the ComfyUI environment because dependency versions can conflict.

nvidia-smi
python3 -m venv .venv-vllm
source .venv-vllm/bin/activate
python -m pip install --upgrade pip
python -m pip install vllm

2. Start a small model

Use Qwen2.5-1.5B-Instruct for a first smoke test, subject to its model licence. vLLM downloads the weights on first use, so allow disk space and network access. The example limits context and concurrent sequences to reduce initial pressure; it still requires enough free VRAM. Keep the service on localhost for the test.

vllm serve Qwen/Qwen2.5-1.5B-Instruct \
  --host 127.0.0.1 --port 8000 \
  --max-model-len 2048 --max-num-seqs 2 \
  --gpu-memory-utilization 0.8

3. Make an API request

Open the SSH tunnel on your computer, replacing USER and SERVER_IP. Run curl from a second local terminal once the server is ready. The endpoint follows the OpenAI chat-completions format, but inference runs on your instance. Check the returned model name and response before connecting your application. Compatibility is not a guarantee that every OpenAI feature is implemented.

ssh -N -L 8000:127.0.0.1:8000 USER@SERVER_IP

curl http://127.0.0.1:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"Qwen/Qwen2.5-1.5B-Instruct","messages":[{"role":"user","content":"What is inference?"}],"max_tokens":128}'

4. Move from a test to a service

For Llama, choose a supported model ID and obtain any required repository access and licence approval before changing the command. Recheck memory needs. Benchmark concurrent requests, queueing and time to first token. For public deployment, add API authentication, TLS, request limits and monitoring. Pin tested versions and supervise the process; this terminal example is not a production deployment.

Official documentation

Put your next idea to work.

Choose the resources for your workload, or talk to us about requirements before deploying.