vllm
by vllm-project
Engine for running and serving large language models quickly while using less GPU memory.
- Stars
- 97,523 stars
- Forks
- 25k forks
- Last push
- today
- Activity
- Active
# Install vLLM$ uv pip install vllm --torch-backend=auto# Serve a model with an OpenAI-compatible API$ vllm serve Qwen/Qwen2.5-1.5B-Instruct# Check the server$ curl http://localhost:8000/v1/modelsCommands from the project's README. Run them after installing (see below).
Overview
Understand vllm in 60 seconds
- What it does
- vLLM is a Python library and server for running large language models efficiently. It loads open models from Hugging Face and serves them through an OpenAI-compatible API, so existing apps can switch to your own model with a URL change.
- The problem it solves
- Serving language models yourself is slow and memory-hungry if done naively. vLLM manages GPU memory carefully (its PagedAttention technique) and batches requests together so one GPU can answer many users at once.
- Why choose it
- Choose it when you have a GPU server and want fast, production-style serving of open models. For running a model casually on a laptop, a desktop tool like Ollama is simpler.
- Who should use it
- Teams self-hosting open models like Llama, Qwen or Gemma
- Developers who want an OpenAI-compatible endpoint for their own model
- ML engineers serving models at high throughput
- Researchers running batched inference over large datasets
- Setup difficulty
You'll need:
- Linux (macOS on Apple Silicon via vLLM-Metal)
- Python 3.11 to 3.14
- A supported GPU (NVIDIA, AMD, Intel) or CPU, with enough memory for your model
- uv recommended for installing
How vllm works
vLLM started at UC Berkeley's Sky Computing Lab and is now maintained by a large community of companies and universities. It is a library for LLM inference and serving: you point it at a model on Hugging Face and it runs it, either in a Python script or as a web server.
The server speaks the OpenAI API (plus the Anthropic Messages API and gRPC), so tools and SDKs built for OpenAI work against it. The README lists support for more than 200 model architectures, including Llama, Qwen, Gemma, Mixtral, DeepSeek-V3, multimodal models and embedding models.
Its speed comes from PagedAttention memory management, continuous batching of requests, prefix caching, quantization (FP8, INT8, INT4, GPTQ, AWQ, GGUF and more) and optimized GPU kernels. It also supports tool calling, structured output, multi-LoRA and spreading a model across several GPUs.
Features
Key features
OpenAI-compatible server
vllm serve exposes chat and completion endpoints that work with the OpenAI SDK and tools.
Hundreds of models
Runs 200+ model architectures from Hugging Face, including multimodal and embedding models.
High throughput
PagedAttention and continuous batching let one GPU serve many requests at once.
Quantization
Run smaller, faster versions of models with FP8, INT8, INT4, GPTQ, AWQ, GGUF and more.
Multi-GPU and distributed
Tensor, pipeline, data and expert parallelism for models too big for one GPU.
Broad hardware support
NVIDIA, AMD and Intel GPUs, x86/ARM/PowerPC CPUs, plus plugins for TPUs and other chips.
Strengths
- Widely used, very active project with a large community
- Drop-in OpenAI API replacement for your own models
- Strong performance for serving many users
- Apache-2.0 license, fine for commercial use
Limitations
- Linux is the main supported OS; macOS needs the separate vLLM-Metal plugin
- The server hosts one model at a time
- You need a GPU with enough memory for the model you choose
- More setup than desktop tools aimed at casual local use
Practical use cases
Private ChatGPT-style API
Serve an open model behind an OpenAI-compatible endpoint inside your company.
Swap out a paid API
Point an app built on the OpenAI SDK at your vLLM server by changing the base URL.
Batch processing
Use the Python LLM class to run prompts over a large dataset offline.
Serve fine-tuned models
Load several LoRA adapters on one base model and serve them together.
Installation
Install vllm
Commands come from vLLM's README and quickstart guide. AIRepoHub hasn't run them yet. View source
Prerequisites
- Linux
- Python 3.11–3.14
- uv
- A supported GPU
Supported systems
- Linux
- macOS (Apple Silicon, via vLLM-Metal)
- 1
Create a Python environment
Shelluv venv --python 3.14 --seedsource .venv/bin/activate - 2
Install vLLM
--torch-backend=auto picks the right PyTorch build for your CUDA driver.
Shelluv pip install vllm --torch-backend=auto - 3
Download precompiled kernels
Optional, but avoids several minutes of compiling at startup on newer GPUs.
Shellvllm download-kernels
- 1
Create a Python environment
Shelluv venv --python 3.14 --seedsource .venv/bin/activate - 2
Install vLLM for ROCm
Shelluv pip install vllm --extra-index-url https://wheels.vllm.ai/rocm/
Configuration and API keys
| Setting | What it's for |
|---|---|
VLLM_API_KEYOptional | Set this (or pass --api-key) to make the server require an API key. |
UV_TORCH_BACKENDOptional | Choose a specific PyTorch backend, for example cu126, instead of auto-detection. |
First run
- 1
Start the server
Shellvllm serve Qwen/Qwen2.5-1.5B-Instruct - 2
List the served models
Shellcurl http://localhost:8000/v1/models
vllm's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.
Your first project
Serve an open model with an OpenAI-compatible API
Run Qwen2.5-1.5B-Instruct on your own GPU and call it like the OpenAI API.
Before you start
- vLLM installed (see Installation)
- A Linux machine with a supported GPU
- 1
Start the server
It listens on http://localhost:8000 by default.
Shellvllm serve Qwen/Qwen2.5-1.5B-Instruct - 2
Check which model is loaded
Shellcurl http://localhost:8000/v1/models - 3
Send a chat request
Shellcurl 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?"} ] }'
What to expect
The server downloads the model from Hugging Face, starts on port 8000, and answers the chat request in the same JSON format as the OpenAI API.
Next steps
- Point the OpenAI Python SDK at http://localhost:8000/v1 to use it from code
- Add --api-key to require a key
- Use the LLM class in Python for offline batch inference
Costs and requirements
What it costs to run
- License
- Apache-2.0. Free to use, modify and use commercially.Free
- Software
- Free and open source.Free
- Hardware
- You need your own GPU machine or a cloud GPU, which can cost money per hour.Depends
- Models
- Open models on Hugging Face are free to download; check each model's license.Depends
Troubleshooting
Common setup issues
Startup takes several minutes
Run vllm download-kernels after installing to use precompiled kernels instead of compiling them at startup.
Wrong PyTorch or CUDA build installed
Install with --torch-backend=auto, or set a specific backend such as --torch-backend=cu126.
Answers differ from what you expect
The server applies the model's generation_config.json by default. Pass --generation-config vllm to turn that off.
Running on a Mac
Use vLLM-Metal for Apple Silicon; see the GPU installation guide's Apple Silicon tab.
Alternatives
Similar AI repositories
markitdown
microsoft
Python tool from Microsoft that converts PDFs, Word, Excel, PowerPoint and other files into Markdown for use with AI.
transformers
huggingface
Hugging Face library for defining, running and training machine learning models for text, vision and audio.
langchain
langchain-ai
Framework for building LLM-powered applications and agents.
pytorch
pytorch
Python framework for building and training neural networks with tensors and GPU acceleration.