vLLM can be deployed as a server that implements the OpenAI API protocol, so it works as a drop-in replacement for applications using the OpenAI API. The vllm serve command starts that server, and you call it with the same requests you would send to OpenAI.
Install vLLM
The quickstart lists Linux as the operating system and Python 3.10 to 3.13. It recommends uv, a fast Python environment manager, to create and manage the Python environment:
uv venv --python 3.12 --seed
source .venv/bin/activate
uv pip install vllm --torch-backend=auto
You can also use conda: create an environment with conda create -n myenv python=3.12 -y, activate it with conda activate myenv, then install uv with pip and run the same uv pip install vllm --torch-backend=auto command.
Serve a model
Start the server with a Hugging Face model. The quickstart example uses Qwen2.5-1.5B-Instruct:
vllm serve Qwen/Qwen2.5-1.5B-Instruct
By default, the server starts at http://localhost:8000. You can specify the address with the --host and --port arguments. The server currently hosts one model at a time. For chat to work, the model needs a chat template in its tokenizer configuration: without a chat template, the server will not be able to process chat and all chat requests will error. If a model has no chat template, pass one with the --chat-template flag and the path to a .jinja file. By default, the server applies generation_config.json from the Hugging Face model repository if it exists; pass --generation-config vllm when launching the server to use vLLM’s defaults instead.
Call the OpenAI-compatible API
List the models, then send a chat completion. The quickstart example asks who won the World Series in 2020:
curl http://localhost:8000/v1/models
curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "Qwen/Qwen2.5-1.5B-Instruct", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"}]}'
Pass the --api-key argument, or the VLLM_API_KEY environment variable, to make the server check for an API key in the header. From Python, use the OpenAI package with base_url="http://localhost:8000/v1" and api_key="EMPTY", then call client.chat.completions.create with the same model name you passed to vllm serve.
Try it: four checks from server to reply
| Check | What you should see | If you do not see it |
|---|---|---|
| Server starts | The vllm serve command stays running and the server listens at http://localhost:8000 |
Check the terminal output for the error, then run the command again |
| Models list | curl http://localhost:8000/v1/models returns Qwen/Qwen2.5-1.5B-Instruct |
Check the server is still running and the model name matches vllm serve |
| Chat reply | The chat completion returns an answer naming the 2020 winner | Check the model field matches the name you passed to vllm serve |
| Python client | The OpenAI client with base_url="http://localhost:8000/v1" gets a reply |
Check the base URL ends in /v1 and the model name matches |
Expected result. We checked the vLLM quickstart, which gives the Linux and Python 3.10 to 3.13 prerequisites, the uv install commands, the vllm serve command for Qwen/Qwen2.5-1.5B-Instruct, the default address http://localhost:8000, the /v1/models and /v1/chat/completions curl examples, and the –api-key and VLLM_API_KEY options, and the vLLM OpenAI-Compatible Server docs, which give the chat template requirement, the –chat-template and –generation-config flags, and the supported /v1 endpoints. We did not install vLLM or serve a model on this machine.
Limits
This guide covers one model served on one machine only. The quickstart lists Linux as the prerequisite operating system, and the install commands shown are for NVIDIA GPUs. The server hosts one model at a time. By default, vLLM downloads models from Hugging Face, so the first start includes a model download. The chat endpoint needs a model with a chat template, as described above. We did not test any of this ourselves.
Sources
- vLLM Quickstart — Linux and Python 3.10 to 3.13 prerequisites, uv install, vllm serve Qwen/Qwen2.5-1.5B-Instruct, server at http://localhost:8000, /v1/models and /v1/chat/completions examples, –api-key and VLLM_API_KEY, models downloaded from Hugging Face
- vLLM OpenAI-Compatible Server — vllm serve with –dtype and –api-key, OpenAI Python client at http://localhost:8000/v1, chat template requirement and –chat-template, –generation-config vllm, supported /v1 endpoints
